mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1167291 - Generalize the marking tracer's cross-compartment check; r=jonco
This commit is contained in:
parent
12554cb2df
commit
dc697a8108
@ -230,6 +230,9 @@ struct Cell
|
||||
inline JSRuntime* runtimeFromAnyThread() const;
|
||||
inline JS::shadow::Runtime* shadowRuntimeFromAnyThread() const;
|
||||
|
||||
// May be overridden by GC thing kinds that have a compartment pointer.
|
||||
inline JSCompartment* maybeCompartment() const { return nullptr; }
|
||||
|
||||
inline StoreBuffer* storeBuffer() const;
|
||||
|
||||
inline JSGCTraceKind getTraceKind() const;
|
||||
|
@ -737,21 +737,23 @@ template <typename S, typename T>
|
||||
void
|
||||
js::GCMarker::traverseEdge(S source, T target)
|
||||
{
|
||||
// Atoms and Symbols do not have or mark their internal pointers, respectively.
|
||||
MOZ_ASSERT(!ThingIsPermanentAtomOrWellKnownSymbol(source));
|
||||
|
||||
// The Zones must match, unless the target is an atom.
|
||||
MOZ_ASSERT_IF(!ThingIsPermanentAtomOrWellKnownSymbol(target),
|
||||
target->zone()->isAtomsZone() || target->zone() == source->zone());
|
||||
traverse(target);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
// Special-case JSObject->JSObject edges to check the compartment too.
|
||||
template <>
|
||||
void
|
||||
GCMarker::traverseEdge(JSObject* source, JSObject* target)
|
||||
{
|
||||
MOZ_ASSERT(target->compartment() == source->compartment());
|
||||
// Atoms and Symbols do not have access to a compartment pointer, or we'd need
|
||||
// to adjust the subsequent check to catch that case.
|
||||
MOZ_ASSERT_IF(ThingIsPermanentAtomOrWellKnownSymbol(target), !target->maybeCompartment());
|
||||
MOZ_ASSERT_IF(target->zoneFromAnyThread()->isAtomsZone(), !target->maybeCompartment());
|
||||
// If we have access to a compartment pointer for both things, they must match.
|
||||
MOZ_ASSERT_IF(source->maybeCompartment() && target->maybeCompartment(),
|
||||
source->maybeCompartment() == target->maybeCompartment());
|
||||
|
||||
traverse(target);
|
||||
}
|
||||
} // namespace js
|
||||
|
||||
template <typename V, typename S> struct TraverseEdgeFunctor : public VoidDefaultAdaptor<V> {
|
||||
template <typename T> void operator()(T t, GCMarker* gcmarker, S s) {
|
||||
|
@ -155,9 +155,8 @@ class JSObject : public js::gc::Cell
|
||||
return group_->lazy();
|
||||
}
|
||||
|
||||
JSCompartment* compartment() const {
|
||||
return group_->compartment();
|
||||
}
|
||||
JSCompartment* compartment() const { return group_->compartment(); }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
|
||||
inline js::Shape* maybeShape() const;
|
||||
inline js::Shape* ensureShape(js::ExclusiveContext* cx);
|
||||
|
@ -1061,6 +1061,7 @@ class JSScript : public js::gc::TenuredCell
|
||||
inline JSPrincipals* principals();
|
||||
|
||||
JSCompartment* compartment() const { return compartment_; }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
|
||||
void setVersion(JSVersion v) { version = v; }
|
||||
|
||||
|
@ -216,9 +216,8 @@ class ObjectGroup : public gc::TenuredCell
|
||||
return res;
|
||||
}
|
||||
|
||||
JSCompartment* compartment() const {
|
||||
return compartment_;
|
||||
}
|
||||
JSCompartment* compartment() const { return compartment_; }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
|
||||
private:
|
||||
/* Flags for this group. */
|
||||
|
@ -426,6 +426,7 @@ class BaseShape : public gc::TenuredCell
|
||||
void setSlotSpan(uint32_t slotSpan) { MOZ_ASSERT(isOwned()); slotSpan_ = slotSpan; }
|
||||
|
||||
JSCompartment* compartment() const { return compartment_; }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
|
||||
/*
|
||||
* Lookup base shapes from the compartment's baseShapes table, adding if
|
||||
@ -655,6 +656,7 @@ class Shape : public gc::TenuredCell
|
||||
|
||||
const HeapPtrShape& previous() const { return parent; }
|
||||
JSCompartment* compartment() const { return base()->compartment(); }
|
||||
JSCompartment* maybeCompartment() const { return compartment(); }
|
||||
|
||||
template <AllowGC allowGC>
|
||||
class Range {
|
||||
|
Loading…
Reference in New Issue
Block a user