Changeset 207065 in webkit


Ignore:
Timestamp:
Oct 11, 2016 1:29:09 AM (8 years ago)
Author:
Carlos Garcia Campos
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):

Location:
releases/WebKitGTK/webkit-2.14/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.14/Source/JavaScriptCore/ChangeLog

    r207061 r207065  
     12016-09-09  Saam Barati  <sbarati@apple.com>
     2
     3        Make hasOwnProperty ALWAYS_INLINE
     4        https://bugs.webkit.org/show_bug.cgi?id=161775
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Speedometer spends around 2.5% of its time in hasOwnProperty.
     9        Let's reduce the overhead of calling that function by marking
     10        it as inline. Also, it's likely that the function will call into
     11        JSObject::getOwnPropertySlot. I added a check to see if that's
     12        the function we're calling, if it is, we do a direct call instead
     13        of an indirect call.
     14
     15        * runtime/JSObject.cpp:
     16        (JSC::JSObject::hasOwnProperty): Deleted.
     17        * runtime/JSObjectInlines.h:
     18        (JSC::JSObject::hasOwnProperty):
     19
    1202016-09-08  Filip Pizlo  <fpizlo@apple.com>
    221
  • releases/WebKitGTK/webkit-2.14/Source/JavaScriptCore/runtime/JSObject.cpp

    r205717 r207065  
    14721472
    14731473    return true;
    1474 }
    1475 
    1476 // HasOwnProperty(O, P) from section 7.3.11 in the spec.
    1477 // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty
    1478 bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const
    1479 {
    1480     PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
    1481     return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
    1482 }
    1483 
    1484 bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const
    1485 {
    1486     PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
    1487     return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot);
    14881474}
    14891475
  • releases/WebKitGTK/webkit-2.14/Source/JavaScriptCore/runtime/JSObjectInlines.h

    r205717 r207065  
    194194}
    195195
     196// HasOwnProperty(O, P) from section 7.3.11 in the spec.
     197// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty
     198ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const
     199{
     200    PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
     201    if (LIKELY(const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot == JSObject::getOwnPropertySlot))
     202        return JSObject::getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
     203    return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);
     204}
     205
     206ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const
     207{
     208    PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
     209    return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot);
     210}
     211
    196212} // namespace JSC
    197213
Note: See TracChangeset for help on using the changeset viewer.