Bug 1160665 - Use the same implementation for both internal and external barriers; r=jonco

This commit is contained in:
Terrence Cole 2015-05-01 10:23:57 -07:00
Родитель b8d6f35f9e
Коммит 97eb3355da
3 изменённых файлов: 36 добавлений и 50 удалений

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

@ -204,8 +204,8 @@ struct JS_PUBLIC_API(NullPtr)
static void * const constNullValue;
};
JS_FRIEND_API(void) HeapCellPostBarrier(js::gc::Cell** cellp);
JS_FRIEND_API(void) HeapCellRelocate(js::gc::Cell** cellp);
JS_FRIEND_API(void) HeapObjectPostBarrier(JSObject** objp);
JS_FRIEND_API(void) HeapObjectRelocate(JSObject** objp);
#ifdef JS_DEBUG
/*
@ -664,10 +664,10 @@ struct GCMethods<JSObject*>
return v != nullptr && gc::IsInsideNursery(reinterpret_cast<gc::Cell*>(v));
}
static void postBarrier(JSObject** vp) {
JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell**>(vp));
JS::HeapObjectPostBarrier(vp);
}
static void relocate(JSObject** vp) {
JS::HeapCellRelocate(reinterpret_cast<js::gc::Cell**>(vp));
JS::HeapObjectRelocate(vp);
}
};
@ -679,10 +679,10 @@ struct GCMethods<JSFunction*>
return v != nullptr && gc::IsInsideNursery(reinterpret_cast<gc::Cell*>(v));
}
static void postBarrier(JSFunction** vp) {
JS::HeapCellPostBarrier(reinterpret_cast<js::gc::Cell**>(vp));
JS::HeapObjectPostBarrier(reinterpret_cast<JSObject**>(vp));
}
static void relocate(JSFunction** vp) {
JS::HeapCellRelocate(reinterpret_cast<js::gc::Cell**>(vp));
JS::HeapObjectRelocate(reinterpret_cast<JSObject**>(vp));
}
};

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

@ -75,3 +75,33 @@ template void js::PreBarrierFunctor<JS::Value>::operator()<JSObject>(JSObject*);
template void js::PreBarrierFunctor<JS::Value>::operator()<JSString>(JSString*);
template void js::PreBarrierFunctor<jsid>::operator()<JS::Symbol>(JS::Symbol*);
template void js::PreBarrierFunctor<jsid>::operator()<JSString>(JSString*);
JS_PUBLIC_API(void)
JS::HeapObjectPostBarrier(JSObject** objp)
{
MOZ_ASSERT(objp);
MOZ_ASSERT(*objp);
js::InternalGCMethods<JSObject*>::postBarrierRelocate(objp);
}
JS_PUBLIC_API(void)
JS::HeapObjectRelocate(JSObject** objp)
{
MOZ_ASSERT(objp);
MOZ_ASSERT(*objp);
js::InternalGCMethods<JSObject*>::postBarrierRemove(objp);
}
JS_PUBLIC_API(void)
JS::HeapValuePostBarrier(JS::Value* valuep)
{
MOZ_ASSERT(valuep);
js::InternalGCMethods<JS::Value>::postBarrierRelocate(valuep);
}
JS_PUBLIC_API(void)
JS::HeapValueRelocate(JS::Value* valuep)
{
MOZ_ASSERT(valuep);
js::InternalGCMethods<JS::Value>::postBarrierRemove(valuep);
}

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

@ -202,50 +202,6 @@ StoreBuffer::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::GCSi
sizes->storeBufferGenerics += bufferGeneric.sizeOfExcludingThis(mallocSizeOf);
}
JS_PUBLIC_API(void)
JS::HeapCellPostBarrier(js::gc::Cell** cellp)
{
MOZ_ASSERT(cellp);
MOZ_ASSERT(*cellp);
StoreBuffer* storeBuffer = (*cellp)->storeBuffer();
if (storeBuffer)
storeBuffer->putRelocatableCellFromAnyThread(cellp);
}
JS_PUBLIC_API(void)
JS::HeapCellRelocate(js::gc::Cell** cellp)
{
/* Called with old contents of *cellp before overwriting. */
MOZ_ASSERT(cellp);
MOZ_ASSERT(*cellp);
JSRuntime* runtime = (*cellp)->runtimeFromMainThread();
runtime->gc.storeBuffer.removeRelocatableCellFromAnyThread(cellp);
}
JS_PUBLIC_API(void)
JS::HeapValuePostBarrier(JS::Value* valuep)
{
MOZ_ASSERT(valuep);
MOZ_ASSERT(valuep->isMarkable());
if (valuep->isObject()) {
StoreBuffer* storeBuffer = valuep->toObject().storeBuffer();
if (storeBuffer)
storeBuffer->putRelocatableValueFromAnyThread(valuep);
}
}
JS_PUBLIC_API(void)
JS::HeapValueRelocate(JS::Value* valuep)
{
/* Called with old contents of *valuep before overwriting. */
MOZ_ASSERT(valuep);
MOZ_ASSERT(valuep->isMarkable());
if (valuep->isString() && valuep->toString()->isPermanentAtom())
return;
JSRuntime* runtime = static_cast<js::gc::Cell*>(valuep->toGCThing())->runtimeFromMainThread();
runtime->gc.storeBuffer.removeRelocatableValueFromAnyThread(valuep);
}
template struct StoreBuffer::MonoTypeBuffer<StoreBuffer::ValueEdge>;
template struct StoreBuffer::MonoTypeBuffer<StoreBuffer::CellPtrEdge>;
template struct StoreBuffer::MonoTypeBuffer<StoreBuffer::SlotsEdge>;