Bug 751618 - Zone renaming part 6 (r=terrence)
authorBill McCloskey <wmccloskey@mozilla.com>
Sun, 27 Jan 2013 13:51:41 -0800
changeset 120031 888c542780222f7b90a7a64131082f8238b34858
parent 120030 f1e00bbb8f08dc8eb040940b0b6548e82984ac88
child 120032 1032a553ddfd6b5360b5ec25a28240ab1b26f85b
push id24235
push userphilringnalda@gmail.com
push dateMon, 28 Jan 2013 04:08:29 +0000
treeherderautoland@80fed51ae074 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs751618
milestone21.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 751618 - Zone renaming part 6 (r=terrence)
js/src/ion/Ion.cpp
js/src/jsinferinlines.h
js/src/jsobjinlines.h
js/src/jsscriptinlines.h
js/src/jsxml.cpp
js/src/methodjit/MethodJIT.h
js/src/vm/ObjectImpl-inl.h
js/src/vm/Shape-inl.h
js/src/vm/String-inl.h
js/src/vm/String.cpp
js/src/vm/String.h
--- a/js/src/ion/Ion.cpp
+++ b/js/src/ion/Ion.cpp
@@ -415,32 +415,32 @@ IonCode::togglePreBarriers(bool enabled)
 
 void
 IonCode::readBarrier(IonCode *code)
 {
 #ifdef JSGC_INCREMENTAL
     if (!code)
         return;
 
-    JSCompartment *comp = code->compartment();
-    if (comp->needsBarrier())
-        MarkIonCodeUnbarriered(comp->barrierTracer(), &code, "ioncode read barrier");
+    Zone *zone = code->zone();
+    if (zone->needsBarrier())
+        MarkIonCodeUnbarriered(zone->barrierTracer(), &code, "ioncode read barrier");
 #endif
 }
 
 void
 IonCode::writeBarrierPre(IonCode *code)
 {
 #ifdef JSGC_INCREMENTAL
     if (!code)
         return;
 
-    JSCompartment *comp = code->compartment();
-    if (comp->needsBarrier())
-        MarkIonCodeUnbarriered(comp->barrierTracer(), &code, "ioncode write barrier");
+    Zone *zone = code->zone();
+    if (zone->needsBarrier())
+        MarkIonCodeUnbarriered(zone->barrierTracer(), &code, "ioncode write barrier");
 #endif
 }
 
 void
 IonCode::writeBarrierPost(IonCode *code, void *addr)
 {
 #ifdef JSGC_INCREMENTAL
     // Nothing to do.
--- a/js/src/jsinferinlines.h
+++ b/js/src/jsinferinlines.h
@@ -1659,54 +1659,54 @@ TypeObject::getProperty(unsigned i)
 
 inline void
 TypeObject::writeBarrierPre(TypeObject *type)
 {
 #ifdef JSGC_INCREMENTAL
     if (!type)
         return;
 
-    JSCompartment *comp = type->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = type->zone();
+    if (zone->needsBarrier()) {
         TypeObject *tmp = type;
-        MarkTypeObjectUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkTypeObjectUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         JS_ASSERT(tmp == type);
     }
 #endif
 }
 
 inline void
 TypeObject::writeBarrierPost(TypeObject *type, void *addr)
 {
 }
 
 inline void
 TypeObject::readBarrier(TypeObject *type)
 {
 #ifdef JSGC_INCREMENTAL
-    JSCompartment *comp = type->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = type->zone();
+    if (zone->needsBarrier()) {
         TypeObject *tmp = type;
-        MarkTypeObjectUnbarriered(comp->barrierTracer(), &tmp, "read barrier");
+        MarkTypeObjectUnbarriered(zone->barrierTracer(), &tmp, "read barrier");
         JS_ASSERT(tmp == type);
     }
 #endif
 }
 
 inline void
 TypeNewScript::writeBarrierPre(TypeNewScript *newScript)
 {
 #ifdef JSGC_INCREMENTAL
     if (!newScript)
         return;
 
-    JSCompartment *comp = newScript->fun->compartment();
-    if (comp->needsBarrier()) {
-        MarkObject(comp->barrierTracer(), &newScript->fun, "write barrier");
-        MarkShape(comp->barrierTracer(), &newScript->shape, "write barrier");
+    JS::Zone *zone = newScript->fun->zone();
+    if (zone->needsBarrier()) {
+        MarkObject(zone->barrierTracer(), &newScript->fun, "write barrier");
+        MarkShape(zone->barrierTracer(), &newScript->shape, "write barrier");
     }
 #endif
 }
 
 inline void
 TypeNewScript::writeBarrierPost(TypeNewScript *newScript, void *addr)
 {
 }
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -489,28 +489,28 @@ JSObject::removeDenseElementForSparseInd
     if (obj->containsDenseElement(idx))
         obj->setDenseElement(idx, js::MagicValue(JS_ELEMENTS_HOLE));
 }
 
 inline void
 JSObject::copyDenseElements(unsigned dstStart, const js::Value *src, unsigned count)
 {
     JS_ASSERT(dstStart + count <= getDenseCapacity());
-    JSCompartment *comp = compartment();
+    JS::Zone *zone = this->zone();
     for (unsigned i = 0; i < count; ++i)
-        elements[dstStart + i].set(comp, this, js::HeapSlot::Element, dstStart + i, src[i]);
+        elements[dstStart + i].set(zone, this, js::HeapSlot::Element, dstStart + i, src[i]);
 }
 
 inline void
 JSObject::initDenseElements(unsigned dstStart, const js::Value *src, unsigned count)
 {
     JS_ASSERT(dstStart + count <= getDenseCapacity());
-    JSCompartment *comp = compartment();
+    JS::Zone *zone = this->zone();
     for (unsigned i = 0; i < count; ++i)
-        elements[dstStart + i].init(comp, this, js::HeapSlot::Element, dstStart + i, src[i]);
+        elements[dstStart + i].init(zone, this, js::HeapSlot::Element, dstStart + i, src[i]);
 }
 
 inline void
 JSObject::moveDenseElements(unsigned dstStart, unsigned srcStart, unsigned count)
 {
     JS_ASSERT(dstStart + count <= getDenseCapacity());
     JS_ASSERT(srcStart + count <= getDenseInitializedLength());
 
@@ -521,39 +521,39 @@ JSObject::moveDenseElements(unsigned dst
      * 1. Incremental GC marks slot 0 of array (i.e., A), then returns to JS code.
      * 2. JS code moves slots 1..2 into slots 0..1, so it contains [B, C, C].
      * 3. Incremental GC finishes by marking slots 1 and 2 (i.e., C).
      *
      * Since normal marking never happens on B, it is very important that the
      * write barrier is invoked here on B, despite the fact that it exists in
      * the array before and after the move.
     */
-    JSCompartment *comp = compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = this->zone();
+    if (zone->needsBarrier()) {
         if (dstStart < srcStart) {
             js::HeapSlot *dst = elements + dstStart;
             js::HeapSlot *src = elements + srcStart;
             for (unsigned i = 0; i < count; i++, dst++, src++)
-                dst->set(comp, this, js::HeapSlot::Element, dst - elements, *src);
+                dst->set(zone, this, js::HeapSlot::Element, dst - elements, *src);
         } else {
             js::HeapSlot *dst = elements + dstStart + count - 1;
             js::HeapSlot *src = elements + srcStart + count - 1;
             for (unsigned i = 0; i < count; i++, dst--, src--)
-                dst->set(comp, this, js::HeapSlot::Element, dst - elements, *src);
+                dst->set(zone, this, js::HeapSlot::Element, dst - elements, *src);
         }
     } else {
         memmove(elements + dstStart, elements + srcStart, count * sizeof(js::HeapSlot));
-        DenseRangeWriteBarrierPost(comp, this, dstStart, count);
+        DenseRangeWriteBarrierPost(zone, this, dstStart, count);
     }
 }
 
 inline void
 JSObject::moveDenseElementsUnbarriered(unsigned dstStart, unsigned srcStart, unsigned count)
 {
-    JS_ASSERT(!compartment()->needsBarrier());
+    JS_ASSERT(!zone()->needsBarrier());
 
     JS_ASSERT(dstStart + count <= getDenseCapacity());
     JS_ASSERT(srcStart + count <= getDenseCapacity());
 
     memmove(elements + dstStart, elements + srcStart, count * sizeof(js::Value));
 }
 
 inline void
@@ -572,22 +572,22 @@ JSObject::ensureDenseInitializedLength(J
      * for a write.
      */
     JS_ASSERT(index + extra <= getDenseCapacity());
     uint32_t &initlen = getElementsHeader()->initializedLength;
     if (initlen < index)
         markDenseElementsNotPacked(cx);
 
     if (initlen < index + extra) {
-        JSCompartment *comp = compartment();
+        JS::Zone *zone = this->zone();
         size_t offset = initlen;
         for (js::HeapSlot *sp = elements + initlen;
              sp != elements + (index + extra);
              sp++, offset++)
-            sp->init(comp, this, js::HeapSlot::Element, offset, js::MagicValue(JS_ELEMENTS_HOLE));
+            sp->init(zone, this, js::HeapSlot::Element, offset, js::MagicValue(JS_ELEMENTS_HOLE));
         initlen = index + extra;
     }
 }
 
 template<typename CONTEXT>
 JSObject::EnsureDenseResult
 JSObject::extendDenseElements(CONTEXT *cx, unsigned requiredCapacity, unsigned extra)
 {
@@ -643,22 +643,22 @@ JSObject::parExtendDenseElements(js::All
 
     // Watch out lest the header has been reallocated by
     // extendDenseElements():
     header = getElementsHeader();
 
     js::HeapSlot *sp = elements + initializedLength;
     if (v) {
         for (uint32_t i = 0; i < extra; i++)
-            sp[i].init(compartment(), this, js::HeapSlot::Element,
-                       initializedLength+i, v[i]);
+            sp[i].init(zone(), this, js::HeapSlot::Element, initializedLength+i, v[i]);
     } else {
-        for (uint32_t i = 0; i < extra; i++)
-            sp[i].init(compartment(), this, js::HeapSlot::Element,
-                       initializedLength+i, js::MagicValue(JS_ELEMENTS_HOLE));
+        for (uint32_t i = 0; i < extra; i++) {
+            sp[i].init(zone(), this, js::HeapSlot::Element,
+                       initializedLength + i, js::MagicValue(JS_ELEMENTS_HOLE));
+        }
     }
     header->initializedLength = requiredCapacity;
     if (header->length < requiredCapacity)
         header->length = requiredCapacity;
     return ED_OK;
 }
 
 inline JSObject::EnsureDenseResult
--- a/js/src/jsscriptinlines.h
+++ b/js/src/jsscriptinlines.h
@@ -152,21 +152,21 @@ JSScript::destroyMJITInfo(js::FreeOp *fo
 
 inline void
 JSScript::writeBarrierPre(js::UnrootedScript script)
 {
 #ifdef JSGC_INCREMENTAL
     if (!script)
         return;
 
-    JSCompartment *comp = script->compartment();
-    if (comp->needsBarrier()) {
-        JS_ASSERT(!comp->rt->isHeapBusy());
+    JS::Zone *zone = script->zone();
+    if (zone->needsBarrier()) {
+        JS_ASSERT(!zone->rt->isHeapBusy());
         js::UnrootedScript tmp = script;
-        MarkScriptUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkScriptUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         JS_ASSERT(tmp == script);
     }
 #endif
 }
 
 inline void
 JSScript::writeBarrierPost(js::UnrootedScript script, void *addr)
 {
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -7226,20 +7226,20 @@ js_NewXML(JSContext *cx, JSXMLClass xml_
 
 void
 JSXML::writeBarrierPre(JSXML *xml)
 {
 #ifdef JSGC_INCREMENTAL
     if (!xml)
         return;
 
-    JSCompartment *comp = xml->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = xml->zone();
+    if (zone->needsBarrier()) {
         JSXML *tmp = xml;
-        MarkXMLUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkXMLUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         JS_ASSERT(tmp == xml);
     }
 #endif
 }
 
 void
 JSXML::writeBarrierPost(JSXML *xml, void *addr)
 {
--- a/js/src/methodjit/MethodJIT.h
+++ b/js/src/methodjit/MethodJIT.h
@@ -1081,17 +1081,17 @@ VMFrame::pc()
     return regs.pc;
 }
 
 } /* namespace js */
 
 inline void *
 JSScript::nativeCodeForPC(bool constructing, jsbytecode *pc)
 {
-    js::mjit::JITScript *jit = getJIT(constructing, compartment()->compileBarriers());
+    js::mjit::JITScript *jit = getJIT(constructing, zone()->compileBarriers());
     if (!jit)
         return NULL;
     js::mjit::JITChunk *chunk = jit->chunk(pc);
     if (!chunk)
         return NULL;
     return bsearch_nmap(chunk->nmap(), chunk->nNmapPairs, (size_t)(pc - code));
 }
 
--- a/js/src/vm/ObjectImpl-inl.h
+++ b/js/src/vm/ObjectImpl-inl.h
@@ -156,22 +156,22 @@ js::ObjectImpl::initializeSlotRange(uint
 {
     /*
      * No bounds check, as this is used when the object's shape does not
      * reflect its allocated slots (updateSlotsForSpan).
      */
     HeapSlot *fixedStart, *fixedEnd, *slotsStart, *slotsEnd;
     getSlotRangeUnchecked(start, length, &fixedStart, &fixedEnd, &slotsStart, &slotsEnd);
 
-    JSCompartment *comp = compartment();
+    Zone *zone = this->zone();
     uint32_t offset = start;
     for (HeapSlot *sp = fixedStart; sp < fixedEnd; sp++)
-        sp->init(comp, this->asObjectPtr(), HeapSlot::Slot, offset++, UndefinedValue());
+        sp->init(zone, this->asObjectPtr(), HeapSlot::Slot, offset++, UndefinedValue());
     for (HeapSlot *sp = slotsStart; sp < slotsEnd; sp++)
-        sp->init(comp, this->asObjectPtr(), HeapSlot::Slot, offset++, UndefinedValue());
+        sp->init(zone, this->asObjectPtr(), HeapSlot::Slot, offset++, UndefinedValue());
 }
 
 inline bool
 js::ObjectImpl::isNative() const
 {
     return lastProperty()->isNative();
 }
 
@@ -193,16 +193,23 @@ js::ObjectImpl::nativeGetSlot(uint32_t s
 
 static JS_ALWAYS_INLINE JSCompartment *
 ValueCompartment(const js::Value &value)
 {
     JS_ASSERT(value.isMarkable());
     return static_cast<js::gc::Cell *>(value.toGCThing())->compartment();
 }
 
+static JS_ALWAYS_INLINE JS::Zone *
+ValueZone(const js::Value &value)
+{
+    JS_ASSERT(value.isMarkable());
+    return static_cast<js::gc::Cell *>(value.toGCThing())->zone();
+}
+
 #ifdef DEBUG
 inline bool
 IsValueInCompartment(js::Value v, JSCompartment *comp)
 {
     if (!v.isMarkable())
         return true;
     JSCompartment *vcomp = ValueCompartment(v);
     return vcomp == comp->rt->atomsCompartment || vcomp == comp;
@@ -218,17 +225,17 @@ js::ObjectImpl::setSlot(uint32_t slot, c
 }
 
 inline void
 js::ObjectImpl::setCrossCompartmentSlot(uint32_t slot, const js::Value &value)
 {
     MOZ_ASSERT(slotInRange(slot));
     if (value.isMarkable())
         getSlotRef(slot).setCrossCompartment(this->asObjectPtr(), HeapSlot::Slot, slot, value,
-                                             ValueCompartment(value));
+                                             ValueZone(value));
     else
         setSlot(slot, value);
 }
 
 inline void
 js::ObjectImpl::initSlot(uint32_t slot, const js::Value &value)
 {
     MOZ_ASSERT(getSlot(slot).isUndefined());
@@ -238,17 +245,17 @@ js::ObjectImpl::initSlot(uint32_t slot, 
 }
 
 inline void
 js::ObjectImpl::initCrossCompartmentSlot(uint32_t slot, const js::Value &value)
 {
     MOZ_ASSERT(getSlot(slot).isUndefined());
     MOZ_ASSERT(slotInRange(slot));
     if (value.isMarkable())
-        getSlotRef(slot).init(ValueCompartment(value), this->asObjectPtr(), HeapSlot::Slot, slot, value);
+        getSlotRef(slot).init(ValueZone(value), this->asObjectPtr(), HeapSlot::Slot, slot, value);
     else
         initSlot(slot, value);
 }
 
 inline void
 js::ObjectImpl::initSlotUnchecked(uint32_t slot, const js::Value &value)
 {
     getSlotAddressUnchecked(slot)->init(this->asObjectPtr(), HeapSlot::Slot, slot, value);
@@ -331,74 +338,74 @@ js::ObjectImpl::sizeOfThis() const
 {
     return arenaHeader()->getThingSize();
 }
 
 /* static */ inline void
 js::ObjectImpl::readBarrier(ObjectImpl *obj)
 {
 #ifdef JSGC_INCREMENTAL
-    JSCompartment *comp = obj->compartment();
-    if (comp->needsBarrier()) {
-        MOZ_ASSERT(!comp->rt->isHeapBusy());
+    Zone *zone = obj->zone();
+    if (zone->needsBarrier()) {
+        MOZ_ASSERT(!zone->rt->isHeapBusy());
         JSObject *tmp = obj->asObjectPtr();
-        MarkObjectUnbarriered(comp->barrierTracer(), &tmp, "read barrier");
+        MarkObjectUnbarriered(zone->barrierTracer(), &tmp, "read barrier");
         MOZ_ASSERT(tmp == obj->asObjectPtr());
     }
 #endif
 }
 
 inline void
 js::ObjectImpl::privateWriteBarrierPre(void **old)
 {
 #ifdef JSGC_INCREMENTAL
-    JSCompartment *comp = compartment();
-    if (comp->needsBarrier()) {
+    Zone *zone = this->zone();
+    if (zone->needsBarrier()) {
         if (*old && getClass()->trace)
-            getClass()->trace(comp->barrierTracer(), this->asObjectPtr());
+            getClass()->trace(zone->barrierTracer(), this->asObjectPtr());
     }
 #endif
 }
 
 inline void
 js::ObjectImpl::privateWriteBarrierPost(void **pprivate)
 {
 #ifdef JSGC_GENERATIONAL
-    compartment()->gcStoreBuffer.putCell(reinterpret_cast<js::gc::Cell **>(pprivate));
+    zone()->gcStoreBuffer.putCell(reinterpret_cast<js::gc::Cell **>(pprivate));
 #endif
 }
 
 /* static */ inline void
 js::ObjectImpl::writeBarrierPre(ObjectImpl *obj)
 {
 #ifdef JSGC_INCREMENTAL
     /*
      * This would normally be a null test, but TypeScript::global uses 0x1 as a
      * special value.
      */
     if (uintptr_t(obj) < 32)
         return;
 
-    JSCompartment *comp = obj->compartment();
-    if (comp->needsBarrier()) {
-        MOZ_ASSERT(!comp->rt->isHeapBusy());
+    Zone *zone = obj->zone();
+    if (zone->needsBarrier()) {
+        MOZ_ASSERT(!zone->rt->isHeapBusy());
         JSObject *tmp = obj->asObjectPtr();
-        MarkObjectUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkObjectUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         MOZ_ASSERT(tmp == obj->asObjectPtr());
     }
 #endif
 }
 
 /* static */ inline void
 js::ObjectImpl::writeBarrierPost(ObjectImpl *obj, void *addr)
 {
 #ifdef JSGC_GENERATIONAL
     if (uintptr_t(obj) < 32)
         return;
-    obj->compartment()->gcStoreBuffer.putCell((Cell **)addr);
+    obj->zone()->gcStoreBuffer.putCell((Cell **)addr);
 #endif
 }
 
 inline bool
 js::ObjectImpl::hasPrivate() const
 {
     return getClass()->hasPrivate();
 }
--- a/js/src/vm/Shape-inl.h
+++ b/js/src/vm/Shape-inl.h
@@ -26,28 +26,28 @@
 #include "jsgcinlines.h"
 #include "jsobjinlines.h"
 
 #include "vm/ScopeObject-inl.h"
 
 namespace js {
 
 static inline void
-GetterSetterWriteBarrierPost(JSCompartment *comp, JSObject **objp)
+GetterSetterWriteBarrierPost(JS::Zone *zone, JSObject **objp)
 {
 #ifdef JSGC_GENERATIONAL
-    comp->gcStoreBuffer.putRelocatableCell(reinterpret_cast<gc::Cell **>(objp));
+    zone->gcStoreBuffer.putRelocatableCell(reinterpret_cast<gc::Cell **>(objp));
 #endif
 }
 
 static inline void
-GetterSetterWriteBarrierPostRemove(JSCompartment *comp, JSObject **objp)
+GetterSetterWriteBarrierPostRemove(JS::Zone *zone, JSObject **objp)
 {
 #ifdef JSGC_GENERATIONAL
-    comp->gcStoreBuffer.removeRelocatableCell(reinterpret_cast<gc::Cell **>(objp));
+    zone->gcStoreBuffer.removeRelocatableCell(reinterpret_cast<gc::Cell **>(objp));
 #endif
 }
 
 inline
 BaseShape::BaseShape(Class *clasp, JSObject *parent, uint32_t objectFlags)
 {
     JS_ASSERT(!(objectFlags & ~OBJECT_FLAG_MASK));
     PodZero(this);
@@ -64,61 +64,59 @@ BaseShape::BaseShape(Class *clasp, JSObj
     PodZero(this);
     this->clasp = clasp;
     this->parent = parent;
     this->flags = objectFlags;
     this->rawGetter = rawGetter;
     this->rawSetter = rawSetter;
     if ((attrs & JSPROP_GETTER) && rawGetter) {
         this->flags |= HAS_GETTER_OBJECT;
-        GetterSetterWriteBarrierPost(compartment(), &this->getterObj);
+        GetterSetterWriteBarrierPost(zone(), &this->getterObj);
     }
     if ((attrs & JSPROP_SETTER) && rawSetter) {
         this->flags |= HAS_SETTER_OBJECT;
-        GetterSetterWriteBarrierPost(compartment(), &this->setterObj);
+        GetterSetterWriteBarrierPost(zone(), &this->setterObj);
     }
 }
 
 inline
 BaseShape::BaseShape(const StackBaseShape &base)
 {
     PodZero(this);
     this->clasp = base.clasp;
     this->parent = base.parent;
     this->flags = base.flags;
     this->rawGetter = base.rawGetter;
     this->rawSetter = base.rawSetter;
-    if ((base.flags & HAS_GETTER_OBJECT) && base.rawGetter) {
-        GetterSetterWriteBarrierPost(compartment(), &this->getterObj);
-    }
-    if ((base.flags & HAS_SETTER_OBJECT) && base.rawSetter) {
-        GetterSetterWriteBarrierPost(compartment(), &this->setterObj);
-    }
+    if ((base.flags & HAS_GETTER_OBJECT) && base.rawGetter)
+        GetterSetterWriteBarrierPost(zone(), &this->getterObj);
+    if ((base.flags & HAS_SETTER_OBJECT) && base.rawSetter)
+        GetterSetterWriteBarrierPost(zone(), &this->setterObj);
 }
 
 inline BaseShape &
 BaseShape::operator=(const BaseShape &other)
 {
     clasp = other.clasp;
     parent = other.parent;
     flags = other.flags;
     slotSpan_ = other.slotSpan_;
     if (flags & HAS_GETTER_OBJECT) {
         getterObj = other.getterObj;
-        GetterSetterWriteBarrierPost(compartment(), &getterObj);
+        GetterSetterWriteBarrierPost(zone(), &getterObj);
     } else {
         rawGetter = other.rawGetter;
-        GetterSetterWriteBarrierPostRemove(compartment(), &getterObj);
+        GetterSetterWriteBarrierPostRemove(zone(), &getterObj);
     }
     if (flags & HAS_SETTER_OBJECT) {
         setterObj = other.setterObj;
-        GetterSetterWriteBarrierPost(compartment(), &setterObj);
+        GetterSetterWriteBarrierPost(zone(), &setterObj);
     } else {
         rawSetter = other.rawSetter;
-        GetterSetterWriteBarrierPostRemove(compartment(), &setterObj);
+        GetterSetterWriteBarrierPostRemove(zone(), &setterObj);
     }
     return *this;
 }
 
 inline bool
 BaseShape::matchesGetterSetter(PropertyOp rawGetter, StrictPropertyOp rawSetter) const
 {
     return rawGetter == this->rawGetter && rawSetter == this->rawSetter;
@@ -402,38 +400,38 @@ EmptyShape::EmptyShape(UnrootedUnownedBa
 
 inline void
 Shape::writeBarrierPre(UnrootedShape shape)
 {
 #ifdef JSGC_INCREMENTAL
     if (!shape)
         return;
 
-    JSCompartment *comp = shape->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = shape->zone();
+    if (zone->needsBarrier()) {
         UnrootedShape tmp = shape;
-        MarkShapeUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkShapeUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         JS_ASSERT(tmp == shape);
     }
 #endif
 }
 
 inline void
 Shape::writeBarrierPost(RawShape shape, void *addr)
 {
 }
 
 inline void
 Shape::readBarrier(UnrootedShape shape)
 {
 #ifdef JSGC_INCREMENTAL
-    JSCompartment *comp = shape->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = shape->zone();
+    if (zone->needsBarrier()) {
         UnrootedShape tmp = shape;
-        MarkShapeUnbarriered(comp->barrierTracer(), &tmp, "read barrier");
+        MarkShapeUnbarriered(zone->barrierTracer(), &tmp, "read barrier");
         JS_ASSERT(tmp == shape);
     }
 #endif
 }
 
 inline void
 Shape::markChildren(JSTracer *trc)
 {
@@ -445,38 +443,38 @@ Shape::markChildren(JSTracer *trc)
 
 inline void
 BaseShape::writeBarrierPre(RawBaseShape base)
 {
 #ifdef JSGC_INCREMENTAL
     if (!base)
         return;
 
-    JSCompartment *comp = base->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = base->zone();
+    if (zone->needsBarrier()) {
         RawBaseShape tmp = base;
-        MarkBaseShapeUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkBaseShapeUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         JS_ASSERT(tmp == base);
     }
 #endif
 }
 
 inline void
 BaseShape::writeBarrierPost(RawBaseShape shape, void *addr)
 {
 }
 
 inline void
 BaseShape::readBarrier(RawBaseShape base)
 {
 #ifdef JSGC_INCREMENTAL
-    JSCompartment *comp = base->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = base->zone();
+    if (zone->needsBarrier()) {
         RawBaseShape tmp = base;
-        MarkBaseShapeUnbarriered(comp->barrierTracer(), &tmp, "read barrier");
+        MarkBaseShapeUnbarriered(zone->barrierTracer(), &tmp, "read barrier");
         JS_ASSERT(tmp == base);
     }
 #endif
 }
 
 inline void
 BaseShape::markChildren(JSTracer *trc)
 {
--- a/js/src/vm/String-inl.h
+++ b/js/src/vm/String-inl.h
@@ -90,77 +90,77 @@ NewShortString(JSContext *cx, TwoByteCha
     jschar *storage = str->init(len);
     PodCopy(storage, chars.start().get(), len);
     storage[len] = 0;
     Probes::createString(cx, str, len);
     return str;
 }
 
 static inline void
-StringWriteBarrierPost(JSCompartment *comp, JSString **strp)
+StringWriteBarrierPost(JS::Zone *zone, JSString **strp)
 {
 #ifdef JSGC_GENERATIONAL
-    comp->gcStoreBuffer.putRelocatableCell(reinterpret_cast<gc::Cell **>(strp));
+    zone->gcStoreBuffer.putRelocatableCell(reinterpret_cast<gc::Cell **>(strp));
 #endif
 }
 
 static inline void
-StringWriteBarrierPostRemove(JSCompartment *comp, JSString **strp)
+StringWriteBarrierPostRemove(JS::Zone *zone, JSString **strp)
 {
 #ifdef JSGC_GENERATIONAL
-    comp->gcStoreBuffer.removeRelocatableCell(reinterpret_cast<gc::Cell **>(strp));
+    zone->gcStoreBuffer.removeRelocatableCell(reinterpret_cast<gc::Cell **>(strp));
 #endif
 }
 
 } /* namespace js */
 
 inline void
 JSString::writeBarrierPre(JSString *str)
 {
 #ifdef JSGC_INCREMENTAL
     if (!str)
         return;
 
-    JSCompartment *comp = str->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = str->zone();
+    if (zone->needsBarrier()) {
         JSString *tmp = str;
-        MarkStringUnbarriered(comp->barrierTracer(), &tmp, "write barrier");
+        MarkStringUnbarriered(zone->barrierTracer(), &tmp, "write barrier");
         JS_ASSERT(tmp == str);
     }
 #endif
 }
 
 inline void
 JSString::writeBarrierPost(JSString *str, void *addr)
 {
 #ifdef JSGC_GENERATIONAL
     if (!str)
         return;
-    str->compartment()->gcStoreBuffer.putCell((Cell **)addr);
+    str->zone()->gcStoreBuffer.putCell((Cell **)addr);
 #endif
 }
 
 inline bool
-JSString::needWriteBarrierPre(JSCompartment *comp)
+JSString::needWriteBarrierPre(JS::Zone *zone)
 {
 #ifdef JSGC_INCREMENTAL
-    return comp->needsBarrier();
+    return zone->needsBarrier();
 #else
     return false;
 #endif
 }
 
 inline void
 JSString::readBarrier(JSString *str)
 {
 #ifdef JSGC_INCREMENTAL
-    JSCompartment *comp = str->compartment();
-    if (comp->needsBarrier()) {
+    JS::Zone *zone = str->zone();
+    if (zone->needsBarrier()) {
         JSString *tmp = str;
-        MarkStringUnbarriered(comp->barrierTracer(), &tmp, "read barrier");
+        MarkStringUnbarriered(zone->barrierTracer(), &tmp, "read barrier");
         JS_ASSERT(tmp == str);
     }
 #endif
 }
 
 JS_ALWAYS_INLINE bool
 JSString::validateLength(JSContext *maybecx, size_t length)
 {
@@ -173,18 +173,18 @@ JSString::validateLength(JSContext *mayb
 }
 
 JS_ALWAYS_INLINE void
 JSRope::init(JSString *left, JSString *right, size_t length)
 {
     d.lengthAndFlags = buildLengthAndFlags(length, ROPE_FLAGS);
     d.u1.left = left;
     d.s.u2.right = right;
-    js::StringWriteBarrierPost(compartment(), &d.u1.left);
-    js::StringWriteBarrierPost(compartment(), &d.s.u2.right);
+    js::StringWriteBarrierPost(zone(), &d.u1.left);
+    js::StringWriteBarrierPost(zone(), &d.s.u2.right);
 }
 
 template <js::AllowGC allowGC>
 JS_ALWAYS_INLINE JSRope *
 JSRope::new_(JSContext *cx,
              typename js::MaybeRooted<JSString*, allowGC>::HandleType left,
              typename js::MaybeRooted<JSString*, allowGC>::HandleType right,
              size_t length)
@@ -207,17 +207,17 @@ JSRope::markChildren(JSTracer *trc)
 
 JS_ALWAYS_INLINE void
 JSDependentString::init(JSLinearString *base, const jschar *chars, size_t length)
 {
     JS_ASSERT(!js::IsPoisonedPtr(base));
     d.lengthAndFlags = buildLengthAndFlags(length, DEPENDENT_FLAGS);
     d.u1.chars = chars;
     d.s.u2.base = base;
-    js::StringWriteBarrierPost(compartment(), reinterpret_cast<JSString **>(&d.s.u2.base));
+    js::StringWriteBarrierPost(zone(), reinterpret_cast<JSString **>(&d.s.u2.base));
 }
 
 JS_ALWAYS_INLINE JSLinearString *
 JSDependentString::new_(JSContext *cx, JSLinearString *baseArg, const jschar *chars, size_t length)
 {
     /* Try to avoid long chains of dependent strings. */
     while (baseArg->isDependent())
         baseArg = baseArg->asDependent().base();
--- a/js/src/vm/String.cpp
+++ b/js/src/vm/String.cpp
@@ -196,17 +196,17 @@ JSRope::flattenInternal(JSContext *maybe
      *
      * N.B. This optimization can create chains of dependent strings.
      */
     const size_t wholeLength = length();
     size_t wholeCapacity;
     jschar *wholeChars;
     JSString *str = this;
     jschar *pos;
-    JSCompartment *comp = compartment();
+    Zone *zone = this->zone();
 
     if (this->leftChild()->isExtensible()) {
         JSExtensibleString &left = this->leftChild()->asExtensible();
         size_t capacity = left.capacity();
         if (capacity >= wholeLength) {
             if (b == WithIncrementalBarrier) {
                 JSString::writeBarrierPre(d.u1.left);
                 JSString::writeBarrierPre(d.s.u2.right);
@@ -214,35 +214,35 @@ JSRope::flattenInternal(JSContext *maybe
 
             wholeCapacity = capacity;
             wholeChars = const_cast<jschar *>(left.chars());
             size_t bits = left.d.lengthAndFlags;
             pos = wholeChars + (bits >> LENGTH_SHIFT);
             JS_STATIC_ASSERT(!(EXTENSIBLE_FLAGS & DEPENDENT_FLAGS));
             left.d.lengthAndFlags = bits ^ (EXTENSIBLE_FLAGS | DEPENDENT_FLAGS);
             left.d.s.u2.base = (JSLinearString *)this;  /* will be true on exit */
-            StringWriteBarrierPostRemove(comp, &left.d.u1.left);
-            StringWriteBarrierPost(comp, (JSString **)&left.d.s.u2.base);
+            StringWriteBarrierPostRemove(zone, &left.d.u1.left);
+            StringWriteBarrierPost(zone, (JSString **)&left.d.s.u2.base);
             goto visit_right_child;
         }
     }
 
     if (!AllocChars(maybecx, wholeLength, &wholeChars, &wholeCapacity))
         return NULL;
 
     pos = wholeChars;
     first_visit_node: {
         if (b == WithIncrementalBarrier) {
             JSString::writeBarrierPre(str->d.u1.left);
             JSString::writeBarrierPre(str->d.s.u2.right);
         }
 
         JSString &left = *str->d.u1.left;
         str->d.u1.chars = pos;
-        StringWriteBarrierPostRemove(comp, &str->d.u1.left);
+        StringWriteBarrierPostRemove(zone, &str->d.u1.left);
         if (left.isRope()) {
             left.d.s.u3.parent = str;          /* Return to this when 'left' done, */
             left.d.lengthAndFlags = 0x200;     /* but goto visit_right_child. */
             str = &left;
             goto first_visit_node;
         }
         size_t len = left.length();
         PodCopy(pos, left.d.u1.chars, len);
@@ -262,37 +262,37 @@ JSRope::flattenInternal(JSContext *maybe
     }
     finish_node: {
         if (str == this) {
             JS_ASSERT(pos == wholeChars + wholeLength);
             *pos = '\0';
             str->d.lengthAndFlags = buildLengthAndFlags(wholeLength, EXTENSIBLE_FLAGS);
             str->d.u1.chars = wholeChars;
             str->d.s.u2.capacity = wholeCapacity;
-            StringWriteBarrierPostRemove(comp, &str->d.u1.left);
-            StringWriteBarrierPostRemove(comp, &str->d.s.u2.right);
+            StringWriteBarrierPostRemove(zone, &str->d.u1.left);
+            StringWriteBarrierPostRemove(zone, &str->d.s.u2.right);
             return &this->asFlat();
         }
         size_t progress = str->d.lengthAndFlags;
         str->d.lengthAndFlags = buildLengthAndFlags(pos - str->d.u1.chars, DEPENDENT_FLAGS);
         str->d.s.u2.base = (JSLinearString *)this;       /* will be true on exit */
-        StringWriteBarrierPost(comp, (JSString **)&str->d.s.u2.base);
+        StringWriteBarrierPost(zone, (JSString **)&str->d.s.u2.base);
         str = str->d.s.u3.parent;
         if (progress == 0x200)
             goto visit_right_child;
         JS_ASSERT(progress == 0x300);
         goto finish_node;
     }
 }
 
 JSFlatString *
 JSRope::flatten(JSContext *maybecx)
 {
 #if JSGC_INCREMENTAL
-    if (compartment()->needsBarrier())
+    if (zone()->needsBarrier())
         return flattenInternal<WithIncrementalBarrier>(maybecx);
     else
         return flattenInternal<NoBarrier>(maybecx);
 #else
     return flattenInternal<NoBarrier>(maybecx);
 #endif
 }
 
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -412,17 +412,17 @@ class JSString : public js::gc::Cell
     }
 
     static size_t offsetOfChars() {
         return offsetof(JSString, d.u1.chars);
     }
 
     static inline void writeBarrierPre(JSString *str);
     static inline void writeBarrierPost(JSString *str, void *addr);
-    static inline bool needWriteBarrierPre(JSCompartment *comp);
+    static inline bool needWriteBarrierPre(JS::Zone *zone);
     static inline void readBarrier(JSString *str);
 
     static inline js::ThingRootKind rootKind() { return js::THING_ROOT_STRING; }
 
 #ifdef DEBUG
     void dump();
     static void dumpChars(const jschar *s, size_t len);
     bool equals(const char *s);