Bug 989414 - Rename EncapsulatedPtr to PreBarriered to clarify intended usage; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Fri, 25 Apr 2014 15:18:53 -0700
changeset 180802 3a821ea694d7631ad683057ed65198b32eaadc36
parent 180801 d8a34e6f01f499a492a63bd5726e9ad56673d422
child 180803 7165d1b0097ab84362be2a5cbf03173eee54f27f
push id42875
push usertcole@mozilla.com
push dateTue, 29 Apr 2014 19:39:44 +0000
treeherdermozilla-inbound@57292971f110 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs989414
milestone32.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 989414 - Rename EncapsulatedPtr to PreBarriered to clarify intended usage; r=jonco
js/src/builtin/MapObject.h
js/src/gc/Barrier.h
js/src/gdb/mozilla/Root.py
js/src/gdb/tests/test-Root.py
js/src/jit/Ion.cpp
js/src/jit/IonCode.h
js/src/jit/JitCompartment.h
js/src/jswatchpoint.cpp
js/src/jswatchpoint.h
js/src/vm/Debugger.h
js/src/vm/ScopeObject.cpp
js/src/vm/ScopeObject.h
js/src/vm/Shape.h
js/src/vm/WeakMapObject.h
js/src/vm/WeakMapPtr.cpp
--- a/js/src/builtin/MapObject.h
+++ b/js/src/builtin/MapObject.h
@@ -17,17 +17,17 @@ namespace js {
  * Comparing two ropes for equality can fail. The js::HashTable template
  * requires infallible hash() and match() operations. Therefore we require
  * all values to be converted to hashable form before being used as a key
  * in a Map or Set object.
  *
  * All values except ropes are hashable as-is.
  */
 class HashableValue {
-    EncapsulatedValue value;
+    PreBarrieredValue value;
 
   public:
     struct Hasher {
         typedef HashableValue Lookup;
         static HashNumber hash(const Lookup &v) { return v.hash(); }
         static bool match(const HashableValue &k, const Lookup &l) { return k == l; }
         static bool isEmpty(const HashableValue &v) { return v.value.isMagic(JS_HASH_KEY_EMPTY); }
         static void makeEmpty(HashableValue *vp) { vp->value = MagicValue(JS_HASH_KEY_EMPTY); }
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -134,17 +134,17 @@
  * the init naming idiom in many places to signify that a field is being
  * assigned for the first time.
  *
  * For each of pointers, Values and jsids this file implements four classes,
  * illustrated here for the pointer (Ptr) classes:
  *
  * BarrieredPtr           abstract base class which provides common operations
  *  |  |  |
- *  |  | EncapsulatedPtr  provides pre-barriers only
+ *  |  | PreBarriered     provides pre-barriers only
  *  |  |
  *  | HeapPtr             provides pre- and post-barriers
  *  |
  * RelocatablePtr         provides pre- and post-barriers and is relocatable
  *
  * These classes are designed to be used by the internals of the JS engine.
  * Barriers designed to be used externally are provided in
  * js/public/RootingAPI.h.
@@ -440,44 +440,44 @@ class BarrieredPtr : public HeapBase<T>
     static void writeBarrierPost(const T &v, T *vp) { InternalGCMethods<T>::postBarrier(vp); }
 
   protected:
     void pre() { InternalGCMethods<T>::preBarrier(value); }
     void pre(Zone *zone) { InternalGCMethods<T>::preBarrier(zone, value); }
 };
 
 /*
- * EncapsulatedPtr only automatically handles pre-barriers. Post-barriers must
+ * PreBarriered only automatically handles pre-barriers. Post-barriers must
  * be manually implemented when using this class. HeapPtr and RelocatablePtr
  * should be used in all cases that do not require explicit low-level control
  * of moving behavior, e.g. for HashMap keys.
  */
 template <class T>
-class EncapsulatedPtr : public BarrieredPtr<T>
+class PreBarriered : public BarrieredPtr<T>
 {
   public:
-    EncapsulatedPtr() : BarrieredPtr<T>(GCMethods<T>::initial()) {}
-    EncapsulatedPtr(T v) : BarrieredPtr<T>(v) {}
-    explicit EncapsulatedPtr(const EncapsulatedPtr<T> &v)
+    PreBarriered() : BarrieredPtr<T>(GCMethods<T>::initial()) {}
+    PreBarriered(T v) : BarrieredPtr<T>(v) {}
+    explicit PreBarriered(const PreBarriered<T> &v)
       : BarrieredPtr<T>(v.value) {}
 
     /* Use to set the pointer to nullptr. */
     void clear() {
         this->pre();
         this->value = nullptr;
     }
 
-    EncapsulatedPtr<T> &operator=(T v) {
+    PreBarriered<T> &operator=(T v) {
         this->pre();
         JS_ASSERT(!GCMethods<T>::poisoned(v));
         this->value = v;
         return *this;
     }
 
-    EncapsulatedPtr<T> &operator=(const EncapsulatedPtr<T> &v) {
+    PreBarriered<T> &operator=(const PreBarriered<T> &v) {
         this->pre();
         JS_ASSERT(!GCMethods<T>::poisoned(v.value));
         this->value = v.value;
         return *this;
     }
 };
 
 /*
@@ -690,19 +690,19 @@ class JitCode;
 namespace types {
 struct TypeObject;
 struct TypeObjectAddendum;
 }
 
 typedef BarrieredPtr<JSObject*> BarrieredPtrObject;
 typedef BarrieredPtr<JSScript*> BarrieredPtrScript;
 
-typedef EncapsulatedPtr<JSObject*> EncapsulatedPtrObject;
-typedef EncapsulatedPtr<JSScript*> EncapsulatedPtrScript;
-typedef EncapsulatedPtr<jit::JitCode*> EncapsulatedPtrJitCode;
+typedef PreBarriered<JSObject*> PreBarrieredObject;
+typedef PreBarriered<JSScript*> PreBarrieredScript;
+typedef PreBarriered<jit::JitCode*> PreBarrieredJitCode;
 
 typedef RelocatablePtr<JSObject*> RelocatablePtrObject;
 typedef RelocatablePtr<JSScript*> RelocatablePtrScript;
 typedef RelocatablePtr<NestedScopeObject*> RelocatablePtrNestedScopeObject;
 
 typedef HeapPtr<ArrayBufferObject*> HeapPtrArrayBufferObject;
 typedef HeapPtr<JSObject*> HeapPtrObject;
 typedef HeapPtr<JSFunction*> HeapPtrFunction;
@@ -715,22 +715,22 @@ typedef HeapPtr<JSScript*> HeapPtrScript
 typedef HeapPtr<Shape*> HeapPtrShape;
 typedef HeapPtr<BaseShape*> HeapPtrBaseShape;
 typedef HeapPtr<UnownedBaseShape*> HeapPtrUnownedBaseShape;
 typedef HeapPtr<types::TypeObject*> HeapPtrTypeObject;
 typedef HeapPtr<types::TypeObjectAddendum*> HeapPtrTypeObjectAddendum;
 typedef HeapPtr<jit::JitCode*> HeapPtrJitCode;
 
 typedef BarrieredPtr<Value> BarrieredValue;
-typedef EncapsulatedPtr<Value> EncapsulatedValue;
+typedef PreBarriered<Value> PreBarrieredValue;
 typedef RelocatablePtr<Value> RelocatableValue;
 typedef HeapPtr<Value> HeapValue;
 
 typedef BarrieredPtr<jsid> BarrieredId;
-typedef EncapsulatedPtr<jsid> EncapsulatedId;
+typedef PreBarriered<jsid> PreBarrieredId;
 typedef RelocatablePtr<jsid> RelocatableId;
 typedef HeapPtr<jsid> HeapId;
 
 typedef ImmutableTenuredPtr<PropertyName*> ImmutablePropertyNamePtr;
 
 /* Useful for hashtables with a HeapPtr as key. */
 template <class T>
 struct HeapPtrHasher
@@ -743,28 +743,28 @@ struct HeapPtrHasher
     static void rekey(Key &k, const Key& newKey) { k.unsafeSet(newKey); }
 };
 
 /* Specialized hashing policy for HeapPtrs. */
 template <class T>
 struct DefaultHasher< HeapPtr<T> > : HeapPtrHasher<T> { };
 
 template <class T>
-struct EncapsulatedPtrHasher
+struct PreBarrieredHasher
 {
-    typedef EncapsulatedPtr<T> Key;
+    typedef PreBarriered<T> Key;
     typedef T Lookup;
 
     static HashNumber hash(Lookup obj) { return DefaultHasher<T>::hash(obj); }
     static bool match(const Key &k, Lookup l) { return k.get() == l; }
     static void rekey(Key &k, const Key& newKey) { k.unsafeSet(newKey); }
 };
 
 template <class T>
-struct DefaultHasher< EncapsulatedPtr<T> > : EncapsulatedPtrHasher<T> { };
+struct DefaultHasher< PreBarriered<T> > : PreBarrieredHasher<T> { };
 
 // A pre- and post-barriered Value that is specialized to be aware that it
 // resides in a slots or elements vector. This allows it to be relocated in
 // memory, but with substantially less overhead than a RelocatablePtr.
 class HeapSlot : public BarrieredValue
 {
   public:
     enum Kind {
@@ -944,19 +944,19 @@ class ReadBarrieredValue
 };
 
 /*
  * Operations on a Heap thing inside the GC need to strip the barriers from
  * pointer operations. This template helps do that in contexts where the type
  * is templatized.
  */
 template <typename T> struct Unbarriered {};
-template <typename S> struct Unbarriered< EncapsulatedPtr<S> > { typedef S *type; };
+template <typename S> struct Unbarriered< PreBarriered<S> > { typedef S *type; };
 template <typename S> struct Unbarriered< RelocatablePtr<S> > { typedef S *type; };
-template <> struct Unbarriered<EncapsulatedValue> { typedef Value type; };
+template <> struct Unbarriered<PreBarrieredValue> { typedef Value type; };
 template <> struct Unbarriered<RelocatableValue> { typedef Value type; };
-template <typename S> struct Unbarriered< DefaultHasher< EncapsulatedPtr<S> > > {
+template <typename S> struct Unbarriered< DefaultHasher< PreBarriered<S> > > {
     typedef DefaultHasher<S *> type;
 };
 
 } /* namespace js */
 
 #endif /* gc_Barrier_h */
--- a/js/src/gdb/mozilla/Root.py
+++ b/js/src/gdb/mozilla/Root.py
@@ -58,22 +58,22 @@ class Rooted(Common):
 @template_pretty_printer("JS::Handle")
 class Handle(Common):
     handle = True
 
 @template_pretty_printer("JS::MutableHandle")
 class MutableHandle(Common):
     handle = True
 
-@template_pretty_printer("js::EncapsulatedPtr")
-class EncapsulatedPtr(Common):
+@template_pretty_printer("js::PreBarriered")
+class PreBarriered(Common):
     member = 'value'
 
-@pretty_printer("js::EncapsulatedValue")
-class EncapsulatedValue(Common):
+@pretty_printer("js::PreBarrieredValue")
+class PreBarrieredValue(Common):
     member = 'value'
 
 @pretty_printer("js::BarrieredValue")
 class BarrieredValue(Common):
     member = 'value'
 
 # Return the referent of a HeapPtr, Rooted, or Handle.
 def deref(root):
--- a/js/src/gdb/tests/test-Root.py
+++ b/js/src/gdb/tests/test-Root.py
@@ -1,15 +1,15 @@
 # Test printing Handles.
 
 assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::Rooted')
 assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::Handle')
 assert_subprinter_registered('SpiderMonkey', 'instantiations-of-JS::MutableHandle')
-assert_subprinter_registered('SpiderMonkey', 'instantiations-of-js::EncapsulatedPtr')
-assert_subprinter_registered('SpiderMonkey', 'js::EncapsulatedValue')
+assert_subprinter_registered('SpiderMonkey', 'instantiations-of-js::PreBarriered')
+assert_subprinter_registered('SpiderMonkey', 'js::PreBarrieredValue')
 
 run_fragment('Root.handle')
 
 assert_pretty('obj', '(JSObject * const)  [object global] delegate')
 assert_pretty('mutableObj', '(JSObject *)  [object global] delegate')
 
 run_fragment('Root.HeapSlot')
 
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -608,17 +608,17 @@ JitCompartment::mark(JSTracer *trc, JSCo
 
             // Check and increment the age. If the script is below the max
             // age, mark it.
             //
             // Subtlety: We depend on the tracing of the parallel IonScript's
             // callTargetEntries to propagate the parallel age to the entire
             // call graph.
             if (ShouldPreserveParallelJITCode(trc->runtime(), script, /* increase = */ true)) {
-                MarkScript(trc, const_cast<EncapsulatedPtrScript *>(&e.front()), "par-script");
+                MarkScript(trc, const_cast<PreBarrieredScript *>(&e.front()), "par-script");
                 MOZ_ASSERT(script == e.front());
             }
         }
     }
 }
 
 void
 JitCompartment::sweep(FreeOp *fop)
--- a/js/src/jit/IonCode.h
+++ b/js/src/jit/IonCode.h
@@ -164,20 +164,20 @@ struct DependentAsmJSModuleExit
     { }
 };
 
 // An IonScript attaches Ion-generated information to a JSScript.
 struct IonScript
 {
   private:
     // Code pointer containing the actual method.
-    EncapsulatedPtrJitCode method_;
+    PreBarrieredJitCode method_;
 
     // Deoptimization table used by this method.
-    EncapsulatedPtrJitCode deoptTable_;
+    PreBarrieredJitCode deoptTable_;
 
     // Entrypoint for OSR, or nullptr.
     jsbytecode *osrPc_;
 
     // Offset to OSR entrypoint from method_->raw(), or 0.
     uint32_t osrEntryOffset_;
 
     // Offset to entrypoint skipping type arg check from method_->raw().
@@ -300,18 +300,18 @@ struct IonScript
     inline const uint8_t *bottomBuffer() const {
         return reinterpret_cast<const uint8_t *>(this);
     }
 
   public:
     SnapshotOffset *bailoutTable() {
         return (SnapshotOffset *) &bottomBuffer()[bailoutTable_];
     }
-    EncapsulatedValue *constants() {
-        return (EncapsulatedValue *) &bottomBuffer()[constantTable_];
+    PreBarrieredValue *constants() {
+        return (PreBarrieredValue *) &bottomBuffer()[constantTable_];
     }
     const SafepointIndex *safepointIndices() const {
         return const_cast<IonScript *>(this)->safepointIndices();
     }
     SafepointIndex *safepointIndices() {
         return (SafepointIndex *) &bottomBuffer()[safepointIndexOffset_];
     }
     const OsiIndex *osiIndices() const {
@@ -491,17 +491,17 @@ struct IonScript
         return safepointsSize_;
     }
     size_t callTargetEntries() const {
         return callTargetEntries_;
     }
     size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
         return mallocSizeOf(this);
     }
-    EncapsulatedValue &getConstant(size_t index) {
+    PreBarrieredValue &getConstant(size_t index) {
         JS_ASSERT(index < numConstants());
         return constants()[index];
     }
     size_t numConstants() const {
         return constantEntries_;
     }
     uint32_t frameSlots() const {
         return frameSlots_;
--- a/js/src/jit/JitCompartment.h
+++ b/js/src/jit/JitCompartment.h
@@ -380,17 +380,17 @@ class JitCompartment
     // pointers. This has to be a weak pointer to avoid keeping the whole
     // compartment alive.
     ReadBarriered<JitCode> stringConcatStub_;
     ReadBarriered<JitCode> parallelStringConcatStub_;
 
     // Set of JSScripts invoked by ForkJoin (i.e. the entry script). These
     // scripts are marked if their respective parallel IonScripts' age is less
     // than a certain amount. See IonScript::parallelAge_.
-    typedef HashSet<EncapsulatedPtrScript> ScriptSet;
+    typedef HashSet<PreBarrieredScript> ScriptSet;
     ScriptSet *activeParallelEntryScripts_;
 
     JitCode *generateStringConcatStub(JSContext *cx, ExecutionMode mode);
 
   public:
     JitCode *getStubCode(uint32_t key) {
         ICStubCodeMap::AddPtr p = stubCodes_->lookupForAdd(key);
         if (p)
--- a/js/src/jswatchpoint.cpp
+++ b/js/src/jswatchpoint.cpp
@@ -155,26 +155,26 @@ bool
 WatchpointMap::markIteratively(JSTracer *trc)
 {
     bool marked = false;
     for (Map::Enum e(map); !e.empty(); e.popFront()) {
         Map::Entry &entry = e.front();
         JSObject *priorKeyObj = entry.key().object;
         jsid priorKeyId(entry.key().id.get());
         bool objectIsLive =
-            IsObjectMarked(const_cast<EncapsulatedPtrObject *>(&entry.key().object));
+            IsObjectMarked(const_cast<PreBarrieredObject *>(&entry.key().object));
         if (objectIsLive || entry.value().held) {
             if (!objectIsLive) {
-                MarkObject(trc, const_cast<EncapsulatedPtrObject *>(&entry.key().object),
+                MarkObject(trc, const_cast<PreBarrieredObject *>(&entry.key().object),
                            "held Watchpoint object");
                 marked = true;
             }
 
             JS_ASSERT(JSID_IS_STRING(priorKeyId) || JSID_IS_INT(priorKeyId));
-            MarkId(trc, const_cast<EncapsulatedId *>(&entry.key().id), "WatchKey::id");
+            MarkId(trc, const_cast<PreBarrieredId *>(&entry.key().id), "WatchKey::id");
 
             if (entry.value().closure && !IsObjectMarked(&entry.value().closure)) {
                 MarkObject(trc, &entry.value().closure, "Watchpoint::closure");
                 marked = true;
             }
 
             /* We will sweep this entry in sweepAll if !objectIsLive. */
             if (priorKeyObj != entry.key().object || priorKeyId != entry.key().id)
@@ -188,19 +188,19 @@ void
 WatchpointMap::markAll(JSTracer *trc)
 {
     for (Map::Enum e(map); !e.empty(); e.popFront()) {
         Map::Entry &entry = e.front();
         WatchKey key = entry.key();
         WatchKey prior = key;
         JS_ASSERT(JSID_IS_STRING(prior.id) || JSID_IS_INT(prior.id));
 
-        MarkObject(trc, const_cast<EncapsulatedPtrObject *>(&key.object),
+        MarkObject(trc, const_cast<PreBarrieredObject *>(&key.object),
                    "held Watchpoint object");
-        MarkId(trc, const_cast<EncapsulatedId *>(&key.id), "WatchKey::id");
+        MarkId(trc, const_cast<PreBarrieredId *>(&key.id), "WatchKey::id");
         MarkObject(trc, &entry.value().closure, "Watchpoint::closure");
 
         if (prior.object != key.object || prior.id != key.id)
             e.rekeyFront(key);
     }
 }
 
 void
--- a/js/src/jswatchpoint.h
+++ b/js/src/jswatchpoint.h
@@ -16,27 +16,27 @@
 namespace js {
 
 struct WeakMapTracer;
 
 struct WatchKey {
     WatchKey() {}
     WatchKey(JSObject *obj, jsid id) : object(obj), id(id) {}
     WatchKey(const WatchKey &key) : object(key.object.get()), id(key.id.get()) {}
-    EncapsulatedPtrObject object;
-    EncapsulatedId id;
+    PreBarrieredObject object;
+    PreBarrieredId id;
 
     bool operator!=(const WatchKey &other) const {
         return object != other.object || id != other.id;
     }
 };
 
 struct Watchpoint {
     JSWatchPointHandler handler;
-    EncapsulatedPtrObject closure;  /* This is always marked in minor GCs and so doesn't require a postbarrier. */
+    PreBarrieredObject closure;  /* This is always marked in minor GCs and so doesn't require a postbarrier. */
     bool held;  /* true if currently running handler */
     Watchpoint(JSWatchPointHandler handler, JSObject* closure, bool held)
       : handler(handler), closure(closure), held(held) {}
 };
 
 template <>
 struct DefaultHasher<WatchKey>
 {
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -214,25 +214,25 @@ class Debugger : private mozilla::Linked
      */
     typedef HashMap<AbstractFramePtr,
                     RelocatablePtrObject,
                     DefaultHasher<AbstractFramePtr>,
                     RuntimeAllocPolicy> FrameMap;
     FrameMap frames;
 
     /* An ephemeral map from JSScript* to Debugger.Script instances. */
-    typedef DebuggerWeakMap<EncapsulatedPtrScript, RelocatablePtrObject> ScriptWeakMap;
+    typedef DebuggerWeakMap<PreBarrieredScript, RelocatablePtrObject> ScriptWeakMap;
     ScriptWeakMap scripts;
 
     /* The map from debuggee source script objects to their Debugger.Source instances. */
-    typedef DebuggerWeakMap<EncapsulatedPtrObject, RelocatablePtrObject, true> SourceWeakMap;
+    typedef DebuggerWeakMap<PreBarrieredObject, RelocatablePtrObject, true> SourceWeakMap;
     SourceWeakMap sources;
 
     /* The map from debuggee objects to their Debugger.Object instances. */
-    typedef DebuggerWeakMap<EncapsulatedPtrObject, RelocatablePtrObject> ObjectWeakMap;
+    typedef DebuggerWeakMap<PreBarrieredObject, RelocatablePtrObject> ObjectWeakMap;
     ObjectWeakMap objects;
 
     /* The map from debuggee Envs to Debugger.Environment instances. */
     ObjectWeakMap environments;
 
     class FrameRange;
     class ScriptQuery;
 
@@ -632,29 +632,29 @@ class Breakpoint {
     friend struct ::JSCompartment;
     friend class Debugger;
 
   public:
     Debugger * const debugger;
     BreakpointSite * const site;
   private:
     /* |handler| is marked unconditionally during minor GC. */
-    js::EncapsulatedPtrObject handler;
+    js::PreBarrieredObject handler;
     JSCList debuggerLinks;
     JSCList siteLinks;
 
   public:
     static Breakpoint *fromDebuggerLinks(JSCList *links);
     static Breakpoint *fromSiteLinks(JSCList *links);
     Breakpoint(Debugger *debugger, BreakpointSite *site, JSObject *handler);
     void destroy(FreeOp *fop);
     Breakpoint *nextInDebugger();
     Breakpoint *nextInSite();
-    const EncapsulatedPtrObject &getHandler() const { return handler; }
-    EncapsulatedPtrObject &getHandlerRef() { return handler; }
+    const PreBarrieredObject &getHandler() const { return handler; }
+    PreBarrieredObject &getHandlerRef() { return handler; }
 };
 
 Breakpoint *
 Debugger::firstBreakpoint() const
 {
     if (JS_CLIST_IS_EMPTY(&breakpoints))
         return nullptr;
     return Breakpoint::fromDebuggerLinks(JS_NEXT_LINK(&breakpoints));
--- a/js/src/vm/ScopeObject.cpp
+++ b/js/src/vm/ScopeObject.cpp
@@ -1558,17 +1558,17 @@ js_IsDebugScopeSlow(ProxyObject *proxy)
     JS_ASSERT(proxy->hasClass(&ProxyObject::uncallableClass_));
     return proxy->handler() == &DebugScopeProxy::singleton;
 }
 
 /*****************************************************************************/
 
 /* static */ MOZ_ALWAYS_INLINE void
 DebugScopes::proxiedScopesPostWriteBarrier(JSRuntime *rt, ObjectWeakMap *map,
-                                           const EncapsulatedPtrObject &key)
+                                           const PreBarrieredObject &key)
 {
 #ifdef JSGC_GENERATIONAL
     /*
      * Strip the barriers from the type before inserting into the store buffer.
      * This will automatically ensure that barriers do not fire during GC.
      *
      * Some compilers complain about instantiating the WeakMap class for
      * unbarriered type arguments, so we cast to a HashMap instead.  Because of
--- a/js/src/vm/ScopeObject.h
+++ b/js/src/vm/ScopeObject.h
@@ -802,20 +802,20 @@ class DebugScopeObject : public ProxyObj
     /* Currently, the 'declarative' scopes are Call and Block. */
     bool isForDeclarative() const;
 };
 
 /* Maintains per-compartment debug scope bookkeeping information. */
 class DebugScopes
 {
     /* The map from (non-debug) scopes to debug scopes. */
-    typedef WeakMap<EncapsulatedPtrObject, RelocatablePtrObject> ObjectWeakMap;
+    typedef WeakMap<PreBarrieredObject, RelocatablePtrObject> ObjectWeakMap;
     ObjectWeakMap proxiedScopes;
     static MOZ_ALWAYS_INLINE void proxiedScopesPostWriteBarrier(JSRuntime *rt, ObjectWeakMap *map,
-                                                               const EncapsulatedPtrObject &key);
+                                                               const PreBarrieredObject &key);
 
     /*
      * The map from live frames which have optimized-away scopes to the
      * corresponding debug scopes.
      */
     typedef HashMap<ScopeIterKey,
                     ReadBarriered<DebugScopeObject>,
                     ScopeIterKey,
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -884,17 +884,17 @@ class Shape : public gc::BarrieredCell<S
     friend class js::ObjectImpl;
     friend class js::PropertyTree;
     friend class js::StaticBlockObject;
     friend struct js::StackShape;
     friend struct js::StackBaseShape;
 
   protected:
     HeapPtrBaseShape    base_;
-    EncapsulatedId      propid_;
+    PreBarrieredId      propid_;
 
     JS_ENUM_HEADER(SlotInfo, uint32_t)
     {
         /* Number of fixed slots in objects with this shape. */
         // FIXED_SLOTS_MAX is the biggest count of fixed slots a Shape can store
         FIXED_SLOTS_MAX        = 0x1f,
         FIXED_SLOTS_SHIFT      = 27,
         FIXED_SLOTS_MASK       = uint32_t(FIXED_SLOTS_MAX << FIXED_SLOTS_SHIFT),
@@ -1187,22 +1187,22 @@ class Shape : public gc::BarrieredCell<S
 
     void incrementNumLinearSearches() {
         uint32_t count = numLinearSearches();
         JS_ASSERT(count < LINEAR_SEARCHES_MAX);
         slotInfo = slotInfo & ~LINEAR_SEARCHES_MASK;
         slotInfo = slotInfo | ((count + 1) << LINEAR_SEARCHES_SHIFT);
     }
 
-    const EncapsulatedId &propid() const {
+    const PreBarrieredId &propid() const {
         JS_ASSERT(!isEmptyShape());
         JS_ASSERT(!JSID_IS_VOID(propid_));
         return propid_;
     }
-    EncapsulatedId &propidRef() { JS_ASSERT(!JSID_IS_VOID(propid_)); return propid_; }
+    PreBarrieredId &propidRef() { JS_ASSERT(!JSID_IS_VOID(propid_)); return propid_; }
     jsid propidRaw() const {
         // Return the actual jsid, not an internal reference.
         return propid();
     }
 
     uint8_t attributes() const { return attrs; }
     bool configurable() const { return (attrs & JSPROP_PERMANENT) == 0; }
     bool enumerable() const { return (attrs & JSPROP_ENUMERATE) != 0; }
--- a/js/src/vm/WeakMapObject.h
+++ b/js/src/vm/WeakMapObject.h
@@ -7,17 +7,17 @@
 #ifndef vm_WeakMapObject_h
 #define vm_WeakMapObject_h
 
 #include "jsobj.h"
 #include "jsweakmap.h"
 
 namespace js {
 
-typedef WeakMap<EncapsulatedPtrObject, RelocatableValue> ObjectValueMap;
+typedef WeakMap<PreBarrieredObject, RelocatableValue> ObjectValueMap;
 
 class WeakMapObject : public JSObject
 {
   public:
     static const Class class_;
 
     ObjectValueMap *getMap() { return static_cast<ObjectValueMap*>(getPrivate()); }
 };
--- a/js/src/vm/WeakMapPtr.cpp
+++ b/js/src/vm/WeakMapPtr.cpp
@@ -20,32 +20,32 @@ namespace {
 template<typename T>
 struct DataType
 {
 };
 
 template<>
 struct DataType<JSObject*>
 {
-    typedef EncapsulatedPtrObject Encapsulated;
+    typedef PreBarrieredObject PreBarriered;
     static JSObject *NullValue() { return nullptr; }
 };
 
 template<>
 struct DataType<JS::Value>
 {
-    typedef EncapsulatedValue Encapsulated;
+    typedef PreBarrieredValue PreBarriered;
     static JS::Value NullValue() { return JS::UndefinedValue(); }
 };
 
 template <typename K, typename V>
 struct Utils
 {
-    typedef typename DataType<K>::Encapsulated KeyType;
-    typedef typename DataType<V>::Encapsulated ValueType;
+    typedef typename DataType<K>::PreBarriered KeyType;
+    typedef typename DataType<V>::PreBarriered ValueType;
     typedef WeakMap<KeyType, ValueType> Type;
     typedef Type* PtrType;
     static PtrType cast(void *ptr) { return static_cast<PtrType>(ptr); }
 };
 
 } /* namespace */
 
 template <typename K, typename V>