Bug 1659885 - Define |JS::shadow::ObjectGroup| in public shadow API in its own minimal header. r=jonco

Differential Revision: https://phabricator.services.mozilla.com/D87530
This commit is contained in:
Jeff Walden 2020-08-20 19:21:09 +00:00
Родитель 63004db93f
Коммит d65f864b4e
7 изменённых файлов: 42 добавлений и 10 удалений

Просмотреть файл

@ -0,0 +1,33 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Shadow definition of |js::ObjectGroup| innards. Do not use this directly! */
#ifndef js_shadow_ObjectGroup_h
#define js_shadow_ObjectGroup_h
#include "jstypes.h" // JS_PUBLIC_API
struct JSClass;
class JS_PUBLIC_API JSObject;
namespace JS {
class JS_PUBLIC_API Realm;
namespace shadow {
struct ObjectGroup {
const JSClass* clasp;
JSObject* proto;
JS::Realm* realm;
};
} // namespace shadow
} // namespace JS
#endif // js_shadow_ObjectGroup_h

Просмотреть файл

@ -233,7 +233,7 @@ const WHITELIST_TYPES: &'static [&'static str] = &[
"js::Scalar::Type",
"JS::ServoSizes",
"js::shadow::Object",
"js::shadow::ObjectGroup",
"JS::shadow::ObjectGroup",
"JS::SourceText",
"js::StackFormat",
"JSStructuredCloneCallbacks",

Просмотреть файл

@ -28,6 +28,7 @@ typedef uint32_t HashNumber;
#include "js/Initialization.h"
#include "js/MemoryMetrics.h"
#include "js/PropertySpec.h"
#include "js/shadow/ObjectGroup.h"
#include "js/SourceText.h"
#include "js/StructuredClone.h"
#include "js/ValueArray.h"

Просмотреть файл

@ -1100,7 +1100,7 @@ pub static SIMPLE_GLOBAL_CLASS: JSClass = JSClass {
};
#[inline]
unsafe fn get_object_group(obj: *mut JSObject) -> *mut js::shadow::ObjectGroup {
unsafe fn get_object_group(obj: *mut JSObject) -> *mut JS::shadow::ObjectGroup {
assert!(!obj.is_null());
let obj = obj as *mut js::shadow::Object;
(*obj).group

Просмотреть файл

@ -19,6 +19,7 @@
#include "js/Exception.h"
#include "js/friend/ErrorMessages.h"
#include "js/HeapAPI.h"
#include "js/shadow/ObjectGroup.h" // JS::shadow::ObjectGroup
#include "js/shadow/String.h" // JS::shadow::String
#include "js/TypeDecls.h"
#include "js/Utility.h"
@ -370,12 +371,6 @@ extern JS_FRIEND_API bool IsSharableCompartment(JS::Compartment* comp);
*/
namespace shadow {
struct ObjectGroup {
const JSClass* clasp;
JSObject* proto;
JS::Realm* realm;
};
struct BaseShape {
const JSClass* clasp_;
JSObject* parent;
@ -397,7 +392,7 @@ class Shape {
* depending on the object's specific layout.
*/
struct Object {
shadow::ObjectGroup* group;
JS::shadow::ObjectGroup* group;
shadow::Shape* shape;
JS::Value* slots;
void* _1;

Просмотреть файл

@ -254,6 +254,7 @@ EXPORTS.js.friend += [
# to back actual implementations *with* these shadow definitions to eliminate
# this requirement.)
EXPORTS.js.shadow += [
'../public/shadow/ObjectGroup.h',
'../public/shadow/String.h',
]

Просмотреть файл

@ -7,6 +7,8 @@
#ifndef vm_ObjectGroup_h
#define vm_ObjectGroup_h
#include "js/shadow/ObjectGroup.h" // JS::shadow::ObjectGroup
#include "jsfriendapi.h"
#include "ds/IdValuePair.h"
@ -438,7 +440,7 @@ class ObjectGroup : public gc::TenuredCellWithNonGCPointer<const JSClass> {
static void staticAsserts() {
static_assert(offsetof(ObjectGroup, proto_) ==
offsetof(js::shadow::ObjectGroup, proto));
offsetof(JS::shadow::ObjectGroup, proto));
}
public: