Bug 889146 (part 2) - Rename ArrayBuffer as ArrayBufferObject in comments, where appropriate. r=sfink.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 02 Jul 2013 12:48:34 -0700
changeset 137278 0bd37861c48cd49811bdf781db0082d5a45585f3
parent 137277 9ed886b5122b023b958e1dcbc7fffc388645a514
child 137279 13dd71c1b82270d3141f47c994b2a523be608da8
push id1824
push userryanvm@gmail.com
push dateWed, 03 Jul 2013 18:16:56 +0000
treeherderfx-team@dcbbfcdf7bb4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs889146
milestone25.0a1
Bug 889146 (part 2) - Rename ArrayBuffer as ArrayBufferObject in comments, where appropriate. r=sfink.
js/src/jstypedarray.cpp
js/src/jstypedarray.h
js/src/jstypedarrayinlines.h
--- a/js/src/jstypedarray.cpp
+++ b/js/src/jstypedarray.cpp
@@ -99,17 +99,17 @@ ToClampedIndex(JSContext *cx, const Valu
     } else if (uint32_t(result) > length) {
         result = length;
     }
     *out = uint32_t(result);
     return true;
 }
 
 /*
- * ArrayBuffer
+ * ArrayBufferObject
  *
  * This class holds the underlying raw buffer that the TypedArray classes
  * access.  It can be created explicitly and passed to a TypedArray, or
  * can be created implicitly by constructing a TypedArray with a size.
  */
 
 JS_ALWAYS_INLINE bool
 IsArrayBuffer(const Value &v)
@@ -518,18 +518,18 @@ ArrayBufferObject::addView(JSObject *vie
 
     // Note that pre-barriers are not needed here because either the list was
     // previously empty, in which case no pointer is being overwritten, or the
     // list was nonempty and will be made weak during this call (and weak
     // pointers cannot violate the snapshot-at-the-beginning invariant.)
 
     HeapPtrObject *views = GetViewList(this);
     if (*views == NULL) {
-        // This ArrayBuffer will have a single view at this point, so it is a
-        // strong pointer (it will be marked during tracing.)
+        // This ArrayBufferObject will have a single view at this point, so it
+        // is a strong pointer (it will be marked during tracing.)
         JS_ASSERT(NextView(view) == NULL);
     } else {
         view->setFixedSlot(BufferView::NEXT_VIEW_SLOT, PrivateValue(*views));
         WeakObjectSlotBarrierPost(view, BufferView::NEXT_VIEW_SLOT, "arraybuffer.nextview");
 
         // Move the multiview buffer list link into this view since we're
         // prepending it to the list.
         SetBufferLink(view, BufferLink(*views));
@@ -640,17 +640,17 @@ ArrayBufferObject::stealContents(JSConte
         ArrayBufferObject::setElementsHeader(newheader, length);
         *contents = newheader;
         *data = reinterpret_cast<uint8_t *>(newheader + 1);
 
         if (buffer.isAsmJSArrayBuffer())
             ArrayBufferObject::neuterAsmJSArrayBuffer(buffer);
     }
 
-    // Neuter the donor ArrayBuffer and all views of it
+    // Neuter the donor ArrayBufferObject and all views of it
     ArrayBufferObject::setElementsHeader(header, 0);
     GetViewList(&buffer)->init(views);
     for (JSObject *view = views; view; view = NextView(view))
         TypedArray::neuter(view);
 
     return true;
 }
 
@@ -663,27 +663,27 @@ ArrayBufferObject::obj_trace(JSTracer *t
      */
     JSObject *delegate = static_cast<JSObject*>(obj->getPrivate());
     if (delegate) {
         JS_SET_TRACING_LOCATION(trc, &obj->privateRef(obj->numFixedSlots()));
         MarkObjectUnbarriered(trc, &delegate, "arraybuffer.delegate");
         obj->setPrivateUnbarriered(delegate);
     }
 
-    // ArrayBuffers need to maintain a list of possibly-weak pointers to their
-    // views. The straightforward way to update the weak pointers would be in
-    // the views' finalizers, but giving views finalizers means they cannot be
-    // swept in the background. This results in a very high performance cost.
-    // Instead, ArrayBuffers with a single view hold a strong pointer to the
-    // view. This can entrain garbage when the single view becomes otherwise
-    // unreachable while the buffer is still live, but this is expected to be
-    // rare. ArrayBuffers with 0-1 views are expected to be by far the most
-    // common cases. ArrayBuffers with multiple views are collected into a
-    // linked list during collection, and then swept to prune out their dead
-    // views.
+    // ArrayBufferObjects need to maintain a list of possibly-weak pointers to
+    // their views. The straightforward way to update the weak pointers would
+    // be in the views' finalizers, but giving views finalizers means they
+    // cannot be swept in the background. This results in a very high
+    // performance cost.  Instead, ArrayBufferObjects with a single view hold a
+    // strong pointer to the view. This can entrain garbage when the single
+    // view becomes otherwise unreachable while the buffer is still live, but
+    // this is expected to be rare. ArrayBufferObjects with 0-1 views are
+    // expected to be by far the most common cases. ArrayBufferObjects with
+    // multiple views are collected into a linked list during collection, and
+    // then swept to prune out their dead views.
 
     HeapPtrObject *views = GetViewList(&obj->as<ArrayBufferObject>());
     if (!*views)
         return;
 
     // During minor collections, these edges are normally kept alive by the
     // store buffer. If the store buffer overflows, fallback marking should
     // just treat these as strong references for simplicity.
@@ -738,18 +738,18 @@ ArrayBufferObject::sweep(JSCompartment *
     while (buffer) {
         HeapPtrObject *views = GetViewList(&buffer->as<ArrayBufferObject>());
         JS_ASSERT(*views);
 
         JSObject *nextBuffer = BufferLink(*views);
         JS_ASSERT(nextBuffer != UNSET_BUFFER_LINK);
         SetBufferLink(*views, UNSET_BUFFER_LINK);
 
-        // Rebuild the list of views of the ArrayBuffer, discarding dead views.
-        // If there is only one view, it will have already been marked.
+        // Rebuild the list of views of the ArrayBufferObject, discarding dead
+        // views.  If there is only one view, it will have already been marked.
         JSObject *prevLiveView = NULL;
         JSObject *view = *views;
         while (view) {
             JS_ASSERT(buffer->compartment() == view->compartment());
             JSObject *nextView = NextView(view);
             if (!IsObjectAboutToBeFinalized(&view)) {
                 view->setFixedSlot(BufferView::NEXT_VIEW_SLOT, PrivateValue(prevLiveView));
                 prevLiveView = view;
@@ -2142,36 +2142,36 @@ class TypedArrayTemplate
              * Normally, NonGenericMethodGuard handles the case of transparent
              * wrappers. However, we have a peculiar situation: we want to
              * construct the new typed array in the compartment of the buffer,
              * so that the typed array can point directly at their buffer's
              * data without crossing compartment boundaries. So we use the
              * machinery underlying NonGenericMethodGuard directly to proxy the
              * native call. We will end up with a wrapper in the origin
              * compartment for a view in the target compartment referencing the
-             * ArrayBuffer in that same compartment.
+             * ArrayBufferObject in that same compartment.
              */
             JSObject *wrapped = CheckedUnwrap(bufobj);
             if (!wrapped) {
                 JS_ReportError(cx, "Permission denied to access object");
                 return NULL;
             }
             if (wrapped->is<ArrayBufferObject>()) {
                 /*
                  * And for even more fun, the new view's prototype should be
                  * set to the origin compartment's prototype object, not the
                  * target's (specifically, the actual view in the target
                  * compartment will use as its prototype a wrapper around the
                  * origin compartment's view.prototype object).
                  *
                  * Rather than hack some crazy solution together, implement
                  * this all using a private helper function, created when
-                 * ArrayBuffer was initialized and cached in the global.  This
-                 * reuses all the existing cross-compartment crazy so we don't
-                 * have to do anything *uniquely* crazy here.
+                 * ArrayBufferObject was initialized and cached in the global.
+                 * This reuses all the existing cross-compartment crazy so we
+                 * don't have to do anything *uniquely* crazy here.
                  */
 
                 Rooted<JSObject*> proto(cx);
                 if (!FindProto(cx, fastClass(), &proto))
                     return NULL;
 
                 InvokeArgs args(cx);
                 if (!args.init(3))
--- a/js/src/jstypedarray.h
+++ b/js/src/jstypedarray.h
@@ -190,32 +190,32 @@ class ArrayBufferObject : public JSObjec
  * BufferView
  *
  * Common definitions shared by all ArrayBufferViews. (The name ArrayBufferView
  * is currently being used for a namespace in jsfriendapi.h.)
  */
 
 class BufferView : public JSObject {
   public:
-    /* Offset of view in underlying ArrayBuffer */
+    /* Offset of view in underlying ArrayBufferObject */
     static const size_t BYTEOFFSET_SLOT  = 0;
 
     /* Byte length of view */
     static const size_t BYTELENGTH_SLOT  = 1;
 
-    /* Underlying ArrayBuffer */
+    /* Underlying ArrayBufferObject */
     static const size_t BUFFER_SLOT      = 2;
 
-    /* ArrayBuffers point to a linked list of views, chained through this slot */
+    /* ArrayBufferObjects point to a linked list of views, chained through this slot */
     static const size_t NEXT_VIEW_SLOT   = 3;
 
     /*
-     * When ArrayBuffers are traced during GC, they construct a linked list of
-     * ArrayBuffers with more than one view, chained through this slot of the
-     * first view of each ArrayBuffer
+     * When ArrayBufferObjects are traced during GC, they construct a linked
+     * list of ArrayBufferObjects with more than one view, chained through this
+     * slot of the first view of each ArrayBufferObject.
      */
     static const size_t NEXT_BUFFER_SLOT = 4;
 
     static const size_t NUM_SLOTS        = 5;
 };
 
 /*
  * TypedArray
--- a/js/src/jstypedarrayinlines.h
+++ b/js/src/jstypedarrayinlines.h
@@ -10,17 +10,17 @@
 #include "jsapi.h"
 #include "jsobj.h"
 #include "jstypedarray.h"
 
 #include "jscntxtinlines.h"
 #include "jsobjinlines.h"
 
 // Sentinel value used to initialize ArrayBufferViews' NEXT_BUFFER_SLOTs to
-// show that they have not yet been added to any ArrayBuffer list
+// show that they have not yet been added to any ArrayBufferObject list.
 JSObject * const UNSET_BUFFER_LINK = (JSObject*)0x2;
 
 inline void
 js::ArrayBufferObject::setElementsHeader(js::ObjectElements *header, uint32_t bytes)
 {
     header->flags = 0;
     header->initializedLength = bytes;