Ignore:
Timestamp:
Oct 29, 2007, 12:55:34 AM (18 years ago)
Author:
eseidel
Message:

2007-10-29 Eric Seidel <[email protected]>

Reviewed by darin.


Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
Make it a compile time error to use toString(ExecState) on a StringInstance


SunSpider claims this was a 6.6% speedup overall (22% on string-base64)

  • kjs/internal.h: (KJS::StringImp::getLength):
  • kjs/string_object.cpp: (KJS::StringInstance::lengthGetter): (KJS::StringInstance::inlineGetOwnPropertySlot): (KJS::StringInstance::getOwnPropertySlot):
  • kjs/string_object.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/string_object.h

    r24873 r27218  
    3232  public:
    3333    StringInstance(JSObject *proto);
    34     StringInstance(JSObject *proto, StringImp* string);
    35     StringInstance(JSObject *proto, const UString &string);
     34    StringInstance(JSObject *proto, StringImp*);
     35    StringInstance(JSObject *proto, const UString&);
    3636
    3737    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    38     virtual void put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr = None);
     38    virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
     39
     40    virtual void put(ExecState* exec, const Identifier& propertyName, JSValue*, int attr = None);
    3941    virtual bool deleteProperty(ExecState* exec, const Identifier& propertyName);
    4042    virtual void getPropertyNames(ExecState*, PropertyNameArray&);
     
    4648
    4749  private:
    48     static JSValue *lengthGetter(ExecState *exec, JSObject *, const Identifier&, const PropertySlot &slot);
    49     static JSValue *indexGetter(ExecState *exec, JSObject *, const Identifier&, const PropertySlot &slot);
     50    bool inlineGetOwnPropertySlot(ExecState*, unsigned, PropertySlot&);
     51
     52    static JSValue* lengthGetter(ExecState*, JSObject *, const Identifier&, const PropertySlot&);
     53    static JSValue* indexGetter(ExecState*, JSObject *, const Identifier&, const PropertySlot&);
    5054  };
    5155
Note: See TracChangeset for help on using the changeset viewer.