Namespacing fixes for bug 1028358, r=CLOSED TREE
authorSteve Fink <sfink@mozilla.com>
Mon, 23 Jun 2014 13:57:16 -0700
changeset 190344 c0abbe27207698f5011ff7a046d736ee55ed1c25
parent 190343 e5853a427dd2584269fb86cb52d23db89721d8ce
child 190345 380329e6600f15e5f06ccd13c7eda902796ffb11
push id27004
push useremorley@mozilla.com
push dateTue, 24 Jun 2014 15:52:34 +0000
treeherdermozilla-central@7b174d47f3cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCLOSED
bugs1028358
milestone33.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
Namespacing fixes for bug 1028358, r=CLOSED TREE
js/src/jsapi-tests/testGCHeapPostBarriers.cpp
js/src/jsapi-tests/testWeakMap.cpp
--- a/js/src/jsapi-tests/testGCHeapPostBarriers.cpp
+++ b/js/src/jsapi-tests/testGCHeapPostBarriers.cpp
@@ -41,29 +41,29 @@ TestHeapPostBarriers(T initalObj)
     heapData->set(initalObj);
 
     /* Perform minor GC and check heap wrapper is udated with new pointer. */
     js::MinorGC(cx, JS::gcreason::API);
     CHECK(heapData->get() != initalObj);
     CHECK(!js::gc::IsInsideNursery(heapData->get()));
 
     /* Check object is definitely still alive. */
-    Rooted<T> obj(cx, heapData->get());
-    RootedValue value(cx);
+    JS::Rooted<T> obj(cx, heapData->get());
+    JS::RootedValue value(cx);
     CHECK(JS_GetProperty(cx, obj, "x", &value));
     CHECK(value.isInt32());
     CHECK(value.toInt32() == 42);
 
     delete heapData;
     return true;
 }
 
 JSObject *NurseryObject()
 {
-    RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
+    JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
     if (!obj)
         return nullptr;
     JS_DefineProperty(cx, obj, "x", 42, 0);
     return obj;
 }
 
 JSFunction *NurseryFunction()
 {
--- a/js/src/jsapi-tests/testWeakMap.cpp
+++ b/js/src/jsapi-tests/testWeakMap.cpp
@@ -8,30 +8,30 @@
 #include "gc/Zone.h"
 
 #include "jsapi-tests/tests.h"
 
 #ifdef JSGC_USE_EXACT_ROOTING
 
 BEGIN_TEST(testWeakMap_basicOperations)
 {
-    RootedObject map(cx, JS::NewWeakMapObject(cx));
+    JS::RootedObject map(cx, JS::NewWeakMapObject(cx));
     CHECK(IsWeakMapObject(map));
 
-    RootedObject key(cx, newKey());
+    JS::RootedObject key(cx, newKey());
     CHECK(key);
     CHECK(!IsWeakMapObject(key));
 
-    RootedValue r(cx);
+    JS::RootedValue r(cx);
     CHECK(GetWeakMapEntry(cx, map, key, &r));
     CHECK(r.isUndefined());
 
     CHECK(checkSize(map, 0));
 
-    RootedValue val(cx, Int32Value(1));
+    JS::RootedValue val(cx, JS::Int32Value(1));
     CHECK(SetWeakMapEntry(cx, map, key, val));
 
     CHECK(GetWeakMapEntry(cx, map, key, &r));
     CHECK(r == val);
     CHECK(checkSize(map, 1));
 
     JS_GC(rt);
 
@@ -48,57 +48,57 @@ BEGIN_TEST(testWeakMap_basicOperations)
 }
 
 JSObject *newKey()
 {
     return JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr());
 }
 
 bool
-checkSize(HandleObject map, uint32_t expected)
+checkSize(JS::HandleObject map, uint32_t expected)
 {
-    RootedObject keys(cx);
+    JS::RootedObject keys(cx);
     CHECK(JS_NondeterministicGetWeakMapKeys(cx, map, &keys));
 
     uint32_t length;
     CHECK(JS_GetArrayLength(cx, keys, &length));
     CHECK(length == expected);
 
     return true;
 }
 END_TEST(testWeakMap_basicOperations)
 
 BEGIN_TEST(testWeakMap_keyDelegates)
 {
     JS_SetGCParameter(rt, JSGC_MODE, JSGC_MODE_INCREMENTAL);
     JS_GC(rt);
 
-    RootedObject map(cx, JS::NewWeakMapObject(cx));
+    JS::RootedObject map(cx, JS::NewWeakMapObject(cx));
     CHECK(map);
 
-    RootedObject key(cx, newKey());
+    JS::RootedObject key(cx, newKey());
     CHECK(key);
 
-    RootedObject delegate(cx, newDelegate());
+    JS::RootedObject delegate(cx, newDelegate());
     CHECK(delegate);
 
     SetKeyDelegate(key, delegate);
 
     /*
      * Perform an incremental GC, introducing an unmarked CCW to force the map
      * zone to finish marking before the delegate zone.
      */
     CHECK(newCCW(map, delegate));
     GCDebugSlice(rt, true, 1000000);
 #ifdef DEBUG
     CHECK(map->zone()->lastZoneGroupIndex() < delegate->zone()->lastZoneGroupIndex());
 #endif
 
     /* Add our entry to the weakmap. */
-    RootedValue val(cx, Int32Value(1));
+    JS::RootedValue val(cx, JS::Int32Value(1));
     CHECK(SetWeakMapEntry(cx, map, key, val));
     CHECK(checkSize(map, 1));
 
     /* Check the delegate keeps the entry alive even if the key is not reachable. */
     key = nullptr;
     CHECK(newCCW(map, delegate));
     GCDebugSlice(rt, true, 100000);
     CHECK(checkSize(map, 1));
@@ -152,37 +152,37 @@ JSObject *newKey()
             nullptr,
             nullptr,
             false,
             GetKeyDelegate
         },
         JS_NULL_OBJECT_OPS
     };
 
-    RootedObject key(cx);
+    JS::RootedObject key(cx);
     key = JS_NewObject(cx,
                        reinterpret_cast<const JSClass *>(&keyClass),
                        JS::NullPtr(),
                        JS::NullPtr());
     if (!key)
         return nullptr;
 
     SetKeyDelegate(key, nullptr);
 
     return key;
 }
 
-JSObject *newCCW(HandleObject sourceZone, HandleObject destZone)
+JSObject *newCCW(JS::HandleObject sourceZone, JS::HandleObject destZone)
 {
     /*
      * Now ensure that this zone will be swept first by adding a cross
      * compartment wrapper to a new objct in the same zone as the
      * delegate obejct.
      */
-    RootedObject object(cx);
+    JS::RootedObject object(cx);
     {
         JSAutoCompartment ac(cx, destZone);
         object = JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr());
         if (!object)
             return nullptr;
     }
     {
         JSAutoCompartment ac(cx, sourceZone);
@@ -211,31 +211,31 @@ JSObject *newDelegate()
         JS_GlobalObjectTraceHook
     };
 
     /* Create the global object. */
     JS::CompartmentOptions options;
     options.setVersion(JSVERSION_LATEST);
     JS::RootedObject global(cx);
     global = JS_NewGlobalObject(cx, &delegateClass, nullptr, JS::FireOnNewGlobalHook, options);
-    JS_SetReservedSlot(global, 0, Int32Value(42));
+    JS_SetReservedSlot(global, 0, JS::Int32Value(42));
 
     /*
      * Ensure the delegate is not in the nursery because for the purpose of this
      * test we're going to put it in a private slot where it won't get updated.
      */
     JS_GC(rt);
 
     return global;
 }
 
 bool
-checkSize(HandleObject map, uint32_t expected)
+checkSize(JS::HandleObject map, uint32_t expected)
 {
-    RootedObject keys(cx);
+    JS::RootedObject keys(cx);
     CHECK(JS_NondeterministicGetWeakMapKeys(cx, map, &keys));
 
     uint32_t length;
     CHECK(JS_GetArrayLength(cx, keys, &length));
     CHECK(length == expected);
 
     return true;
 }