Bug 1521141 - Part 2: Remove unused code. r=jorendorff
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 18 Jan 2019 11:01:38 -0800
changeset 515372 a6d3f60fc17231cc3d7f2d3a48134669c05df809
parent 515371 249e88d11b9e66bafa4731ac58a98370949e2e4e
child 515373 e166c6ae9e1e65e3b05906e03e1af9d02227c140
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1521141
milestone66.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 1521141 - Part 2: Remove unused code. r=jorendorff
js/src/vm/GlobalObject.h
js/src/vm/JSObject.h
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.cpp
js/src/vm/NativeObject.h
--- a/js/src/vm/GlobalObject.h
+++ b/js/src/vm/GlobalObject.h
@@ -230,45 +230,16 @@ class GlobalObject : public NativeObject
   }
 
   bool functionObjectClassesInitialized() const {
     bool inited = classIsInitialized(JSProto_Function);
     MOZ_ASSERT(inited == classIsInitialized(JSProto_Object));
     return inited;
   }
 
-  bool arrayClassInitialized() const {
-    return classIsInitialized(JSProto_Array);
-  }
-
-  bool booleanClassInitialized() const {
-    return classIsInitialized(JSProto_Boolean);
-  }
-  bool numberClassInitialized() const {
-    return classIsInitialized(JSProto_Number);
-  }
-  bool stringClassInitialized() const {
-    return classIsInitialized(JSProto_String);
-  }
-  bool regexpClassInitialized() const {
-    return classIsInitialized(JSProto_RegExp);
-  }
-  bool arrayBufferClassInitialized() const {
-    return classIsInitialized(JSProto_ArrayBuffer);
-  }
-  bool sharedArrayBufferClassInitialized() const {
-    return classIsInitialized(JSProto_SharedArrayBuffer);
-  }
-  bool errorClassesInitialized() const {
-    return classIsInitialized(JSProto_Error);
-  }
-  bool dataViewClassInitialized() const {
-    return classIsInitialized(JSProto_DataView);
-  }
-
   // Disallow use of unqualified JSObject::create in GlobalObject.
   static GlobalObject* create(...) = delete;
 
   friend struct ::JSRuntime;
   static GlobalObject* createInternal(JSContext* cx, const Class* clasp);
 
  public:
   static GlobalObject* new_(JSContext* cx, const Class* clasp,
@@ -348,17 +319,17 @@ class GlobalObject : public NativeObject
                                                  Handle<GlobalObject*> global) {
     if (!ensureConstructor(cx, global, JSProto_Array)) {
       return nullptr;
     }
     return &global->getPrototype(JSProto_Array).toObject().as<NativeObject>();
   }
 
   NativeObject* maybeGetArrayPrototype() {
-    if (arrayClassInitialized()) {
+    if (classIsInitialized(JSProto_Array)) {
       return &getPrototype(JSProto_Array).toObject().as<NativeObject>();
     }
     return nullptr;
   }
 
   static NativeObject* getOrCreateBooleanPrototype(
       JSContext* cx, Handle<GlobalObject*> global) {
     if (!ensureConstructor(cx, global, JSProto_Boolean)) {
@@ -403,17 +374,17 @@ class GlobalObject : public NativeObject
       JSContext* cx, Handle<GlobalObject*> global) {
     if (!ensureConstructor(cx, global, JSProto_RegExp)) {
       return nullptr;
     }
     return &global->getPrototype(JSProto_RegExp).toObject().as<NativeObject>();
   }
 
   JSObject* maybeGetRegExpPrototype() {
-    if (regexpClassInitialized()) {
+    if (classIsInitialized(JSProto_RegExp)) {
       return &getPrototype(JSProto_RegExp).toObject();
     }
     return nullptr;
   }
 
   static NativeObject* getOrCreateSavedFramePrototype(
       JSContext* cx, Handle<GlobalObject*> global) {
     if (!ensureConstructor(cx, global, JSProto_SavedFrame)) {
--- a/js/src/vm/JSObject.h
+++ b/js/src/vm/JSObject.h
@@ -334,18 +334,16 @@ class JSObject : public js::gc::Cell {
    * 3. js::GetPrototype(cx, obj, &proto) computes the proto of an object.
    *    If obj is a proxy with dynamically-computed prototype, this code may
    *    perform arbitrary behavior (allocation, GC, run JS) while computing
    *    the proto.
    */
 
   js::TaggedProto taggedProto() const { return group_->proto(); }
 
-  bool hasTenuredProto() const;
-
   bool uninlinedIsProxy() const;
 
   JSObject* staticPrototype() const {
     MOZ_ASSERT(hasStaticPrototype());
     return taggedProto().toObjectOrNull();
   }
 
   // Normal objects and a subset of proxies have an uninteresting, static
@@ -475,18 +473,16 @@ class JSObject : public js::gc::Cell {
                                   JS::ObjectOpResult& result);
 
   static void swap(JSContext* cx, JS::HandleObject a, JS::HandleObject b);
 
  private:
   void fixDictionaryShapeAfterSwap();
 
  public:
-  inline void initArrayClass();
-
   /*
    * In addition to the generic object interface provided by JSObject,
    * specific types of objects may provide additional operations. To access,
    * these addition operations, callers should use the pattern:
    *
    *   if (obj.is<XObject>()) {
    *     XObject& x = obj.as<XObject>();
    *     x.foo();
--- a/js/src/vm/NativeObject-inl.h
+++ b/js/src/vm/NativeObject-inl.h
@@ -445,49 +445,16 @@ inline DenseElementResult NativeObject::
 
 inline Value NativeObject::getDenseOrTypedArrayElement(uint32_t idx) {
   if (is<TypedArrayObject>()) {
     return as<TypedArrayObject>().getElement(idx);
   }
   return getDenseElement(idx);
 }
 
-/* static */ inline NativeObject* NativeObject::copy(
-    JSContext* cx, gc::AllocKind kind, gc::InitialHeap heap,
-    HandleNativeObject templateObject) {
-  RootedShape shape(cx, templateObject->lastProperty());
-  RootedObjectGroup group(cx, templateObject->group());
-  MOZ_ASSERT(!templateObject->denseElementsAreCopyOnWrite());
-
-  JSObject* baseObj;
-  JS_TRY_VAR_OR_RETURN_NULL(cx, baseObj, create(cx, kind, heap, shape, group));
-
-  NativeObject* obj = &baseObj->as<NativeObject>();
-
-  size_t span = shape->slotSpan();
-  if (span) {
-    uint32_t numFixed = templateObject->numFixedSlots();
-    const Value* fixed = &templateObject->getSlot(0);
-    // Only copy elements which are registered in the shape, even if the
-    // number of fixed slots is larger.
-    if (span < numFixed) {
-      numFixed = span;
-    }
-    obj->copySlotRange(0, fixed, numFixed);
-
-    if (numFixed < span) {
-      uint32_t numSlots = span - numFixed;
-      const Value* slots = &templateObject->getSlot(numFixed);
-      obj->copySlotRange(numFixed, slots, numSlots);
-    }
-  }
-
-  return obj;
-}
-
 MOZ_ALWAYS_INLINE void NativeObject::setSlotWithType(JSContext* cx,
                                                      Shape* shape,
                                                      const Value& value,
                                                      bool overwriting) {
   setSlot(shape->slot(), value);
 
   if (overwriting) {
     shape->setOverwritten();
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -261,31 +261,16 @@ void js::NativeObject::initSlotRange(uin
   for (HeapSlot* sp = fixedStart; sp < fixedEnd; sp++) {
     sp->init(this, HeapSlot::Slot, start++, *vector++);
   }
   for (HeapSlot* sp = slotsStart; sp < slotsEnd; sp++) {
     sp->init(this, HeapSlot::Slot, start++, *vector++);
   }
 }
 
-void js::NativeObject::copySlotRange(uint32_t start, const Value* vector,
-                                     uint32_t length) {
-  HeapSlot* fixedStart;
-  HeapSlot* fixedEnd;
-  HeapSlot* slotsStart;
-  HeapSlot* slotsEnd;
-  getSlotRange(start, length, &fixedStart, &fixedEnd, &slotsStart, &slotsEnd);
-  for (HeapSlot* sp = fixedStart; sp < fixedEnd; sp++) {
-    sp->set(this, HeapSlot::Slot, start++, *vector++);
-  }
-  for (HeapSlot* sp = slotsStart; sp < slotsEnd; sp++) {
-    sp->set(this, HeapSlot::Slot, start++, *vector++);
-  }
-}
-
 #ifdef DEBUG
 
 bool js::NativeObject::slotInRange(uint32_t slot,
                                    SentinelAllowed sentinel) const {
   MOZ_ASSERT(!gc::IsForwarded(lastProperty()));
   uint32_t capacity = numFixedSlots() + numDynamicSlots();
   if (sentinel == SENTINEL_ALLOWED) {
     return slot <= capacity;
--- a/js/src/vm/NativeObject.h
+++ b/js/src/vm/NativeObject.h
@@ -660,22 +660,16 @@ class NativeObject : public ShapedObject
   void initializeSlotRange(uint32_t start, uint32_t count);
 
   /*
    * Initialize a flat array of slots to this object at a start slot.  The
    * caller must ensure that are enough slots.
    */
   void initSlotRange(uint32_t start, const Value* vector, uint32_t length);
 
-  /*
-   * Copy a flat array of slots to this object at a start slot. Caller must
-   * ensure there are enough slots in this object.
-   */
-  void copySlotRange(uint32_t start, const Value* vector, uint32_t length);
-
 #ifdef DEBUG
   enum SentinelAllowed{SENTINEL_NOT_ALLOWED, SENTINEL_ALLOWED};
 
   /*
    * Check that slot is in range for the object's allocated slots.
    * If sentinelAllowed then slot may equal the slot capacity.
    */
   bool slotInRange(uint32_t slot,
@@ -1484,20 +1478,16 @@ class NativeObject : public ShapedObject
 
   /* Access private data for an object with a known number of fixed slots. */
   inline void* getPrivate(uint32_t nfixed) const { return privateRef(nfixed); }
   void setPrivateUnbarriered(uint32_t nfixed, void* data) {
     void** pprivate = &privateRef(nfixed);
     *pprivate = data;
   }
 
-  static inline NativeObject* copy(JSContext* cx, gc::AllocKind kind,
-                                   gc::InitialHeap heap,
-                                   HandleNativeObject templateObject);
-
   /* Return the allocKind we would use if we were to tenure this object. */
   inline js::gc::AllocKind allocKindForTenure() const;
 
   void updateShapeAfterMovingGC();
   void sweepDictionaryListPointer();
   void updateDictionaryListPointerAfterMinorGC(NativeObject* old);
 
   // Native objects are never wrappers, so a native object always has a realm