Bug 1024170 - Replace zone calls in JSCompartment::wrap with zoneFromAnyThread. r=bhackett, a=sledru
authorShihua Zheng <szheng@mozilla.com>
Wed, 11 Jun 2014 16:39:04 -0700
changeset 207692 fad78d49fe076822234a0f6391ec5a424a413a4f
parent 207691 8825a5c848a25fe75408ec68bf620a589d425ba4
child 207693 6a25989f0c6c086e495de880f9e19cc883fd7310
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett, sledru
bugs1024170
milestone32.0a2
Bug 1024170 - Replace zone calls in JSCompartment::wrap with zoneFromAnyThread. r=bhackett, a=sledru
js/src/jscompartment.cpp
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -266,22 +266,23 @@ JSCompartment::putWrapper(JSContext *cx,
 bool
 JSCompartment::wrap(JSContext *cx, JSString **strp)
 {
     JS_ASSERT(!cx->runtime()->isAtomsCompartment(this));
     JS_ASSERT(cx->compartment() == this);
 
     /* If the string is already in this compartment, we are done. */
     JSString *str = *strp;
-    if (str->zone() == zone())
+    if (str->zoneFromAnyThread() == zone())
         return true;
 
     /* If the string is an atom, we don't have to copy. */
     if (str->isAtom()) {
-        JS_ASSERT(cx->runtime()->isAtomsZone(str->zone()));
+        JS_ASSERT(str->isPermanentAtom() ||
+                  cx->runtime()->isAtomsZone(str->zone()));
         return true;
     }
 
     /* Check the cache. */
     RootedValue key(cx, StringValue(str));
     if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(CrossCompartmentKey(key))) {
         *strp = p->value().get().toString();
         return true;