Bug 925817 - GenerationalGC: Refactor inside nursery check to avoid repetition r=terrence

This commit is contained in:
Jon Coppeard 2013-10-14 10:16:25 +01:00
Родитель ff8172dd1e
Коммит f4625d3a2f
5 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -289,7 +289,7 @@ ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
* All live objects in the nursery are moved to tenured at the beginning of
* each GC slice, so the gray marker never sees nursery things.
*/
if (uintptr_t(thing) >= rt->gcNurseryStart_ && uintptr_t(thing) < rt->gcNurseryEnd_)
if (js::gc::IsInsideNursery(rt, thing))
return;
#endif
if (IsIncrementalBarrierNeededOnGCThing(rt, thing, kind))

Просмотреть файл

@ -149,6 +149,16 @@ GetGCThingArena(void *thing)
return reinterpret_cast<JS::shadow::ArenaHeader *>(addr);
}
JS_ALWAYS_INLINE bool
IsInsideNursery(const JS::shadow::Runtime *runtime, const void *p)
{
#ifdef JSGC_GENERATIONAL
return uintptr_t(p) >= runtime->gcNurseryStart_ && uintptr_t(p) < runtime->gcNurseryEnd_;
#else
return false;
#endif
}
} /* namespace gc */
} /* namespace js */
@ -178,7 +188,7 @@ GCThingIsMarkedGray(void *thing)
* each GC slice, so the gray marker never sees nursery things.
*/
JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing);
if (uintptr_t(thing) >= rt->gcNurseryStart_ && uintptr_t(thing) < rt->gcNurseryEnd_)
if (js::gc::IsInsideNursery(rt, thing))
return false;
#endif
uintptr_t *word, mask;

Просмотреть файл

@ -1049,7 +1049,7 @@ Cell::isTenured() const
{
#ifdef JSGC_GENERATIONAL
JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(this);
return uintptr_t(this) < rt->gcNurseryStart_ || uintptr_t(this) >= rt->gcNurseryEnd_;
return !IsInsideNursery(rt, this);
#endif
return true;
}

Просмотреть файл

@ -66,7 +66,7 @@ class Nursery
template <typename T>
JS_ALWAYS_INLINE bool isInside(const T *p) const {
return uintptr_t(p) >= start() && uintptr_t(p) < heapEnd();
return gc::IsInsideNursery((JS::shadow::Runtime *)runtime_, p);
}
/*

Просмотреть файл

@ -91,15 +91,6 @@ ShouldNurseryAllocate(const Nursery &nursery, AllocKind kind, InitialHeap heap)
}
#endif
inline bool
IsInsideNursery(JSRuntime *rt, const void *thing)
{
#ifdef JSGC_GENERATIONAL
return rt->gcNursery.isInside(thing);
#endif
return false;
}
inline JSGCTraceKind
GetGCThingTraceKind(const void *thing)
{