Bug 1043888 - Make GetObjetZone() work on nursery objects and rename GetGCThingZone() to GetTenuredGCThingZone() r=terrence

This commit is contained in:
Jon Coppeard 2014-07-28 10:39:36 +01:00
parent a2b88b10a1
commit c71e29bdb6
6 changed files with 19 additions and 13 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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_;
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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;
}