зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1461938 part 3 - Store JS::Realm* instead of JSCompartment* in ObjectGroup. r=luke
--HG-- extra : rebase_source : a569b3b066beea3cad4acb30ea8e8084e59763f7
This commit is contained in:
Родитель
2b6f16e9ea
Коммит
2b5a2e2776
|
@ -8056,7 +8056,7 @@ GCRuntime::mergeCompartments(JSCompartment* source, JSCompartment* target)
|
|||
}
|
||||
|
||||
group->setGeneration(target->zone()->types.generation);
|
||||
group->compartment_ = target;
|
||||
group->realm_ = JS::GetRealmForCompartment(target);
|
||||
|
||||
// Remove any unboxed layouts from the list in the off thread
|
||||
// compartment. These do not need to be reinserted in the target
|
||||
|
|
|
@ -3275,7 +3275,7 @@ MacroAssembler::branchTestObjCompartment(Condition cond, Register obj, const Add
|
|||
{
|
||||
MOZ_ASSERT(obj != scratch);
|
||||
loadPtr(Address(obj, JSObject::offsetOfGroup()), scratch);
|
||||
loadPtr(Address(scratch, ObjectGroup::offsetOfCompartment()), scratch);
|
||||
loadPtr(Address(scratch, ObjectGroup::offsetOfRealm()), scratch);
|
||||
branchPtr(cond, compartment, scratch, label);
|
||||
}
|
||||
|
||||
|
@ -3286,7 +3286,7 @@ MacroAssembler::branchTestObjCompartment(Condition cond, Register obj,
|
|||
{
|
||||
MOZ_ASSERT(obj != scratch);
|
||||
loadPtr(Address(obj, JSObject::offsetOfGroup()), scratch);
|
||||
loadPtr(Address(scratch, ObjectGroup::offsetOfCompartment()), scratch);
|
||||
loadPtr(Address(scratch, ObjectGroup::offsetOfRealm()), scratch);
|
||||
branchPtr(cond, scratch, ImmPtr(compartment), label);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ class JSObject : public js::gc::Cell
|
|||
|
||||
JSCompartment* compartment() const { return group_->compartment(); }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
JS::Realm* realm() const { return group_->realm(); }
|
||||
|
||||
inline js::Shape* maybeShape() const;
|
||||
inline js::Shape* ensureShape(JSContext* cx);
|
||||
|
|
|
@ -34,7 +34,7 @@ using mozilla::PodZero;
|
|||
// ObjectGroup
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
ObjectGroup::ObjectGroup(const Class* clasp, TaggedProto proto, JSCompartment* comp,
|
||||
ObjectGroup::ObjectGroup(const Class* clasp, TaggedProto proto, JS::Realm* realm,
|
||||
ObjectGroupFlags initialFlags)
|
||||
{
|
||||
PodZero(this);
|
||||
|
@ -45,7 +45,7 @@ ObjectGroup::ObjectGroup(const Class* clasp, TaggedProto proto, JSCompartment* c
|
|||
|
||||
this->clasp_ = clasp;
|
||||
this->proto_ = proto;
|
||||
this->compartment_ = comp;
|
||||
this->realm_ = realm;
|
||||
this->flags_ = initialFlags;
|
||||
|
||||
setGeneration(zone()->types.generation);
|
||||
|
@ -1673,7 +1673,7 @@ ObjectGroupCompartment::makeGroup(JSContext* cx, const Class* clasp,
|
|||
ObjectGroup* group = Allocate<ObjectGroup>(cx);
|
||||
if (!group)
|
||||
return nullptr;
|
||||
new(group) ObjectGroup(clasp, proto, cx->compartment(), initialFlags);
|
||||
new(group) ObjectGroup(clasp, proto, cx->realm(), initialFlags);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ class ObjectGroup : public gc::TenuredCell
|
|||
/* Prototype shared by objects in this group. */
|
||||
GCPtr<TaggedProto> proto_;
|
||||
|
||||
/* Compartment shared by objects in this group. */
|
||||
JSCompartment* compartment_;
|
||||
/* Realm shared by objects in this group. */
|
||||
JS::Realm* realm_;
|
||||
|
||||
public:
|
||||
const Class* clasp() const {
|
||||
|
@ -152,8 +152,9 @@ class ObjectGroup : public gc::TenuredCell
|
|||
return res;
|
||||
}
|
||||
|
||||
JSCompartment* compartment() const { return compartment_; }
|
||||
JSCompartment* compartment() const { return JS::GetCompartmentForRealm(realm_); }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
JS::Realm* realm() const { return realm_; }
|
||||
|
||||
private:
|
||||
/* Flags for this group. */
|
||||
|
@ -377,7 +378,7 @@ class ObjectGroup : public gc::TenuredCell
|
|||
Property** propertySet;
|
||||
public:
|
||||
|
||||
inline ObjectGroup(const Class* clasp, TaggedProto proto, JSCompartment* comp,
|
||||
inline ObjectGroup(const Class* clasp, TaggedProto proto, JS::Realm* realm,
|
||||
ObjectGroupFlags initialFlags);
|
||||
|
||||
inline bool hasAnyFlags(const AutoSweepObjectGroup& sweep, ObjectGroupFlags flags);
|
||||
|
@ -475,8 +476,8 @@ class ObjectGroup : public gc::TenuredCell
|
|||
return offsetof(ObjectGroup, proto_);
|
||||
}
|
||||
|
||||
static inline uint32_t offsetOfCompartment() {
|
||||
return offsetof(ObjectGroup, compartment_);
|
||||
static inline uint32_t offsetOfRealm() {
|
||||
return offsetof(ObjectGroup, realm_);
|
||||
}
|
||||
|
||||
static inline uint32_t offsetOfAddendum() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче