Title: [207065] releases/WebKitGTK/webkit-2.14/Source/_javascript_Core
Revision
207065
Author
carlo...@webkit.org
Date
2016-10-11 01:29:09 -0700 (Tue, 11 Oct 2016)

Log Message

Merge r205753 - Make hasOwnProperty ALWAYS_INLINE
https://bugs.webkit.org/show_bug.cgi?id=161775

Reviewed by Ryosuke Niwa.

Speedometer spends around 2.5% of its time in hasOwnProperty.
Let's reduce the overhead of calling that function by marking
it as inline. Also, it's likely that the function will call into
JSObject::getOwnPropertySlot. I added a check to see if that's
the function we're calling, if it is, we do a direct call instead
of an indirect call.

* runtime/JSObject.cpp:
(JSC::JSObject::hasOwnProperty): Deleted.
* runtime/JSObjectInlines.h:
(JSC::JSObject::hasOwnProperty):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog (207064 => 207065)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog	2016-10-11 08:09:25 UTC (rev 207064)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/ChangeLog	2016-10-11 08:29:09 UTC (rev 207065)
@@ -1,3 +1,22 @@
+2016-09-09  Saam Barati  <sbar...@apple.com>
+
+        Make hasOwnProperty ALWAYS_INLINE
+        https://bugs.webkit.org/show_bug.cgi?id=161775
+
+        Reviewed by Ryosuke Niwa.
+
+        Speedometer spends around 2.5% of its time in hasOwnProperty.
+        Let's reduce the overhead of calling that function by marking
+        it as inline. Also, it's likely that the function will call into
+        JSObject::getOwnPropertySlot. I added a check to see if that's
+        the function we're calling, if it is, we do a direct call instead
+        of an indirect call.
+
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::hasOwnProperty): Deleted.
+        * runtime/JSObjectInlines.h:
+        (JSC::JSObject::hasOwnProperty):
+
 2016-09-08  Filip Pizlo  <fpi...@apple.com>
 
         Heap::isMarked() shouldn't pay the price of concurrent lazy flipping

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSObject.cpp (207064 => 207065)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSObject.cpp	2016-10-11 08:09:25 UTC (rev 207064)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSObject.cpp	2016-10-11 08:29:09 UTC (rev 207065)
@@ -1473,20 +1473,6 @@
     return true;
 }
 
-// HasOwnProperty(O, P) from section 7.3.11 in the spec.
-// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty
-bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const
-{
-    PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
-    return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
-}
-
-bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const
-{
-    PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
-    return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot);
-}
-
 bool JSObject::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned i)
 {
     JSObject* thisObject = jsCast<JSObject*>(cell);

Modified: releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSObjectInlines.h (207064 => 207065)


--- releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSObjectInlines.h	2016-10-11 08:09:25 UTC (rev 207064)
+++ releases/WebKitGTK/webkit-2.14/Source/_javascript_Core/runtime/JSObjectInlines.h	2016-10-11 08:29:09 UTC (rev 207065)
@@ -193,6 +193,22 @@
     return thisObject->putInlineSlow(exec, propertyName, value, slot);
 }
 
+// HasOwnProperty(O, P) from section 7.3.11 in the spec.
+// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty
+ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const
+{
+    PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
+    if (LIKELY(const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot == JSObject::getOwnPropertySlot))
+        return JSObject::getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
+    return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
+}
+
+ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const
+{
+    PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
+    return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot);
+}
+
 } // namespace JSC
 
 #endif // JSObjectInlines_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to