Changeset 205753 in webkit
- Timestamp:
- Sep 9, 2016 11:04:19 AM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r205746 r205753 1 2016-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 1 20 2016-09-09 Filip Pizlo <fpizlo@apple.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r205670 r205753 1466 1466 1467 1467 return true; 1468 }1469 1470 // HasOwnProperty(O, P) from section 7.3.11 in the spec.1471 // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty1472 bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const1473 {1474 PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);1475 return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot);1476 }1477 1478 bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const1479 {1480 PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);1481 return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot);1482 1468 } 1483 1469 -
trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h
r205569 r205753 198 198 } 199 199 200 // HasOwnProperty(O, P) from section 7.3.11 in the spec. 201 // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty 202 ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const 203 { 204 PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty); 205 if (LIKELY(const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot == JSObject::getOwnPropertySlot)) 206 return JSObject::getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot); 207 return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot); 208 } 209 210 ALWAYS_INLINE bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const 211 { 212 PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty); 213 return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot); 214 } 215 200 216 } // namespace JSC 201 217
Note: See TracChangeset
for help on using the changeset viewer.