Bug 1073842 - Rename NativeObject slots/elements to slots_/elements_, sr=luke.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 18 Oct 2014 10:51:50 -0700
changeset 211128 8c605fc7e0e1b6bc91c7b11f95bf475a9f169ef6
parent 211127 4fcf84dda2c9ba9a43f76254a15b3a1ad2d23947
child 211129 cf931893650a652c24f8bc447335df9e79c39107
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersluke
bugs1073842
milestone36.0a1
Bug 1073842 - Rename NativeObject slots/elements to slots_/elements_, sr=luke.
js/src/gc/ForkJoinNursery.cpp
js/src/gc/Marking.cpp
js/src/gc/Nursery.cpp
js/src/jsobj.cpp
js/src/jsobjinlines.h
js/src/vm/ArrayObject-inl.h
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.cpp
js/src/vm/NativeObject.h
js/src/vm/Runtime.cpp
--- a/js/src/gc/ForkJoinNursery.cpp
+++ b/js/src/gc/ForkJoinNursery.cpp
@@ -834,45 +834,45 @@ ForkJoinNursery::copyObjectToTospace(JSO
 
 size_t
 ForkJoinNursery::copySlotsToTospace(NativeObject *dst, NativeObject *src, AllocKind dstKind)
 {
     // Fixed slots have already been copied over.
     if (!src->hasDynamicSlots())
         return 0;
 
-    if (!isInsideFromspace(src->slots)) {
-        hugeSlots[hugeSlotsFrom].remove(src->slots);
+    if (!isInsideFromspace(src->slots_)) {
+        hugeSlots[hugeSlotsFrom].remove(src->slots_);
         if (!isEvacuating_)
-            hugeSlots[hugeSlotsNew].put(src->slots);
+            hugeSlots[hugeSlotsNew].put(src->slots_);
         return 0;
     }
 
     size_t count = src->numDynamicSlots();
-    dst->slots = allocateInTospace<HeapSlot>(count);
-    if (!dst->slots)
+    dst->slots_ = allocateInTospace<HeapSlot>(count);
+    if (!dst->slots_)
         CrashAtUnhandlableOOM("Failed to allocate slots while moving object.");
-    js_memcpy(dst->slots, src->slots, count * sizeof(HeapSlot));
-    setSlotsForwardingPointer(src->slots, dst->slots, count);
+    js_memcpy(dst->slots_, src->slots_, count * sizeof(HeapSlot));
+    setSlotsForwardingPointer(src->slots_, dst->slots_, count);
     return count * sizeof(HeapSlot);
 }
 
 size_t
 ForkJoinNursery::copyElementsToTospace(NativeObject *dst, NativeObject *src, AllocKind dstKind)
 {
     if (src->hasEmptyElements() || src->denseElementsAreCopyOnWrite())
         return 0;
 
     ObjectElements *srcHeader = src->getElementsHeader();
     ObjectElements *dstHeader;
 
     // TODO Bug 874151: Prefer to put element data inline if we have space.
     // (Note, not a correctness issue.)
     if (!isInsideFromspace(srcHeader)) {
-        MOZ_ASSERT(src->elements == dst->elements);
+        MOZ_ASSERT(src->elements_ == dst->elements_);
         hugeSlots[hugeSlotsFrom].remove(reinterpret_cast<HeapSlot*>(srcHeader));
         if (!isEvacuating_)
             hugeSlots[hugeSlotsNew].put(reinterpret_cast<HeapSlot*>(srcHeader));
         return 0;
     }
 
     size_t nslots = ObjectElements::VALUES_PER_HEADER + srcHeader->capacity;
 
@@ -886,17 +886,17 @@ ForkJoinNursery::copyElementsToTospace(N
     }
 
     MOZ_ASSERT(nslots >= 2);
     dstHeader = reinterpret_cast<ObjectElements *>(allocateInTospace<HeapSlot>(nslots));
     if (!dstHeader)
         CrashAtUnhandlableOOM("Failed to allocate elements while moving object.");
     js_memcpy(dstHeader, srcHeader, nslots * sizeof(HeapSlot));
     setElementsForwardingPointer(srcHeader, dstHeader, nslots);
-    dst->elements = dstHeader->elements();
+    dst->elements_ = dstHeader->elements();
     return nslots * sizeof(HeapSlot);
 }
 
 void
 ForkJoinNursery::setSlotsForwardingPointer(HeapSlot *oldSlots, HeapSlot *newSlots, uint32_t nslots)
 {
     MOZ_ASSERT(nslots > 0);
     MOZ_ASSERT(isInsideFromspace(oldSlots));
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -1626,19 +1626,19 @@ GCMarker::saveValueRanges()
                 HeapSlot *vp = obj->fixedSlots();
                 unsigned nfixed = obj->numFixedSlots();
                 if (arr->start == arr->end) {
                     arr->index = obj->slotSpan();
                 } else if (arr->start >= vp && arr->start < vp + nfixed) {
                     MOZ_ASSERT(arr->end == vp + Min(nfixed, obj->slotSpan()));
                     arr->index = arr->start - vp;
                 } else {
-                    MOZ_ASSERT(arr->start >= obj->slots &&
-                               arr->end == obj->slots + obj->slotSpan() - nfixed);
-                    arr->index = (arr->start - obj->slots) + nfixed;
+                    MOZ_ASSERT(arr->start >= obj->slots_ &&
+                               arr->end == obj->slots_ + obj->slotSpan() - nfixed);
+                    arr->index = (arr->start - obj->slots_) + nfixed;
                 }
                 arr->kind = HeapSlot::Slot;
             }
             p[2] |= SavedValueArrayTag;
         } else if (tag == SavedValueArrayTag) {
             p -= 2;
         }
     }
@@ -1668,18 +1668,18 @@ GCMarker::restoreValueArray(NativeObject
         HeapSlot *vp = obj->fixedSlots();
         unsigned nfixed = obj->numFixedSlots();
         unsigned nslots = obj->slotSpan();
         if (start < nslots) {
             if (start < nfixed) {
                 *vpp = vp + start;
                 *endp = vp + Min(nfixed, nslots);
             } else {
-                *vpp = obj->slots + start - nfixed;
-                *endp = obj->slots + nslots - nfixed;
+                *vpp = obj->slots_ + start - nfixed;
+                *endp = obj->slots_ + nslots - nfixed;
             }
         } else {
             /* The object shrunk, in which case no scanning is needed. */
             *vpp = *endp = vp;
         }
     }
 
     MOZ_ASSERT(*vpp <= *endp);
@@ -1825,21 +1825,21 @@ GCMarker::processMarkStackTop(SliceBudge
             vp = nobj->getDenseElementsAllowCopyOnWrite();
             end = vp + nobj->getDenseInitializedLength();
             if (!nslots)
                 goto scan_value_array;
             pushValueArray(nobj, vp, end);
         } while (false);
 
         vp = nobj->fixedSlots();
-        if (nobj->slots) {
+        if (nobj->slots_) {
             unsigned nfixed = nobj->numFixedSlots();
             if (nslots > nfixed) {
                 pushValueArray(nobj, vp, vp + nfixed);
-                vp = nobj->slots;
+                vp = nobj->slots_;
                 end = vp + (nslots - nfixed);
                 goto scan_value_array;
             }
         }
         MOZ_ASSERT(nslots <= nobj->numFixedSlots());
         end = vp + nslots;
         goto scan_value_array;
     }
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -662,44 +662,44 @@ js::Nursery::forwardTypedArrayPointers(T
 
 MOZ_ALWAYS_INLINE size_t
 js::Nursery::moveSlotsToTenured(NativeObject *dst, NativeObject *src, AllocKind dstKind)
 {
     /* Fixed slots have already been copied over. */
     if (!src->hasDynamicSlots())
         return 0;
 
-    if (!isInside(src->slots)) {
-        hugeSlots.remove(src->slots);
+    if (!isInside(src->slots_)) {
+        hugeSlots.remove(src->slots_);
         return 0;
     }
 
     Zone *zone = src->zone();
     size_t count = src->numDynamicSlots();
-    dst->slots = zone->pod_malloc<HeapSlot>(count);
-    if (!dst->slots)
+    dst->slots_ = zone->pod_malloc<HeapSlot>(count);
+    if (!dst->slots_)
         CrashAtUnhandlableOOM("Failed to allocate slots while tenuring.");
-    PodCopy(dst->slots, src->slots, count);
-    setSlotsForwardingPointer(src->slots, dst->slots, count);
+    PodCopy(dst->slots_, src->slots_, count);
+    setSlotsForwardingPointer(src->slots_, dst->slots_, count);
     return count * sizeof(HeapSlot);
 }
 
 MOZ_ALWAYS_INLINE size_t
 js::Nursery::moveElementsToTenured(NativeObject *dst, NativeObject *src, AllocKind dstKind)
 {
     if (src->hasEmptyElements() || src->denseElementsAreCopyOnWrite())
         return 0;
 
     Zone *zone = src->zone();
     ObjectElements *srcHeader = src->getElementsHeader();
     ObjectElements *dstHeader;
 
     /* TODO Bug 874151: Prefer to put element data inline if we have space. */
     if (!isInside(srcHeader)) {
-        MOZ_ASSERT(src->elements == dst->elements);
+        MOZ_ASSERT(src->elements_ == dst->elements_);
         hugeSlots.remove(reinterpret_cast<HeapSlot*>(srcHeader));
         return 0;
     }
 
     size_t nslots = ObjectElements::VALUES_PER_HEADER + srcHeader->capacity;
 
     /* Unlike other objects, Arrays can have fixed elements. */
     if (src->is<ArrayObject>() && nslots <= GetGCKindSlots(dstKind)) {
@@ -711,17 +711,17 @@ js::Nursery::moveElementsToTenured(Nativ
     }
 
     MOZ_ASSERT(nslots >= 2);
     dstHeader = reinterpret_cast<ObjectElements *>(zone->pod_malloc<HeapSlot>(nslots));
     if (!dstHeader)
         CrashAtUnhandlableOOM("Failed to allocate elements while tenuring.");
     js_memcpy(dstHeader, srcHeader, nslots * sizeof(HeapSlot));
     setElementsForwardingPointer(srcHeader, dstHeader, nslots);
-    dst->elements = dstHeader->elements();
+    dst->elements_ = dstHeader->elements();
     return nslots * sizeof(HeapSlot);
 }
 
 static bool
 ShouldMoveToTenured(MinorCollectionTracer *trc, void **thingp)
 {
     Cell *cell = static_cast<Cell *>(*thingp);
     Nursery &nursery = *trc->nursery;
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -2356,26 +2356,26 @@ NativeObject::fillInAfterSwap(JSContext 
         shape_->setNumFixedSlots(nfixed);
     }
 
     if (hasPrivate())
         setPrivate(priv);
     else
         MOZ_ASSERT(!priv);
 
-    if (slots) {
-        js_free(slots);
-        slots = nullptr;
+    if (slots_) {
+        js_free(slots_);
+        slots_ = nullptr;
     }
 
     if (size_t ndynamic = dynamicSlotsCount(nfixed, values.length(), getClass())) {
-        slots = cx->zone()->pod_malloc<HeapSlot>(ndynamic);
-        if (!slots)
+        slots_ = cx->zone()->pod_malloc<HeapSlot>(ndynamic);
+        if (!slots_)
             CrashAtUnhandlableOOM("fillInAfterSwap");
-        Debug_SetSlotRangeToCrashOnTouch(slots, ndynamic);
+        Debug_SetSlotRangeToCrashOnTouch(slots_, ndynamic);
     }
 
     initSlotRange(0, values.begin(), values.length());
 }
 
 /* Use this method with extreme caution. It trades the guts of two objects. */
 bool
 JSObject::swap(JSContext *cx, HandleObject a, HandleObject b)
@@ -2740,17 +2740,17 @@ JSObject::fixupAfterMovingGC()
      * itself if it points to inline elements in another object.
      */
     if (is<NativeObject>() && as<NativeObject>().hasDynamicElements()) {
         ObjectElements *header = as<NativeObject>().getElementsHeader();
         if (header->isCopyOnWrite()) {
             HeapPtrNativeObject &owner = header->ownerObject();
             if (IsForwarded(owner.get()))
                 owner = Forwarded(owner.get());
-            as<NativeObject>().elements = owner->getElementsHeader()->elements();
+            as<NativeObject>().elements_ = owner->getElementsHeader()->elements();
         }
     }
 }
 
 bool
 js::SetClassAndProto(JSContext *cx, HandleObject obj,
                      const Class *clasp, Handle<js::TaggedProto> proto)
 {
@@ -4139,17 +4139,17 @@ js_DumpBacktrace(JSContext *cx)
     }
     fprintf(stdout, "%s", sprinter.string());
 }
 
 void
 JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ClassInfo *info)
 {
     if (is<NativeObject>() && as<NativeObject>().hasDynamicSlots())
-        info->objectsMallocHeapSlots += mallocSizeOf(as<NativeObject>().slots);
+        info->objectsMallocHeapSlots += mallocSizeOf(as<NativeObject>().slots_);
 
     if (is<NativeObject>() && as<NativeObject>().hasDynamicElements()) {
         js::ObjectElements *elements = as<NativeObject>().getElementsHeader();
         if (!elements->isCopyOnWrite() || elements->ownerObject() == this)
             info->objectsMallocHeapElementsNonAsmJS += mallocSizeOf(elements);
     }
 
     // Other things may be measured in the future if DMD indicates it is worthwhile.
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -89,17 +89,17 @@ JSObject::finalize(js::FreeOp *fop)
         clasp->finalize(fop, this);
 
     if (!clasp->isNative())
         return;
 
     js::NativeObject *nobj = &as<js::NativeObject>();
 
     if (nobj->hasDynamicSlots())
-        fop->free_(nobj->slots);
+        fop->free_(nobj->slots_);
 
     if (nobj->hasDynamicElements()) {
         js::ObjectElements *elements = nobj->getElementsHeader();
         if (elements->isCopyOnWrite()) {
             if (elements->ownerObject() == this) {
                 // Don't free the elements until object finalization finishes,
                 // so that other objects can access these elements while they
                 // are themselves finalized.
@@ -333,23 +333,23 @@ JSObject::create(js::ExclusiveContext *c
     js::gc::TraceCreateObject(obj);
 
     return obj;
 }
 
 inline void
 JSObject::setInitialSlotsMaybeNonNative(js::HeapSlot *slots)
 {
-    static_cast<js::NativeObject *>(this)->slots = slots;
+    static_cast<js::NativeObject *>(this)->slots_ = slots;
 }
 
 inline void
 JSObject::setInitialElementsMaybeNonNative(js::HeapSlot *elements)
 {
-    static_cast<js::NativeObject *>(this)->elements = elements;
+    static_cast<js::NativeObject *>(this)->elements_ = elements;
 }
 
 /* static */ inline bool
 JSObject::hasProperty(JSContext *cx, js::HandleObject obj,
                       js::HandleId id, bool *foundp)
 {
     JS::RootedObject pobj(cx);
     js::RootedShape prop(cx);
--- a/js/src/vm/ArrayObject-inl.h
+++ b/js/src/vm/ArrayObject-inl.h
@@ -91,17 +91,17 @@ ArrayObject::createArray(ExclusiveContex
     // fixed slots (see the assert in createArrayInternal) and will not be using
     // its fixed elements.
     gc::AllocKind kind = gc::FINALIZE_OBJECT0_BACKGROUND;
 
     ArrayObject *obj = createArrayInternal(cx, kind, heap, shape, type);
     if (!obj)
         return nullptr;
 
-    obj->elements = elements;
+    obj->elements_ = elements;
 
     return finishCreateArray(obj, shape);
 }
 
 /* static */ inline ArrayObject *
 ArrayObject::createCopyOnWriteArray(ExclusiveContext *cx, gc::InitialHeap heap,
                                     HandleShape shape,
                                     HandleNativeObject sharedElementsOwner)
@@ -114,16 +114,16 @@ ArrayObject::createCopyOnWriteArray(Excl
     // its fixed elements.
     gc::AllocKind kind = gc::FINALIZE_OBJECT0_BACKGROUND;
 
     RootedTypeObject type(cx, sharedElementsOwner->type());
     ArrayObject *obj = createArrayInternal(cx, kind, heap, shape, type);
     if (!obj)
         return nullptr;
 
-    obj->elements = sharedElementsOwner->getDenseElementsAllowCopyOnWrite();
+    obj->elements_ = sharedElementsOwner->getDenseElementsAllowCopyOnWrite();
 
     return finishCreateArray(obj, shape);
 }
 
 } // namespace js
 
 #endif // vm_ArrayObject_inl_h
--- a/js/src/vm/NativeObject-inl.h
+++ b/js/src/vm/NativeObject-inl.h
@@ -87,17 +87,17 @@ NativeObject::setDenseElementIfHasType(u
 
 inline void
 NativeObject::setDenseElementWithType(ExclusiveContext *cx, uint32_t index,
                                       const Value &val)
 {
     // Avoid a slow AddTypePropertyId call if the type is the same as the type
     // of the previous element.
     types::Type thisType = types::GetValueType(val);
-    if (index == 0 || types::GetValueType(elements[index - 1]) != thisType)
+    if (index == 0 || types::GetValueType(elements_[index - 1]) != thisType)
         types::AddTypePropertyId(cx, this, JSID_VOID, thisType);
     setDenseElementMaybeConvertDouble(index, val);
 }
 
 inline void
 NativeObject::initDenseElementWithType(ExclusiveContext *cx, uint32_t index,
                                        const Value &val)
 {
@@ -149,18 +149,18 @@ NativeObject::ensureDenseInitializedLeng
      * mark the elements through 'index + extra' as initialized in preparation
      * for a write.
      */
     MOZ_ASSERT(index + extra <= getDenseCapacity());
     uint32_t &initlen = getElementsHeader()->initializedLength;
 
     if (initlen < index + extra) {
         size_t offset = initlen;
-        for (HeapSlot *sp = elements + initlen;
-             sp != elements + (index + extra);
+        for (HeapSlot *sp = elements_ + initlen;
+             sp != elements_ + (index + extra);
              sp++, offset++)
         {
             sp->init(this, HeapSlot::Element, offset, MagicValue(JS_ELEMENTS_HOLE));
         }
         initlen = index + extra;
     }
 }
 
@@ -303,17 +303,17 @@ NativeObject::initDenseElementsUnbarrier
      */
     MOZ_ASSERT(!gc::IsInsideGGCNursery(this));
     for (uint32_t index = 0; index < count; ++index) {
         const Value& value = src[index];
         if (value.isMarkable())
             MOZ_ASSERT(!gc::IsInsideGGCNursery(static_cast<gc::Cell *>(value.toGCThing())));
     }
 #endif
-    memcpy(&elements[dstStart], src, count * sizeof(HeapSlot));
+    memcpy(&elements_[dstStart], src, count * sizeof(HeapSlot));
 }
 
 /* static */ inline NativeObject *
 NativeObject::copy(ExclusiveContext *cx, gc::AllocKind kind, gc::InitialHeap heap,
                    HandleNativeObject templateObject)
 {
     RootedShape shape(cx, templateObject->lastProperty());
     RootedTypeObject type(cx, templateObject->type());
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -444,30 +444,30 @@ NativeObject::growSlots(ThreadSafeContex
     /*
      * Slot capacities are determined by the span of allocated objects. Due to
      * the limited number of bits to store shape slots, object growth is
      * throttled well before the slot capacity can overflow.
      */
     MOZ_ASSERT(newCount < NELEMENTS_LIMIT);
 
     if (!oldCount) {
-        obj->slots = AllocateSlots(cx, obj, newCount);
-        if (!obj->slots)
+        obj->slots_ = AllocateSlots(cx, obj, newCount);
+        if (!obj->slots_)
             return false;
-        Debug_SetSlotRangeToCrashOnTouch(obj->slots, newCount);
+        Debug_SetSlotRangeToCrashOnTouch(obj->slots_, newCount);
         return true;
     }
 
-    HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots, oldCount, newCount);
+    HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots_, oldCount, newCount);
     if (!newslots)
         return false;  /* Leave slots at its old size. */
 
-    obj->slots = newslots;
+    obj->slots_ = newslots;
 
-    Debug_SetSlotRangeToCrashOnTouch(obj->slots + oldCount, newCount - oldCount);
+    Debug_SetSlotRangeToCrashOnTouch(obj->slots_ + oldCount, newCount - oldCount);
 
     return true;
 }
 
 static void
 FreeSlots(ThreadSafeContext *cx, HeapSlot *slots)
 {
 #ifdef JSGC_GENERATIONAL
@@ -485,28 +485,28 @@ FreeSlots(ThreadSafeContext *cx, HeapSlo
 /* static */ void
 NativeObject::shrinkSlots(ThreadSafeContext *cx, HandleNativeObject obj,
                           uint32_t oldCount, uint32_t newCount)
 {
     MOZ_ASSERT(cx->isThreadLocal(obj));
     MOZ_ASSERT(newCount < oldCount);
 
     if (newCount == 0) {
-        FreeSlots(cx, obj->slots);
-        obj->slots = nullptr;
+        FreeSlots(cx, obj->slots_);
+        obj->slots_ = nullptr;
         return;
     }
 
     MOZ_ASSERT_IF(!obj->is<ArrayObject>(), newCount >= SLOT_CAPACITY_MIN);
 
-    HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots, oldCount, newCount);
+    HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots_, oldCount, newCount);
     if (!newslots)
         return;  /* Leave slots at its old size. */
 
-    obj->slots = newslots;
+    obj->slots_ = newslots;
 }
 
 /* static */ bool
 NativeObject::sparsifyDenseElement(ExclusiveContext *cx, HandleNativeObject obj, uint32_t index)
 {
     if (!obj->maybeCopyElementsForWrite(cx))
         return false;
 
@@ -882,19 +882,19 @@ NativeObject::growElements(ThreadSafeCon
         newheader = AllocateElements(cx, this, newAllocated);
         if (!newheader)
             return false;   // Leave elements at its old size.
         js_memcpy(newheader, getElementsHeader(),
                   (ObjectElements::VALUES_PER_HEADER + initlen) * sizeof(Value));
     }
 
     newheader->capacity = newCapacity;
-    elements = newheader->elements();
+    elements_ = newheader->elements();
 
-    Debug_SetSlotRangeToCrashOnTouch(elements + initlen, newCapacity - initlen);
+    Debug_SetSlotRangeToCrashOnTouch(elements_ + initlen, newCapacity - initlen);
 
     return true;
 }
 
 void
 NativeObject::shrinkElements(ThreadSafeContext *cx, uint32_t reqCapacity)
 {
     MOZ_ASSERT(cx->isThreadLocal(this));
@@ -920,17 +920,17 @@ NativeObject::shrinkElements(ThreadSafeC
     ObjectElements *newheader = ReallocateElements(cx, this, getElementsHeader(),
                                                    oldAllocated, newAllocated);
     if (!newheader) {
         cx->recoverFromOutOfMemory();
         return;  // Leave elements at its old size.
     }
 
     newheader->capacity = newCapacity;
-    elements = newheader->elements();
+    elements_ = newheader->elements();
 }
 
 /* static */ bool
 NativeObject::CopyElementsForWrite(ThreadSafeContext *cx, NativeObject *obj)
 {
     MOZ_ASSERT(obj->denseElementsAreCopyOnWrite());
 
     // The original owner of a COW elements array should never be modified.
@@ -950,19 +950,19 @@ NativeObject::CopyElementsForWrite(Threa
     ObjectElements *newheader = AllocateElements(cx, obj, newAllocated);
     if (!newheader)
         return false;
     js_memcpy(newheader, obj->getElementsHeader(),
               (ObjectElements::VALUES_PER_HEADER + initlen) * sizeof(Value));
 
     newheader->capacity = newCapacity;
     newheader->clearCopyOnWrite();
-    obj->elements = newheader->elements();
+    obj->elements_ = newheader->elements();
 
-    Debug_SetSlotRangeToCrashOnTouch(obj->elements + initlen, newCapacity - initlen);
+    Debug_SetSlotRangeToCrashOnTouch(obj->elements_ + initlen, newCapacity - initlen);
 
     return true;
 }
 
 /* static */ bool
 NativeObject::allocSlot(ThreadSafeContext *cx, HandleNativeObject obj, uint32_t *slotp)
 {
     MOZ_ASSERT(cx->isThreadLocal(obj));
--- a/js/src/vm/NativeObject.h
+++ b/js/src/vm/NativeObject.h
@@ -333,34 +333,34 @@ DenseRangeWriteBarrierPost(JSRuntime *rt
  *
  * Two native objects with the same shape are guaranteed to have the same
  * number of fixed slots.
  *
  * Named property storage can be split between fixed slots and a dynamically
  * allocated array (the slots member). For an object with N fixed slots, shapes
  * with slots [0..N-1] are stored in the fixed slots, and the remainder are
  * stored in the dynamic array. If all properties fit in the fixed slots, the
- * 'slots' member is nullptr.
+ * 'slots_' member is nullptr.
  *
- * Elements are indexed via the 'elements' member. This member can point to
+ * Elements are indexed via the 'elements_' member. This member can point to
  * either the shared emptyObjectElements singleton, into the inline value array
  * (the address of the third value, to leave room for a ObjectElements header;
  * in this case numFixedSlots() is zero) or to a dynamically allocated array.
  *
  * Slots and elements may both be non-empty. The slots may be either names or
  * indexes; no indexed property will be in both the slots and elements.
  */
 class NativeObject : public JSObject
 {
   protected:
     /* Slots for object properties. */
-    js::HeapSlot *slots;
+    js::HeapSlot *slots_;
 
     /* Slots for object dense elements. */
-    js::HeapSlot *elements;
+    js::HeapSlot *elements_;
 
     friend bool
     ArraySetLength(JSContext *cx, Handle<ArrayObject*> obj, HandleId id, unsigned attrs,
                    HandleValue value, bool setterIsStrict);
 
     friend class ::JSObject;
 
   private:
@@ -371,39 +371,39 @@ class NativeObject : public JSObject
                       "shadow interface must match actual implementation");
         static_assert(sizeof(NativeObject) % sizeof(Value) == 0,
                       "fixed slots after an object must be aligned");
 
         static_assert(offsetof(NativeObject, shape_) == offsetof(shadow::Object, shape),
                       "shadow shape must match actual shape");
         static_assert(offsetof(NativeObject, type_) == offsetof(shadow::Object, type),
                       "shadow type must match actual type");
-        static_assert(offsetof(NativeObject, slots) == offsetof(shadow::Object, slots),
+        static_assert(offsetof(NativeObject, slots_) == offsetof(shadow::Object, slots),
                       "shadow slots must match actual slots");
-        static_assert(offsetof(NativeObject, elements) == offsetof(shadow::Object, _1),
+        static_assert(offsetof(NativeObject, elements_) == offsetof(shadow::Object, _1),
                       "shadow placeholder must match actual elements");
 
         static_assert(MAX_FIXED_SLOTS <= Shape::FIXED_SLOTS_MAX,
                       "verify numFixedSlots() bitfield is big enough");
     }
 
   public:
     HeapSlotArray getDenseElements() {
-        return HeapSlotArray(elements, !getElementsHeader()->isCopyOnWrite());
+        return HeapSlotArray(elements_, !getElementsHeader()->isCopyOnWrite());
     }
     HeapSlotArray getDenseElementsAllowCopyOnWrite() {
         // Backdoor allowing direct access to copy on write elements.
-        return HeapSlotArray(elements, true);
+        return HeapSlotArray(elements_, true);
     }
     const Value &getDenseElement(uint32_t idx) {
         MOZ_ASSERT(idx < getDenseInitializedLength());
-        return elements[idx];
+        return elements_[idx];
     }
     bool containsDenseElement(uint32_t idx) {
-        return idx < getDenseInitializedLength() && !elements[idx].isMagic(JS_ELEMENTS_HOLE);
+        return idx < getDenseInitializedLength() && !elements_[idx].isMagic(JS_ELEMENTS_HOLE);
     }
     uint32_t getDenseInitializedLength() {
         return getElementsHeader()->initializedLength;
     }
     uint32_t getDenseCapacity() {
         return getElementsHeader()->capacity;
     }
 
@@ -467,23 +467,23 @@ class NativeObject : public JSObject
             if (start + length < fixed) {
                 *fixedStart = &fixedSlots()[start];
                 *fixedEnd = &fixedSlots()[start + length];
                 *slotsStart = *slotsEnd = nullptr;
             } else {
                 uint32_t localCopy = fixed - start;
                 *fixedStart = &fixedSlots()[start];
                 *fixedEnd = &fixedSlots()[start + localCopy];
-                *slotsStart = &slots[0];
-                *slotsEnd = &slots[length - localCopy];
+                *slotsStart = &slots_[0];
+                *slotsEnd = &slots_[length - localCopy];
             }
         } else {
             *fixedStart = *fixedEnd = nullptr;
-            *slotsStart = &slots[start - fixed];
-            *slotsEnd = &slots[start - fixed + length];
+            *slotsStart = &slots_[start - fixed];
+            *slotsEnd = &slots_[start - fixed + length];
         }
     }
 
     void getSlotRange(uint32_t start, uint32_t length,
                       HeapSlot **fixedStart, HeapSlot **fixedEnd,
                       HeapSlot **slotsStart, HeapSlot **slotsEnd)
     {
         MOZ_ASSERT(slotInRange(start + length, SENTINEL_ALLOWED));
@@ -580,17 +580,17 @@ class NativeObject : public JSObject
      * The number of allocated slots is not stored explicitly, and changes to
      * the slots must track changes in the slot span.
      */
     static bool growSlots(ThreadSafeContext *cx, HandleNativeObject obj, uint32_t oldCount,
                           uint32_t newCount);
     static void shrinkSlots(ThreadSafeContext *cx, HandleNativeObject obj, uint32_t oldCount,
                             uint32_t newCount);
 
-    bool hasDynamicSlots() const { return !!slots; }
+    bool hasDynamicSlots() const { return !!slots_; }
 
     /* Compute dynamicSlotsCount() for this object. */
     uint32_t numDynamicSlots() const {
         return dynamicSlotsCount(numFixedSlots(), slotSpan(), getClass());
     }
 
     bool empty() const {
         return lastProperty()->isEmptyShape();
@@ -730,31 +730,31 @@ class NativeObject : public JSObject
         return lastProperty()->inDictionary();
     }
 
     const Value &getSlot(uint32_t slot) const {
         MOZ_ASSERT(slotInRange(slot));
         uint32_t fixed = numFixedSlots();
         if (slot < fixed)
             return fixedSlots()[slot];
-        return slots[slot - fixed];
+        return slots_[slot - fixed];
     }
 
     const HeapSlot *getSlotAddressUnchecked(uint32_t slot) const {
         uint32_t fixed = numFixedSlots();
         if (slot < fixed)
             return fixedSlots() + slot;
-        return slots + (slot - fixed);
+        return slots_ + (slot - fixed);
     }
 
     HeapSlot *getSlotAddressUnchecked(uint32_t slot) {
         uint32_t fixed = numFixedSlots();
         if (slot < fixed)
             return fixedSlots() + slot;
-        return slots + (slot - fixed);
+        return slots_ + (slot - fixed);
     }
 
     HeapSlot *getSlotAddress(uint32_t slot) {
         /*
          * This can be used to get the address of the end of the slots for the
          * object, which may be necessary when fetching zero-length arrays of
          * slots (e.g. for callObjVarArray).
          */
@@ -816,17 +816,17 @@ class NativeObject : public JSObject
         for (size_t i = start; i < end; i++)
             getSlotAddressUnchecked(i)->HeapSlot::~HeapSlot();
     }
 
     void prepareElementRangeForOverwrite(size_t start, size_t end) {
         MOZ_ASSERT(end <= getDenseInitializedLength());
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
         for (size_t i = start; i < end; i++)
-            elements[i].HeapSlot::~HeapSlot();
+            elements_[i].HeapSlot::~HeapSlot();
     }
 
     static bool rollbackProperties(ExclusiveContext *cx, HandleNativeObject obj,
                                    uint32_t slotSpan);
 
     inline bool setSlotIfHasType(Shape *shape, const Value &value,
                                  bool overwriting = true);
     inline void setSlotWithType(ExclusiveContext *cx, Shape *shape,
@@ -888,33 +888,33 @@ class NativeObject : public JSObject
     static uint32_t dynamicSlotsCount(uint32_t nfixed, uint32_t span, const Class *clasp);
 
     /* Elements accessors. */
 
     /* Upper bound on the number of elements in an object. */
     static const uint32_t NELEMENTS_LIMIT = JS_BIT(28);
 
     ObjectElements * getElementsHeader() const {
-        return ObjectElements::fromElements(elements);
+        return ObjectElements::fromElements(elements_);
     }
 
     /* Accessors for elements. */
     bool ensureElements(ThreadSafeContext *cx, uint32_t capacity) {
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
         if (capacity > getDenseCapacity())
             return growElements(cx, capacity);
         return true;
     }
 
     static uint32_t goodAllocated(uint32_t n, uint32_t length);
     bool growElements(ThreadSafeContext *cx, uint32_t newcap);
     void shrinkElements(ThreadSafeContext *cx, uint32_t cap);
     void setDynamicElements(ObjectElements *header) {
         MOZ_ASSERT(!hasDynamicElements());
-        elements = header->elements();
+        elements_ = header->elements();
         MOZ_ASSERT(hasDynamicElements());
     }
 
     static bool CopyElementsForWrite(ThreadSafeContext *cx, NativeObject *obj);
 
     bool maybeCopyElementsForWrite(ThreadSafeContext *cx) {
         if (denseElementsAreCopyOnWrite())
             return CopyElementsForWrite(cx, this);
@@ -935,23 +935,23 @@ class NativeObject : public JSObject
 
     inline void ensureDenseInitializedLength(ExclusiveContext *cx,
                                              uint32_t index, uint32_t extra);
     inline void ensureDenseInitializedLengthPreservePackedFlag(ThreadSafeContext *cx,
                                                                uint32_t index, uint32_t extra);
     void setDenseElement(uint32_t index, const Value &val) {
         MOZ_ASSERT(index < getDenseInitializedLength());
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
-        elements[index].set(this, HeapSlot::Element, index, val);
+        elements_[index].set(this, HeapSlot::Element, index, val);
     }
 
     void initDenseElement(uint32_t index, const Value &val) {
         MOZ_ASSERT(index < getDenseInitializedLength());
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
-        elements[index].init(this, HeapSlot::Element, index, val);
+        elements_[index].init(this, HeapSlot::Element, index, val);
     }
 
     void setDenseElementMaybeConvertDouble(uint32_t index, const Value &val) {
         if (val.isInt32() && shouldConvertDoubleElements())
             setDenseElement(index, DoubleValue(val.toInt32()));
         else
             setDenseElement(index, val);
     }
@@ -969,27 +969,27 @@ class NativeObject : public JSObject
 
     void copyDenseElements(uint32_t dstStart, const Value *src, uint32_t count) {
         MOZ_ASSERT(dstStart + count <= getDenseCapacity());
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
         JSRuntime *rt = runtimeFromMainThread();
         if (JS::IsIncrementalBarrierNeeded(rt)) {
             Zone *zone = this->zone();
             for (uint32_t i = 0; i < count; ++i)
-                elements[dstStart + i].set(zone, this, HeapSlot::Element, dstStart + i, src[i]);
+                elements_[dstStart + i].set(zone, this, HeapSlot::Element, dstStart + i, src[i]);
         } else {
-            memcpy(&elements[dstStart], src, count * sizeof(HeapSlot));
+            memcpy(&elements_[dstStart], src, count * sizeof(HeapSlot));
             DenseRangeWriteBarrierPost(rt, this, dstStart, count);
         }
     }
 
     void initDenseElements(uint32_t dstStart, const Value *src, uint32_t count) {
         MOZ_ASSERT(dstStart + count <= getDenseCapacity());
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
-        memcpy(&elements[dstStart], src, count * sizeof(HeapSlot));
+        memcpy(&elements_[dstStart], src, count * sizeof(HeapSlot));
         DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
     }
 
     void initDenseElementsUnbarriered(uint32_t dstStart, const Value *src, uint32_t count);
 
     void moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count) {
         MOZ_ASSERT(dstStart + count <= getDenseCapacity());
         MOZ_ASSERT(srcStart + count <= getDenseInitializedLength());
@@ -1006,40 +1006,40 @@ class NativeObject : public JSObject
          * 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.
         */
         Zone *zone = this->zone();
         JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone);
         if (shadowZone->needsIncrementalBarrier()) {
             if (dstStart < srcStart) {
-                HeapSlot *dst = elements + dstStart;
-                HeapSlot *src = elements + srcStart;
+                HeapSlot *dst = elements_ + dstStart;
+                HeapSlot *src = elements_ + srcStart;
                 for (uint32_t i = 0; i < count; i++, dst++, src++)
-                    dst->set(zone, this, HeapSlot::Element, dst - elements, *src);
+                    dst->set(zone, this, HeapSlot::Element, dst - elements_, *src);
             } else {
-                HeapSlot *dst = elements + dstStart + count - 1;
-                HeapSlot *src = elements + srcStart + count - 1;
+                HeapSlot *dst = elements_ + dstStart + count - 1;
+                HeapSlot *src = elements_ + srcStart + count - 1;
                 for (uint32_t i = 0; i < count; i++, dst--, src--)
-                    dst->set(zone, this, HeapSlot::Element, dst - elements, *src);
+                    dst->set(zone, this, HeapSlot::Element, dst - elements_, *src);
             }
         } else {
-            memmove(elements + dstStart, elements + srcStart, count * sizeof(HeapSlot));
+            memmove(elements_ + dstStart, elements_ + srcStart, count * sizeof(HeapSlot));
             DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
         }
     }
 
     void moveDenseElementsNoPreBarrier(uint32_t dstStart, uint32_t srcStart, uint32_t count) {
         MOZ_ASSERT(!shadowZone()->needsIncrementalBarrier());
 
         MOZ_ASSERT(dstStart + count <= getDenseCapacity());
         MOZ_ASSERT(srcStart + count <= getDenseCapacity());
         MOZ_ASSERT(!denseElementsAreCopyOnWrite());
 
-        memmove(elements + dstStart, elements + srcStart, count * sizeof(Value));
+        memmove(elements_ + dstStart, elements_ + srcStart, count * sizeof(Value));
         DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
     }
 
     bool shouldConvertDoubleElements() {
         return getElementsHeader()->shouldConvertDoubleElements();
     }
 
     inline void setShouldConvertDoubleElements();
@@ -1112,36 +1112,36 @@ class NativeObject : public JSObject
     }
 
 #ifdef DEBUG
     bool canHaveNonEmptyElements();
 #endif
 
     void setFixedElements() {
         MOZ_ASSERT(canHaveNonEmptyElements());
-        this->elements = fixedElements();
+        elements_ = fixedElements();
     }
 
     inline bool hasDynamicElements() const {
         /*
          * Note: for objects with zero fixed slots this could potentially give
          * a spurious 'true' result, if the end of this object is exactly
          * aligned with the end of its arena and dynamic slots are allocated
          * immediately afterwards. Such cases cannot occur for dense arrays
          * (which have at least two fixed slots) and can only result in a leak.
          */
-        return !hasEmptyElements() && elements != fixedElements();
+        return !hasEmptyElements() && elements_ != fixedElements();
     }
 
     inline bool hasFixedElements() const {
-        return elements == fixedElements();
+        return elements_ == fixedElements();
     }
 
     inline bool hasEmptyElements() const {
-        return elements == emptyObjectElements;
+        return elements_ == emptyObjectElements;
     }
 
     /*
      * Get a pointer to the unused data in the object's allocation immediately
      * following this object, for use with objects which allocate a larger size
      * class than they need and store non-elements data inline.
      */
     inline uint8_t *fixedData(size_t nslots) const;
@@ -1205,26 +1205,26 @@ class NativeObject : public JSObject
         return privateRef(nfixed);
     }
 
     static inline NativeObject *
     copy(ExclusiveContext *cx, gc::AllocKind kind, gc::InitialHeap heap,
          HandleNativeObject templateObject);
 
     /* JIT Accessors */
-    static size_t offsetOfElements() { return offsetof(NativeObject, elements); }
+    static size_t offsetOfElements() { return offsetof(NativeObject, elements_); }
     static size_t offsetOfFixedElements() {
         return sizeof(NativeObject) + sizeof(ObjectElements);
     }
 
     static size_t getFixedSlotOffset(size_t slot) {
         return sizeof(NativeObject) + slot * sizeof(Value);
     }
     static size_t getPrivateDataOffset(size_t nfixed) { return getFixedSlotOffset(nfixed); }
-    static size_t offsetOfSlots() { return offsetof(NativeObject, slots); }
+    static size_t offsetOfSlots() { return offsetof(NativeObject, slots_); }
 };
 
 inline void
 NativeObject::privateWriteBarrierPre(void **oldval)
 {
 #ifdef JSGC_INCREMENTAL
     JS::shadow::Zone *shadowZone = this->shadowZoneFromAnyThread();
     if (shadowZone->needsIncrementalBarrier()) {
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -447,18 +447,18 @@ JSRuntime::~JSRuntime()
 void
 NewObjectCache::clearNurseryObjects(JSRuntime *rt)
 {
 #ifdef JSGC_GENERATIONAL
     for (unsigned i = 0; i < mozilla::ArrayLength(entries); ++i) {
         Entry &e = entries[i];
         NativeObject *obj = reinterpret_cast<NativeObject *>(&e.templateObject);
         if (IsInsideNursery(e.key) ||
-            rt->gc.nursery.isInside(obj->slots) ||
-            rt->gc.nursery.isInside(obj->elements))
+            rt->gc.nursery.isInside(obj->slots_) ||
+            rt->gc.nursery.isInside(obj->elements_))
         {
             PodZero(&e);
         }
     }
 #endif
 }
 
 void