Bug 1372182 part 9 - Inline more functions. r=anba
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 16 Jun 2017 17:43:07 +0200
changeset 364350 c277ca7f082494f1dd7228457acc8409b1d50639
parent 364349 9cae295906a1621c303e5ad4ef0bbedb5ce777a1
child 364351 f6c34f6c5ed59a624360b86e5734dc07b0db8c57
push id91529
push userjandemooij@gmail.com
push dateFri, 16 Jun 2017 15:44:09 +0000
treeherdermozilla-inbound@c277ca7f0824 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1372182
milestone56.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 1372182 part 9 - Inline more functions. r=anba
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.h
js/src/vm/ObjectGroup.h
js/src/vm/Shape.cpp
js/src/vm/TypeInference-inl.h
--- a/js/src/vm/NativeObject-inl.h
+++ b/js/src/vm/NativeObject-inl.h
@@ -734,18 +734,19 @@ LookupOwnPropertyInline(JSContext* cx,
                 propp.setDenseOrTypedArrayElement();
             else
                 propp.setNotFound();
             *donep = true;
             return true;
         }
     }
 
-    // Check for a native property.
-    if (Shape* shape = obj->lookup(cx, id)) {
+    // Check for a native property. Call Shape::search directly (instead of
+    // NativeObject::lookup) because it's inlined.
+    if (Shape* shape = obj->lastProperty()->search(cx, id)) {
         propp.setNativeProperty(shape);
         *donep = true;
         return true;
     }
 
     // id was not found in obj. Try obj's resolve hook, if any.
     if (obj->getClass()->getResolve()) {
         MOZ_ASSERT(!cx->helperThread());
--- a/js/src/vm/NativeObject.h
+++ b/js/src/vm/NativeObject.h
@@ -790,18 +790,19 @@ class NativeObject : public ShapedObject
      * FIXME: bug 593129 -- slot allocation should be done by object methods
      * after calling object-parameter-free shape methods, avoiding coupling
      * logic across the object vs. shape module wall.
      */
     static bool allocDictionarySlot(JSContext* cx, HandleNativeObject obj, uint32_t* slotp);
     void freeSlot(JSContext* cx, uint32_t slot);
 
   private:
-    static Shape* getChildProperty(JSContext* cx, HandleNativeObject obj,
-                                   HandleShape parent, MutableHandle<StackShape> child);
+    static MOZ_ALWAYS_INLINE Shape* getChildProperty(JSContext* cx, HandleNativeObject obj,
+                                                     HandleShape parent,
+                                                     MutableHandle<StackShape> child);
 
   public:
     /* Add a property whose id is not yet in this scope. */
     static MOZ_ALWAYS_INLINE Shape* addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
                                                 JSGetterOp getter, JSSetterOp setter,
                                                 uint32_t slot, unsigned attrs, unsigned flags,
                                                 bool allowDictionary = true);
 
--- a/js/src/vm/ObjectGroup.h
+++ b/js/src/vm/ObjectGroup.h
@@ -385,17 +385,17 @@ class ObjectGroup : public gc::TenuredCe
 
     /*
      * Get or create a property of this object. Only call this for properties which
      * a script accesses explicitly.
      */
     inline HeapTypeSet* getProperty(JSContext* cx, JSObject* obj, jsid id);
 
     /* Get a property only if it already exists. */
-    inline HeapTypeSet* maybeGetProperty(jsid id);
+    MOZ_ALWAYS_INLINE HeapTypeSet* maybeGetProperty(jsid id);
 
     /*
      * Iterate through the group's properties. getPropertyCount overapproximates
      * in the hash case (see SET_ARRAY_SIZE in TypeInference-inl.h), and
      * getProperty may return nullptr.
      */
     inline unsigned getPropertyCount();
     inline Property* getProperty(unsigned i);
--- a/js/src/vm/Shape.cpp
+++ b/js/src/vm/Shape.cpp
@@ -285,17 +285,17 @@ Shape::replaceLastProperty(JSContext* cx
     return cx->zone()->propertyTree().getChild(cx, shape->parent, child);
 }
 
 /*
  * Get or create a property-tree or dictionary child property of |parent|,
  * which must be lastProperty() if inDictionaryMode(), else parent must be
  * one of lastProperty() or lastProperty()->parent.
  */
-/* static */ Shape*
+/* static */ MOZ_ALWAYS_INLINE Shape*
 NativeObject::getChildProperty(JSContext* cx,
                                HandleNativeObject obj, HandleShape parent,
                                MutableHandle<StackShape> child)
 {
     /*
      * Shared properties have no slot, but slot_ will reflect that of parent.
      * Unshared properties allocate a slot here but may lose it due to a
      * JS_ClearScope call.
--- a/js/src/vm/TypeInference-inl.h
+++ b/js/src/vm/TypeInference-inl.h
@@ -832,17 +832,17 @@ struct TypeHashSet
             }
         }
 
         return InsertTry<T,U,KEY>(alloc, values, count, key);
     }
 
     // Lookup an entry in a hash set, return nullptr if it does not exist.
     template <class T, class U, class KEY>
-    static inline U*
+    static MOZ_ALWAYS_INLINE U*
     Lookup(U** values, unsigned count, T key)
     {
         if (count == 0)
             return nullptr;
 
         if (count == 1)
             return (KEY::getKey((U*) values) == key) ? (U*) values : nullptr;
 
@@ -1128,17 +1128,17 @@ ObjectGroup::getProperty(JSContext* cx, 
         // future.
         markUnknown(cx);
     }
 
     base->types.checkMagic();
     return &base->types;
 }
 
-inline HeapTypeSet*
+MOZ_ALWAYS_INLINE HeapTypeSet*
 ObjectGroup::maybeGetProperty(jsid id)
 {
     MOZ_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id));
     MOZ_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id));
     MOZ_ASSERT(!unknownProperties());
 
     Property* prop = TypeHashSet::Lookup<jsid, Property, Property>
                          (propertySet, basePropertyCount(), id);