зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1180017 - Fix up the badly-horked backout and re-land.
CLOSED TREE --HG-- extra : amend_source : 0b7ac18429b248cf05cfe33f6b2f6efdf1602c38 extra : histedit_source : bdb11dafa100809ec17491e5711fb0b507e023c6%2C5e4134650a804859dc8b3078688fa4655052263f
This commit is contained in:
Родитель
0f37e4057c
Коммит
fb6b2747d5
|
@ -102,7 +102,7 @@ DebugWrapperTraceCallback(JS::GCCellPtr aPtr, const char* aName, void* aClosure)
|
|||
DebugWrapperTraversalCallback* callback =
|
||||
static_cast<DebugWrapperTraversalCallback*>(aClosure);
|
||||
if (aPtr.is<JSObject>()) {
|
||||
callback->NoteJSObject(&aPtr.to<JSObject>());
|
||||
callback->NoteJSObject(&aPtr.as<JSObject>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|||
static void
|
||||
UnmarkXBLJSObject(JS::GCCellPtr aPtr, const char* aName, void* aClosure)
|
||||
{
|
||||
JS::ExposeObjectToActiveJS(&aPtr.to<JSObject>());
|
||||
JS::ExposeObjectToActiveJS(&aPtr.as<JSObject>());
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
|
|
|
@ -164,8 +164,8 @@ class JS_FRIEND_API(GCCellPtr)
|
|||
|
||||
// Construction from an explicit type.
|
||||
template <typename T>
|
||||
explicit GCCellPtr(T* ptr) : ptr(checkedCast(ptr, JS::MapTypeToTraceKind<T>::kind)) { }
|
||||
explicit GCCellPtr(JSFunction* ptr) : ptr(checkedCast(ptr, JS::TraceKind::Object)) { }
|
||||
explicit GCCellPtr(T* p) : ptr(checkedCast(p, JS::MapTypeToTraceKind<T>::kind)) { }
|
||||
explicit GCCellPtr(JSFunction* p) : ptr(checkedCast(p, JS::TraceKind::Object)) { }
|
||||
explicit GCCellPtr(JSFlatString* str) : ptr(checkedCast(str, JS::TraceKind::String)) { }
|
||||
explicit GCCellPtr(const Value& v);
|
||||
|
||||
|
@ -189,7 +189,7 @@ class JS_FRIEND_API(GCCellPtr)
|
|||
// Conversions to more specific types must match the kind. Access to
|
||||
// further refined types is not allowed directly from a GCCellPtr.
|
||||
template <typename T>
|
||||
T& to() const {
|
||||
T& as() const {
|
||||
MOZ_ASSERT(kind() == JS::MapTypeToTraceKind<T>::kind);
|
||||
// We can't use static_cast here, because the fact that JSObject
|
||||
// inherits from js::gc::Cell is not part of the public API.
|
||||
|
|
|
@ -341,7 +341,7 @@ ObjectGroupCycleCollectorTracer::onChild(const JS::GCCellPtr& thing)
|
|||
if (thing.is<ObjectGroup>()) {
|
||||
// If this group is required to be in an ObjectGroup chain, trace it
|
||||
// via the provided worklist rather than continuing to recurse.
|
||||
ObjectGroup& group = thing.to<ObjectGroup>();
|
||||
ObjectGroup& group = thing.as<ObjectGroup>();
|
||||
if (group.maybeUnboxedLayout()) {
|
||||
for (size_t i = 0; i < seen.length(); i++) {
|
||||
if (seen[i] == &group)
|
||||
|
|
|
@ -18,6 +18,10 @@ class Common(object):
|
|||
# the template member holds the referent directly.
|
||||
handle = False
|
||||
|
||||
# If True, we should strip typedefs from our referent type. (Rooted<T>
|
||||
# uses template magic that gives the referent a noisy type.)
|
||||
strip_typedefs = False
|
||||
|
||||
# Initialize a pretty-printer for |value|, using |cache|.
|
||||
#
|
||||
# If given, |content_printer| is a pretty-printer constructor to use for
|
||||
|
@ -42,6 +46,8 @@ class Common(object):
|
|||
ptr = self.value[self.member]
|
||||
if self.handle:
|
||||
ptr = ptr.dereference()
|
||||
if self.strip_typedefs:
|
||||
ptr = ptr.cast(ptr.type.strip_typedefs())
|
||||
if self.content_printer:
|
||||
return self.content_printer(ptr, self.cache).to_string()
|
||||
else:
|
||||
|
@ -53,7 +59,7 @@ class Common(object):
|
|||
|
||||
@template_pretty_printer("JS::Rooted")
|
||||
class Rooted(Common):
|
||||
pass
|
||||
strip_typedefs = True
|
||||
|
||||
@template_pretty_printer("JS::Handle")
|
||||
class Handle(Common):
|
||||
|
|
|
@ -206,14 +206,14 @@ JS_FRIEND_API(void)
|
|||
JS_TraceShapeCycleCollectorChildren(JS::CallbackTracer* trc, JS::GCCellPtr shape)
|
||||
{
|
||||
MOZ_ASSERT(shape.is<Shape>());
|
||||
TraceCycleCollectorChildren(trc, &shape.to<Shape>());
|
||||
TraceCycleCollectorChildren(trc, &shape.as<Shape>());
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
JS_TraceObjectGroupCycleCollectorChildren(JS::CallbackTracer* trc, JS::GCCellPtr group)
|
||||
{
|
||||
MOZ_ASSERT(group.is<ObjectGroup>());
|
||||
TraceCycleCollectorChildren(trc, &group.to<ObjectGroup>());
|
||||
TraceCycleCollectorChildren(trc, &group.as<ObjectGroup>());
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -853,7 +853,7 @@ struct DumpHeapTracer : public JS::CallbackTracer, public WeakMapTracer
|
|||
void trace(JSObject* map, JS::GCCellPtr key, JS::GCCellPtr value) override {
|
||||
JSObject* kdelegate = nullptr;
|
||||
if (key.is<JSObject>())
|
||||
kdelegate = js::GetWeakmapKeyDelegate(&key.to<JSObject>());
|
||||
kdelegate = js::GetWeakmapKeyDelegate(&key.as<JSObject>());
|
||||
|
||||
fprintf(output, "WeakMapEntry map=%p key=%p keyDelegate=%p value=%p\n",
|
||||
map, key.asCell(), kdelegate, value.asCell());
|
||||
|
|
|
@ -7003,8 +7003,8 @@ JS::GCCellPtr::outOfLineKind() const
|
|||
bool
|
||||
JS::GCCellPtr::mayBeOwnedByOtherRuntime() const
|
||||
{
|
||||
return (is<JSString>() && to<JSString>().isPermanentAtom()) ||
|
||||
(is<Symbol>() && to<Symbol>().isWellKnownSymbol());
|
||||
return (is<JSString>() && as<JSString>().isPermanentAtom()) ||
|
||||
(is<Symbol>() && as<Symbol>().isWellKnownSymbol());
|
||||
}
|
||||
|
||||
#ifdef JSGC_HASH_TABLE_CHECKS
|
||||
|
|
|
@ -118,9 +118,9 @@ class SimpleEdgeVectorTracer : public JS::CallbackTracer {
|
|||
|
||||
// Don't trace permanent atoms and well-known symbols that are owned by
|
||||
// a parent JSRuntime.
|
||||
if (thing.is<JSString>() && thing.to<JSString>().isPermanentAtom())
|
||||
if (thing.is<JSString>() && thing.as<JSString>().isPermanentAtom())
|
||||
return;
|
||||
if (thing.is<JS::Symbol>() && thing.to<JS::Symbol>().isWellKnownSymbol())
|
||||
if (thing.is<JS::Symbol>() && thing.as<JS::Symbol>().isWellKnownSymbol())
|
||||
return;
|
||||
|
||||
char16_t* name16 = nullptr;
|
||||
|
|
|
@ -189,7 +189,7 @@ NoteWeakMapsTracer::trace(JSObject* aMap, JS::GCCellPtr aKey,
|
|||
|
||||
JSObject* kdelegate = nullptr;
|
||||
if (aKey.is<JSObject>()) {
|
||||
kdelegate = js::GetWeakmapKeyDelegate(&aKey.to<JSObject>());
|
||||
kdelegate = js::GetWeakmapKeyDelegate(&aKey.as<JSObject>());
|
||||
}
|
||||
|
||||
if (AddToCCKind(aValue.kind())) {
|
||||
|
@ -245,7 +245,7 @@ struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer
|
|||
}
|
||||
|
||||
if (delegateMightNeedMarking && aKey.is<JSObject>()) {
|
||||
JSObject* kdelegate = js::GetWeakmapKeyDelegate(&aKey.to<JSObject>());
|
||||
JSObject* kdelegate = js::GetWeakmapKeyDelegate(&aKey.as<JSObject>());
|
||||
if (kdelegate && !JS::ObjectIsMarkedGray(kdelegate)) {
|
||||
if (JS::UnmarkGrayGCThingRecursively(aKey)) {
|
||||
mAnyMarked = true;
|
||||
|
@ -344,9 +344,9 @@ TraversalTracer::onChild(const JS::GCCellPtr& aThing)
|
|||
mCb.NoteNextEdgeName(buffer);
|
||||
}
|
||||
if (aThing.is<JSObject>()) {
|
||||
mCb.NoteJSObject(&aThing.to<JSObject>());
|
||||
mCb.NoteJSObject(&aThing.as<JSObject>());
|
||||
} else {
|
||||
mCb.NoteJSScript(&aThing.to<JSScript>());
|
||||
mCb.NoteJSScript(&aThing.as<JSScript>());
|
||||
}
|
||||
} else if (aThing.is<js::Shape>()) {
|
||||
// The maximum depth of traversal when tracing a Shape is unbounded, due to
|
||||
|
@ -484,7 +484,7 @@ CycleCollectedJSRuntime::DescribeGCThing(bool aIsMarked, JS::GCCellPtr aThing,
|
|||
char name[72];
|
||||
uint64_t compartmentAddress = 0;
|
||||
if (aThing.is<JSObject>()) {
|
||||
JSObject* obj = &aThing.to<JSObject>();
|
||||
JSObject* obj = &aThing.as<JSObject>();
|
||||
compartmentAddress = (uint64_t)js::GetObjectCompartment(obj);
|
||||
const js::Class* clasp = js::GetObjectClass(obj);
|
||||
|
||||
|
@ -583,7 +583,7 @@ CycleCollectedJSRuntime::TraverseGCThing(TraverseSelect aTs, JS::GCCellPtr aThin
|
|||
}
|
||||
|
||||
if (aThing.is<JSObject>()) {
|
||||
JSObject* obj = &aThing.to<JSObject>();
|
||||
JSObject* obj = &aThing.as<JSObject>();
|
||||
NoteGCThingXPCOMChildren(js::GetObjectClass(obj), obj, aCb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ nsScriptObjectTracer::NoteJSChild(JS::GCCellPtr aGCThing, const char* aName,
|
|||
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb, aName);
|
||||
if (aGCThing.is<JSObject>()) {
|
||||
cb->NoteJSObject(&aGCThing.to<JSObject>());
|
||||
cb->NoteJSObject(&aGCThing.as<JSObject>());
|
||||
} else if (aGCThing.is<JSScript>()) {
|
||||
cb->NoteJSScript(&aGCThing.to<JSScript>());
|
||||
cb->NoteJSScript(&aGCThing.as<JSScript>());
|
||||
} else {
|
||||
MOZ_ASSERT(!mozilla::AddToCCKind(aGCThing.kind()));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче