Bug 1079844 - Rename ABO::neuterView to a standalone NoteViewBufferWasDetached function. r=sfink
authorJeff Walden <jwalden@mit.edu>
Mon, 25 Jan 2016 14:01:13 -0800
changeset 281737 79782eaeb50114c065a5e4cbd7ddd358337825c6
parent 281736 d08bf5b0f989cf23edce42a982c33c839869f9bd
child 281738 74a06f6d85e1c04bfd2781a8c8225f2483e18ba3
push id70900
push userjwalden@mit.edu
push dateTue, 26 Jan 2016 20:01:22 +0000
treeherdermozilla-inbound@79782eaeb501 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1079844
milestone47.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 1079844 - Rename ABO::neuterView to a standalone NoteViewBufferWasDetached function. r=sfink
js/src/vm/ArrayBufferObject.cpp
js/src/vm/ArrayBufferObject.h
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -234,19 +234,20 @@ AllocateArrayBufferContents(JSContext* c
 {
     uint8_t* p = cx->runtime()->pod_callocCanGC<uint8_t>(nbytes);
     if (!p)
         ReportOutOfMemory(cx);
 
     return ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(p);
 }
 
-void
-ArrayBufferObject::neuterView(JSContext* cx, ArrayBufferViewObject* view,
-                              BufferContents newContents)
+static void
+NoteViewBufferWasDetached(ArrayBufferViewObject* view,
+                          ArrayBufferObject::BufferContents newContents,
+                          JSContext* cx)
 {
     view->notifyBufferDetached(newContents.data());
 
     // Notify compiled jit code that the base pointer has moved.
     MarkObjectStateChange(cx, view);
 }
 
 /* static */ bool
@@ -278,26 +279,26 @@ ArrayBufferObject::detach(JSContext* cx,
         cx->compartment()->detachedTypedObjects = 1;
     }
 
     // Update all views of the buffer to account for the buffer having been
     // detached, and clear the buffer's data and list of views.
 
     if (InnerViewTable::ViewVector* views = cx->compartment()->innerViews.maybeViewsUnbarriered(buffer)) {
         for (size_t i = 0; i < views->length(); i++)
-            buffer->neuterView(cx, (*views)[i], newContents);
+            NoteViewBufferWasDetached((*views)[i], newContents, cx);
         cx->compartment()->innerViews.removeViews(buffer);
     }
     if (buffer->firstView()) {
         if (buffer->forInlineTypedObject()) {
             // The buffer points to inline data in its first view, so to keep
             // this pointer alive we don't clear out the first view.
             MOZ_ASSERT(buffer->firstView()->is<InlineTransparentTypedObject>());
         } else {
-            buffer->neuterView(cx, buffer->firstView(), newContents);
+            NoteViewBufferWasDetached(buffer->firstView(), newContents, cx);
             buffer->setFirstView(nullptr);
         }
     }
 
     if (newContents.data() != buffer->dataPointer())
         buffer->setNewOwnedData(cx->runtime()->defaultFreeOp(), newContents);
 
     buffer->setByteLength(0);
--- a/js/src/vm/ArrayBufferObject.h
+++ b/js/src/vm/ArrayBufferObject.h
@@ -274,18 +274,16 @@ class ArrayBufferObject : public ArrayBu
     void changeContents(JSContext* cx, BufferContents newContents);
 
     // Detach this buffer from its original memory.  (This necessarily makes
     // views of this buffer unusable for modifying that original memory.)
     static MOZ_WARN_UNUSED_RESULT bool
     detach(JSContext* cx, Handle<ArrayBufferObject*> buffer, BufferContents newContents);
 
   private:
-    void neuterView(JSContext* cx, ArrayBufferViewObject* view,
-                    BufferContents newContents);
     void changeViewContents(JSContext* cx, ArrayBufferViewObject* view,
                             uint8_t* oldDataPointer, BufferContents newContents);
     void setFirstView(ArrayBufferViewObject* view);
 
     uint8_t* inlineDataPointer() const;
 
   public:
     uint8_t* dataPointer() const;