Changeset 36316 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Sep 10, 2008, 1:42:43 AM (17 years ago)
Author:
[email protected]
Message:

2008-09-10 Maciej Stachowiak <[email protected]>

Reviewed by Oliver.


  • enable polymorphic inline caching of properties of primitives


1.012x speedup on SunSpider.

We create special structure IDs for JSString and
JSNumberCell. Unlike normal structure IDs, these cannot hold the
true prototype. Due to JS autoboxing semantics, the prototype used
when looking up string or number properties depends on the lexical
global object of the call site, not the creation site. Thus we
enable StructureIDs to handle this quirk for primitives.


Everything else should be straightforward.


  • VM/CTI.cpp: (JSC::CTI::privateCompileGetByIdProto): (JSC::CTI::privateCompileGetByIdChain):
  • VM/CTI.h: (JSC::CTI::compileGetByIdProto): (JSC::CTI::compileGetByIdChain):
  • VM/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
  • VM/Machine.cpp: (JSC::Machine::Machine): (JSC::cachePrototypeChain): (JSC::Machine::tryCachePutByID): (JSC::Machine::tryCacheGetByID): (JSC::Machine::privateExecute): (JSC::Machine::tryCTICachePutByID): (JSC::Machine::tryCTICacheGetByID):
  • kjs/GetterSetter.h: (JSC::GetterSetter::GetterSetter):
  • kjs/JSCell.h:
  • kjs/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • kjs/JSGlobalData.h:
  • kjs/JSGlobalObject.h: (JSC::StructureID::prototypeForLookup):
  • kjs/JSNumberCell.h: (JSC::JSNumberCell::JSNumberCell): (JSC::jsNumberCell):
  • kjs/JSObject.h: (JSC::JSObject::prototype):
  • kjs/JSString.cpp: (JSC::jsString): (JSC::jsSubstring): (JSC::jsOwnedString):
  • kjs/JSString.h: (JSC::JSString::JSString): (JSC::JSString::): (JSC::jsSingleCharacterString): (JSC::jsSingleCharacterSubstring): (JSC::jsNontrivialString):
  • kjs/SmallStrings.cpp: (JSC::SmallStrings::createEmptyString): (JSC::SmallStrings::createSingleCharacterString):
  • kjs/StructureID.cpp: (JSC::StructureID::StructureID): (JSC::StructureID::addPropertyTransition): (JSC::StructureID::getterSetterTransition): (JSC::StructureIDChain::StructureIDChain):
  • kjs/StructureID.h: (JSC::StructureID::create): (JSC::StructureID::storedPrototype):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CTI.cpp

    r36311 r36316  
    16731673}
    16741674
    1675 void* CTI::privateCompileGetByIdProto(StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset)
     1675void* CTI::privateCompileGetByIdProto(ExecState* exec, StructureID* structureID, StructureID* prototypeStructureID, size_t cachedOffset)
    16761676{
    16771677    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a StructureID that is
    16781678    // referencing the prototype object - let's speculatively load it's table nice and early!)
    1679     JSObject* protoObject = static_cast<JSObject*>(structureID->prototype());
     1679    JSObject* protoObject = static_cast<JSObject*>(structureID->prototypeForLookup(exec));
    16801680    OwnArrayPtr<JSValue*>* protoPropertyStorage = &protoObject->m_propertyStorage;
    16811681    m_jit.movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx);
     
    17091709}
    17101710
    1711 void* CTI::privateCompileGetByIdChain(StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset)
     1711void* CTI::privateCompileGetByIdChain(ExecState* exec, StructureID* structureID, StructureIDChain* chain, size_t count, size_t cachedOffset)
    17121712{
    17131713    ASSERT(count);
     
    17251725    JSCell* protoObject = 0;
    17261726    for (unsigned i = 0; i<count; ++i) {
    1727         protoObject = static_cast<JSCell*>(currStructureID->prototype());
     1727        protoObject = static_cast<JSCell*>(currStructureID->prototypeForLookup(exec));
    17281728        currStructureID = chainEntries[i].get();
    17291729
Note: See TracChangeset for help on using the changeset viewer.