Bug 1149352 - Part 0: Only mark live entries when marking a range; r=meow

This commit is contained in:
Terrence Cole 2015-04-01 14:50:43 -07:00
Родитель 99a4fd3d60
Коммит 4d97c7441f
2 изменённых файлов: 12 добавлений и 8 удалений

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

@ -431,19 +431,23 @@ js::TraceRoot(JSTracer* trc, T* thingp, const char* name)
template <typename T>
void
js::TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* thingp, const char* name)
js::TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* vec, const char* name)
{
for (auto i : MakeRange(len))
DispatchToTracer(trc, ConvertToBase(thingp[i].unsafeGet()), name, i);
for (auto i : MakeRange(len)) {
if (InternalGCMethods<T>::isMarkable(vec[i].get()))
DispatchToTracer(trc, ConvertToBase(vec[i].unsafeGet()), name, i);
}
}
template <typename T>
void
js::TraceRootRange(JSTracer* trc, size_t len, T* thingp, const char* name)
js::TraceRootRange(JSTracer* trc, size_t len, T* vec, const char* name)
{
JS_ROOT_MARKING_ASSERT(trc);
for (auto i : MakeRange(len))
DispatchToTracer(trc, ConvertToBase(&thingp[i]), name, i);
for (auto i : MakeRange(len)) {
if (InternalGCMethods<T>::isMarkable(vec[i]))
DispatchToTracer(trc, ConvertToBase(&vec[i]), name, i);
}
}
// Instantiate a copy of the Tracing templates for each derived type.

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

@ -62,12 +62,12 @@ TraceManuallyBarrieredEdge(JSTracer* trc, T* thingp, const char* name);
// Trace all edges contained in the given array.
template <typename T>
void
TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* thingp, const char* name);
TraceRange(JSTracer* trc, size_t len, BarrieredBase<T>* vec, const char* name);
// Trace all root edges in the given array.
template <typename T>
void
TraceRootRange(JSTracer* trc, size_t len, T* thingp, const char* name);
TraceRootRange(JSTracer* trc, size_t len, T* vec, const char* name);
// Trace an edge that crosses compartment boundaries. If the compartment of the
// destination thing is not being GC'd, then the edge will not be traced.