Bug 1651645 part 1 - Inline setDenseElementMaybeConvertDouble into its sole caller. r=evilpie
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 09 Jul 2020 20:55:29 +0000
changeset 540349 1b1c0c802a6b47c8d7c52725212ad23cdc636a10
parent 540348 96c82012d855f3518d5a917029d10241b6ffe44c
child 540350 4a7666aa3cc64b5f63cc6ef1e816359cac07a0da
push id121651
push userjdemooij@mozilla.com
push dateTue, 14 Jul 2020 08:39:33 +0000
treeherderautoland@f112125cab4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1651645
milestone80.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 1651645 part 1 - Inline setDenseElementMaybeConvertDouble into its sole caller. r=evilpie Differential Revision: https://phabricator.services.mozilla.com/D82958
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.h
--- a/js/src/vm/NativeObject-inl.h
+++ b/js/src/vm/NativeObject-inl.h
@@ -79,17 +79,21 @@ inline void NativeObject::addDenseElemen
       TypeSet::GetValueType(elements_[index - 1]) != thisType) {
     AddTypePropertyId(cx, this, JSID_VOID, thisType);
   }
 }
 
 inline void NativeObject::setDenseElementWithType(JSContext* cx, uint32_t index,
                                                   const Value& val) {
   addDenseElementType(cx, index, val);
-  setDenseElementMaybeConvertDouble(index, val);
+  if (val.isInt32() && shouldConvertDoubleElements()) {
+    setDenseElement(index, DoubleValue(val.toInt32()));
+  } else {
+    setDenseElement(index, val);
+  }
 }
 
 inline void NativeObject::initDenseElementWithType(JSContext* cx,
                                                    uint32_t index,
                                                    const Value& val) {
   MOZ_ASSERT(!shouldConvertDoubleElements());
   MOZ_ASSERT(!val.isMagic(JS_ELEMENTS_HOLE));
 
--- a/js/src/vm/NativeObject.h
+++ b/js/src/vm/NativeObject.h
@@ -1256,24 +1256,16 @@ class NativeObject : public JSObject {
   void initDenseElement(uint32_t index, const Value& val) {
     MOZ_ASSERT(index < getDenseInitializedLength());
     MOZ_ASSERT(!denseElementsAreCopyOnWrite());
     MOZ_ASSERT(isExtensible());
     checkStoredValue(val);
     elements_[index].init(this, HeapSlot::Element, unshiftedIndex(index), val);
   }
 
-  void setDenseElementMaybeConvertDouble(uint32_t index, const Value& val) {
-    if (val.isInt32() && shouldConvertDoubleElements()) {
-      setDenseElement(index, DoubleValue(val.toInt32()));
-    } else {
-      setDenseElement(index, val);
-    }
-  }
-
  private:
   inline void addDenseElementType(JSContext* cx, uint32_t index,
                                   const Value& val);
 
  public:
   inline void setDenseElementWithType(JSContext* cx, uint32_t index,
                                       const Value& val);
   inline void initDenseElementWithType(JSContext* cx, uint32_t index,