Bug 1529298 - Remove ArrayBufferObject::change{,View}Contents as unused. r=sfink
authorJeff Walden <jwalden@mit.edu>
Wed, 20 Feb 2019 13:51:58 -0800
changeset 519508 973c3800d5d6c10e06ce653add01316f9b0ee25e
parent 519507 694fe0c4379319644cd9f64781fcb71a75558ed5
child 519509 ab967077f8a309b0d383297d071cd8397a100f7c
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1529298
milestone67.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 1529298 - Remove ArrayBufferObject::change{,View}Contents as unused. r=sfink
js/src/vm/ArrayBufferObject.cpp
js/src/vm/ArrayBufferObject.h
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -532,69 +532,16 @@ void ArrayBufferObject::setNewData(FreeO
   //     callers, making the release-operation for changing data pointer
   //     explicit everywhere it occurs.
   MOZ_ASSERT(newContents.data() != dataPointer());
   releaseData(fop);
 
   setDataPointer(newContents);
 }
 
-// This is called *only* from changeContents(), below.
-// By construction, every view parameter will be mapping unshared memory (an
-// ArrayBuffer). Hence no reason to worry about shared memory here.
-
-void ArrayBufferObject::changeViewContents(JSContext* cx,
-                                           ArrayBufferViewObject* view,
-                                           uint8_t* oldDataPointer,
-                                           BufferContents newContents) {
-  MOZ_ASSERT(!view->isSharedMemory());
-
-  // Watch out for NULL data pointers in views. This means that the view
-  // is not fully initialized (in which case it'll be initialized later
-  // with the correct pointer).
-  JS::AutoCheckCannotGC nogc;
-  uint8_t* viewDataPointer = view->dataPointerUnshared(nogc);
-  if (viewDataPointer) {
-    MOZ_ASSERT(newContents);
-    ptrdiff_t offset = viewDataPointer - oldDataPointer;
-    viewDataPointer = static_cast<uint8_t*>(newContents.data()) + offset;
-    view->setDataPointerUnshared(viewDataPointer);
-  }
-
-  // Notify compiled jit code that the base pointer has moved.
-  MarkObjectStateChange(cx, view);
-}
-
-// BufferContents is specific to ArrayBuffer, hence it will not represent shared
-// memory.
-
-void ArrayBufferObject::changeContents(JSContext* cx,
-                                       BufferContents newContents) {
-  MOZ_RELEASE_ASSERT(!isWasm());
-
-  // Change buffer contents.
-  uint8_t* oldDataPointer = dataPointer();
-  setNewData(cx->runtime()->defaultFreeOp(), newContents);
-
-  // Update all views.
-  auto& innerViews = ObjectRealm::get(this).innerViews.get();
-  if (InnerViewTable::ViewVector* views =
-          innerViews.maybeViewsUnbarriered(this)) {
-    for (size_t i = 0; i < views->length(); i++) {
-      JSObject* view = (*views)[i];
-      changeViewContents(cx, &view->as<ArrayBufferViewObject>(), oldDataPointer,
-                         newContents);
-    }
-  }
-  if (JSObject* view = firstView()) {
-    changeViewContents(cx, &view->as<ArrayBufferViewObject>(), oldDataPointer,
-                       newContents);
-  }
-}
-
 /*
  * [SMDOC] WASM Linear Memory structure
  *
  * Wasm Raw Buf Linear Memory Structure
  *
  * The linear heap in Wasm is an mmaped array buffer. Several
  * constants manage its lifetime:
  *
--- a/js/src/vm/ArrayBufferObject.h
+++ b/js/src/vm/ArrayBufferObject.h
@@ -354,26 +354,23 @@ class ArrayBufferObject : public ArrayBu
   // below. Buffers usually only have one view, so this slot optimizes for
   // the common case. Avoiding entries in the InnerViewTable saves memory and
   // non-incrementalized sweep time.
   JSObject* firstView();
 
   bool addView(JSContext* cx, JSObject* view);
 
   void setNewData(FreeOp* fop, BufferContents newContents);
-  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 void detach(JSContext* cx, Handle<ArrayBufferObject*> buffer,
                      BufferContents newContents);
 
  private:
-  void changeViewContents(JSContext* cx, ArrayBufferViewObject* view,
-                          uint8_t* oldDataPointer, BufferContents newContents);
   void setFirstView(JSObject* view);
 
   uint8_t* inlineDataPointer() const;
 
   struct FreeInfo {
     JS::BufferContentsFreeFunc freeFunc;
     void* freeUserData;
   };