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/StructureID.h

    r36285 r36316  
    2727#define StructureID_h
    2828
     29#include "JSType.h"
    2930#include "JSValue.h"
    3031#include "PropertyMap.h"
     
    7273    class StructureID : public RefCounted<StructureID> {
    7374    public:
    74         static PassRefPtr<StructureID> create(JSValue* prototype)
     75        static PassRefPtr<StructureID> create(JSValue* prototype, JSType type = ObjectType)
    7576        {
    76             return adoptRef(new StructureID(prototype));
     77            return adoptRef(new StructureID(prototype, type));
    7778        }
    7879
     
    9394        bool isDictionary() const { return m_isDictionary; }
    9495
    95         JSValue* prototype() const { return m_prototype; }
    96 
     96        JSValue* storedPrototype() const { return m_prototype; }
     97        JSValue* prototypeForLookup(ExecState*);
     98       
    9799        void setCachedPrototypeChain(PassRefPtr<StructureIDChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
    98100        StructureIDChain* cachedPrototypeChain() const { return m_cachedPrototypeChain.get(); }
     
    105107        typedef HashMap<TransitionTableKey, StructureID*, TransitionTableHash, TransitionTableHashTraits> TransitionTable;
    106108
    107         StructureID(JSValue* prototype);
     109        StructureID(JSValue* prototype, JSType);
    108110       
    109111        static const size_t s_maxTransitionLength = 64;
    110112
    111113        bool m_isDictionary;
     114        JSType m_type;
    112115
    113116        JSValue* m_prototype;
Note: See TracChangeset for help on using the changeset viewer.