зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160567 - Assert that object derived types are not exposed in the API; r=jonco
--HG-- extra : rebase_source : c58c189aba2cc50761b9bea36c561da28937f211
This commit is contained in:
Родитель
2d69d081ad
Коммит
b8d6f35f9e
|
@ -214,9 +214,13 @@ JS_FRIEND_API(void) HeapCellRelocate(js::gc::Cell** cellp);
|
|||
*/
|
||||
extern JS_FRIEND_API(void)
|
||||
AssertGCThingMustBeTenured(JSObject* obj);
|
||||
extern JS_FRIEND_API(void)
|
||||
AssertGCThingIsNotAnObjectSubclass(js::gc::Cell* cell);
|
||||
#else
|
||||
inline void
|
||||
AssertGCThingMustBeTenured(JSObject* obj) {}
|
||||
inline void
|
||||
AssertGCThingIsNotAnObjectSubclass(js::gc::Cell* cell) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -639,7 +643,10 @@ struct GCMethods<T*>
|
|||
{
|
||||
static T* initial() { return nullptr; }
|
||||
static bool needsPostBarrier(T* v) { return false; }
|
||||
static void postBarrier(T** vp) {}
|
||||
static void postBarrier(T** vp) {
|
||||
if (vp)
|
||||
JS::AssertGCThingIsNotAnObjectSubclass(reinterpret_cast<js::gc::Cell*>(vp));
|
||||
}
|
||||
static void relocate(T** vp) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -6816,6 +6816,13 @@ JS::AssertGCThingMustBeTenured(JSObject* obj)
|
|||
(!IsNurseryAllocable(obj->asTenured().getAllocKind()) || obj->getClass()->finalize));
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
JS::AssertGCThingIsNotAnObjectSubclass(Cell* cell)
|
||||
{
|
||||
MOZ_ASSERT(cell);
|
||||
MOZ_ASSERT(cell->getTraceKind() != JSTRACE_OBJECT);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js::gc::AssertGCThingHasType(js::gc::Cell* cell, JSGCTraceKind kind)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче