mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1043888 - Make GetObjetZone() work on nursery objects and rename GetGCThingZone() to GetTenuredGCThingZone() r=terrence
This commit is contained in:
parent
a2b88b10a1
commit
c71e29bdb6
@ -749,7 +749,7 @@ MaybeWrapStringValue(JSContext* cx, JS::MutableHandle<JS::Value> rval)
|
||||
{
|
||||
MOZ_ASSERT(rval.isString());
|
||||
JSString* str = rval.toString();
|
||||
if (JS::GetGCThingZone(str) != js::GetContextZone(cx)) {
|
||||
if (JS::GetTenuredGCThingZone(str) != js::GetContextZone(cx)) {
|
||||
return JS_WrapValue(cx, rval);
|
||||
}
|
||||
return true;
|
||||
|
@ -458,7 +458,7 @@ ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
|
||||
if (js::gc::IsInsideNursery((js::gc::Cell *)thing))
|
||||
return;
|
||||
#endif
|
||||
if (IsIncrementalBarrierNeededOnGCThing(rt, thing, kind))
|
||||
if (IsIncrementalBarrierNeededOnTenuredGCThing(rt, thing, kind))
|
||||
IncrementalReferenceBarrier(thing, kind);
|
||||
else if (GCThingIsMarkedGray(thing))
|
||||
UnmarkGrayGCThingRecursively(thing, kind);
|
||||
@ -484,7 +484,7 @@ MarkGCThingAsLive(JSRuntime *rt_, void *thing, JSGCTraceKind kind)
|
||||
if (js::gc::IsInsideNursery((js::gc::Cell *)thing))
|
||||
return;
|
||||
#endif
|
||||
if (IsIncrementalBarrierNeededOnGCThing(rt, thing, kind))
|
||||
if (IsIncrementalBarrierNeededOnTenuredGCThing(rt, thing, kind))
|
||||
IncrementalReferenceBarrier(thing, kind);
|
||||
}
|
||||
|
||||
|
@ -274,17 +274,17 @@ IsInsideNursery(const js::gc::Cell *cell)
|
||||
namespace JS {
|
||||
|
||||
static MOZ_ALWAYS_INLINE Zone *
|
||||
GetGCThingZone(void *thing)
|
||||
GetTenuredGCThingZone(void *thing)
|
||||
{
|
||||
MOZ_ASSERT(thing);
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
JS_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell *)thing));
|
||||
#endif
|
||||
return js::gc::GetGCThingArena(thing)->zone;
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE Zone *
|
||||
GetObjectZone(JSObject *obj)
|
||||
{
|
||||
return GetGCThingZone(obj);
|
||||
}
|
||||
extern JS_PUBLIC_API(Zone *)
|
||||
GetObjectZone(JSObject *obj);
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool
|
||||
GCThingIsMarkedGray(void *thing)
|
||||
@ -304,11 +304,11 @@ GCThingIsMarkedGray(void *thing)
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE bool
|
||||
IsIncrementalBarrierNeededOnGCThing(shadow::Runtime *rt, void *thing, JSGCTraceKind kind)
|
||||
IsIncrementalBarrierNeededOnTenuredGCThing(shadow::Runtime *rt, void *thing, JSGCTraceKind kind)
|
||||
{
|
||||
if (!rt->needsBarrier_)
|
||||
return false;
|
||||
JS::Zone *zone = GetGCThingZone(thing);
|
||||
JS::Zone *zone = GetTenuredGCThingZone(thing);
|
||||
return reinterpret_cast<shadow::Zone *>(zone)->needsBarrier_;
|
||||
}
|
||||
|
||||
|
@ -6558,3 +6558,9 @@ JS::CaptureCurrentStack(JSContext *cx, JS::MutableHandleObject stackp, unsigned
|
||||
stackp.set(frame.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(Zone *)
|
||||
JS::GetObjectZone(JSObject *obj)
|
||||
{
|
||||
return obj->zone();
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public:
|
||||
JS::Zone *zone = js::GetContextZone(cx);
|
||||
ZoneStringCache *cache = static_cast<ZoneStringCache*>(JS_GetZoneUserData(zone));
|
||||
if (cache && buf == cache->mBuffer) {
|
||||
MOZ_ASSERT(JS::GetGCThingZone(cache->mString) == zone);
|
||||
MOZ_ASSERT(JS::GetTenuredGCThingZone(cache->mString) == zone);
|
||||
JS::MarkStringAsLive(zone, cache->mString);
|
||||
rval.setString(cache->mString);
|
||||
*sharedBuffer = false;
|
||||
|
@ -2113,7 +2113,7 @@ private:
|
||||
if (!mMergeZones) {
|
||||
return nullptr;
|
||||
}
|
||||
JS::Zone* zone = JS::GetGCThingZone(aGcthing);
|
||||
JS::Zone* zone = JS::GetTenuredGCThingZone(aGcthing);
|
||||
if (js::IsSystemZone(zone)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user