mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-15 06:20:41 +00:00
Bug 925817 - GenerationalGC: Refactor inside nursery check to avoid repetition r=terrence
This commit is contained in:
parent
ff8172dd1e
commit
f4625d3a2f
@ -289,7 +289,7 @@ ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
|
|||||||
* All live objects in the nursery are moved to tenured at the beginning of
|
* 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.
|
* 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;
|
return;
|
||||||
#endif
|
#endif
|
||||||
if (IsIncrementalBarrierNeededOnGCThing(rt, thing, kind))
|
if (IsIncrementalBarrierNeededOnGCThing(rt, thing, kind))
|
||||||
|
@ -149,6 +149,16 @@ GetGCThingArena(void *thing)
|
|||||||
return reinterpret_cast<JS::shadow::ArenaHeader *>(addr);
|
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 gc */
|
||||||
|
|
||||||
} /* namespace js */
|
} /* namespace js */
|
||||||
@ -178,7 +188,7 @@ GCThingIsMarkedGray(void *thing)
|
|||||||
* each GC slice, so the gray marker never sees nursery things.
|
* each GC slice, so the gray marker never sees nursery things.
|
||||||
*/
|
*/
|
||||||
JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing);
|
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;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
uintptr_t *word, mask;
|
uintptr_t *word, mask;
|
||||||
|
@ -1049,7 +1049,7 @@ Cell::isTenured() const
|
|||||||
{
|
{
|
||||||
#ifdef JSGC_GENERATIONAL
|
#ifdef JSGC_GENERATIONAL
|
||||||
JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(this);
|
JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(this);
|
||||||
return uintptr_t(this) < rt->gcNurseryStart_ || uintptr_t(this) >= rt->gcNurseryEnd_;
|
return !IsInsideNursery(rt, this);
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class Nursery
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
JS_ALWAYS_INLINE bool isInside(const T *p) const {
|
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
|
#endif
|
||||||
|
|
||||||
inline bool
|
|
||||||
IsInsideNursery(JSRuntime *rt, const void *thing)
|
|
||||||
{
|
|
||||||
#ifdef JSGC_GENERATIONAL
|
|
||||||
return rt->gcNursery.isInside(thing);
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline JSGCTraceKind
|
inline JSGCTraceKind
|
||||||
GetGCThingTraceKind(const void *thing)
|
GetGCThingTraceKind(const void *thing)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user