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/kjs/JSGlobalObject.h

    r36263 r36316  
    2525#include "JSGlobalData.h"
    2626#include "JSVariableObject.h"
     27#include "NumberPrototype.h"
     28#include "StringPrototype.h"
    2729#include <wtf/HashSet.h>
    2830#include <wtf/OwnPtr.h>
     
    294296    }
    295297
     298    inline JSValue* StructureID::prototypeForLookup(ExecState* exec) {
     299        if (m_type == ObjectType)
     300            return m_prototype;
     301
     302        if (m_type == StringType)
     303            return exec->lexicalGlobalObject()->stringPrototype();
     304
     305        ASSERT(m_type == NumberType);
     306        return exec->lexicalGlobalObject()->numberPrototype();
     307    }
     308
    296309} // namespace JSC
    297310
Note: See TracChangeset for help on using the changeset viewer.