Bug 968616 - Hide the explicitly unsafe things we do for testing from the hazard analysis; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Fri, 07 Feb 2014 10:03:13 -0800
changeset 167569 59230a163ec0852cb6c594fa4ca52d52387b9a44
parent 167568 9fb9effa74a6ddf68d15c02dca1ca7c21476a150
child 167570 95fc024ee46d9aa52072df720fd8c08223a11984
push id26174
push userkwierso@gmail.com
push dateSat, 08 Feb 2014 00:55:48 +0000
treeherdermozilla-central@2c873eff7dc2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs968616
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 968616 - Hide the explicitly unsafe things we do for testing from the hazard analysis; r=sfink
js/src/jsapi-tests/testGCStoreBufferRemoval.cpp
--- a/js/src/jsapi-tests/testGCStoreBufferRemoval.cpp
+++ b/js/src/jsapi-tests/testGCStoreBufferRemoval.cpp
@@ -18,20 +18,23 @@ BEGIN_TEST(testGCStoreBufferRemoval)
     // Sanity check - objects start in the nursery and then become tenured.
     JS_GC(cx->runtime());
     JS::RootedObject obj(cx, NurseryObject());
     CHECK(js::gc::IsInsideNursery(rt, obj.get()));
     JS_GC(cx->runtime());
     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;
         *relocPtr = NurseryObject();
         relocPtr->~RelocatablePtrObject();
         punnedPtr = badObject;
         JS_GC(cx->runtime());
 
@@ -72,18 +75,18 @@ BEGIN_TEST(testGCStoreBufferRemoval)
         *relocValue = NullValue();
         relocValue->~RelocatableValue();
         punnedValue = ObjectValueCrashOnTouch();
         JS_GC(cx->runtime());
     }
 
     // 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*>;
         *heapPtr = NurseryObject();
         heapPtr->~Heap<JSObject*>();
         punnedPtr = badObject;
         JS_GC(cx->runtime());