Ignore:
Timestamp:
Mar 14, 2013, 12:42:05 PM (12 years ago)
Author:
[email protected]
Message:

JSObject fast by-string access optimizations should work even on the prototype chain, and even when the result is undefined
https://bugs.webkit.org/show_bug.cgi?id=112233

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

Extended the existing fast access path for String keys to work over the entire prototype chain,
not just the self access case. This will fail as soon as it sees an object that intercepts
getOwnPropertySlot, so this patch also ensures that ObjectPrototype does not fall into that
category. This is accomplished by making ObjectPrototype eagerly reify all of its properties.
This is safe for ObjectPrototype because it's so common and we expect all of its properties to
be reified for any interesting programs anyway. A new idiom for adding native functions to
prototypes is introduced, which ought to work well for any other prototypes that we wish to do
this conversion for.

This is a >60% speed-up in the case that you frequently do by-string lookups that "miss", i.e.
they don't turn up anything.

  • CMakeLists.txt:
  • DerivedSources.make:
  • DerivedSources.pri:
  • GNUmakefile.list.am:
  • dfg/DFGOperations.cpp:
  • interpreter/CallFrame.h:

(JSC::ExecState::objectConstructorTable):

  • jit/JITStubs.cpp:

(JSC::getByVal):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::getByVal):

  • runtime/CommonIdentifiers.h:
  • runtime/JSCell.cpp:

(JSC::JSCell::getByStringSlow):
(JSC):

  • runtime/JSCell.h:

(JSCell):

  • runtime/JSCellInlines.h:

(JSC):
(JSC::JSCell::getByStringAndKey):
(JSC::JSCell::getByString):

  • runtime/JSGlobalData.cpp:

(JSC):
(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):

  • runtime/JSGlobalData.h:

(JSGlobalData):

  • runtime/JSObject.cpp:

(JSC::JSObject::putDirectNativeFunction):
(JSC):

  • runtime/JSObject.h:

(JSObject):
(JSC):

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/ObjectPrototype.cpp:

(JSC):
(JSC::ObjectPrototype::finishCreation):
(JSC::ObjectPrototype::create):

  • runtime/ObjectPrototype.h:

(ObjectPrototype):

  • runtime/PropertyMapHashTable.h:

(JSC::PropertyTable::findWithString):

  • runtime/Structure.h:

(Structure):

  • runtime/StructureInlines.h:

(JSC::Structure::get):
(JSC):

LayoutTests:

Reviewed by Oliver Hunt.

  • fast/js/regress/script-tests/string-lookup-hit-identifier.js: Added.

(result):

  • fast/js/regress/script-tests/string-lookup-hit.js: Added.

(result):

  • fast/js/regress/script-tests/string-lookup-miss.js: Added.

(result):

  • fast/js/regress/string-lookup-hit-expected.txt: Added.
  • fast/js/regress/string-lookup-hit-identifier-expected.txt: Added.
  • fast/js/regress/string-lookup-hit-identifier.html: Added.
  • fast/js/regress/string-lookup-hit.html: Added.
  • fast/js/regress/string-lookup-miss-expected.txt: Added.
  • fast/js/regress/string-lookup-miss.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r140594 r145838  
    9191        static const HashTable* numberPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().numberPrototypeTable; }
    9292        static const HashTable* objectConstructorTable(CallFrame* callFrame) { return callFrame->globalData().objectConstructorTable; }
    93         static const HashTable* objectPrototypeTable(CallFrame* callFrame) { return callFrame->globalData().objectPrototypeTable; }
    9493        static const HashTable* privateNamePrototypeTable(CallFrame* callFrame) { return callFrame->globalData().privateNamePrototypeTable; }
    9594        static const HashTable* regExpTable(CallFrame* callFrame) { return callFrame->globalData().regExpTable; }
Note: See TracChangeset for help on using the changeset viewer.