Bug 968616 - Hide the explicitly unsafe things we do for testing from the hazard analysis; r=sfink

This commit is contained in:
Terrence Cole 2014-02-07 10:03:13 -08:00
Родитель 79cd1362c3
Коммит e02e6aeb19
1 изменённых файлов: 7 добавлений и 4 удалений

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

@ -23,10 +23,13 @@ BEGIN_TEST(testGCStoreBufferRemoval)
CHECK(!js::gc::IsInsideNursery(rt, obj.get()));
JS::RootedObject tenuredObject(cx, obj);
// Hide the horrors herein from the static rooting analysis.
typedef JSObject *ObjectPtr;
// Test removal of store buffer entries added by RelocatablePtr<T>.
{
JSObject *badObject = reinterpret_cast<JSObject*>(1);
JSObject *punnedPtr = nullptr;
ObjectPtr badObject = reinterpret_cast<JSObject*>(1);
ObjectPtr punnedPtr = nullptr;
RelocatablePtrObject* relocPtr =
reinterpret_cast<RelocatablePtrObject*>(&punnedPtr);
new (relocPtr) RelocatablePtrObject;
@ -77,8 +80,8 @@ BEGIN_TEST(testGCStoreBufferRemoval)
// Test removal of store buffer entries added by Heap<T>.
{
JSObject *badObject = reinterpret_cast<JSObject*>(1);
JSObject *punnedPtr = nullptr;
ObjectPtr badObject = reinterpret_cast<JSObject*>(1);
ObjectPtr punnedPtr = nullptr;
Heap<JSObject*>* heapPtr =
reinterpret_cast<Heap<JSObject*>*>(&punnedPtr);
new (heapPtr) Heap<JSObject*>;