Show
Ignore:
Timestamp:
03/21/08 21:59:20 (8 months ago)
Author:
oliver@apple.com
Message:

Optimise lookup of Math, undefined, NaN and Infinity

Reviewed by Maciej

Added a method to JSVariableObject to allow us to inject DontDelete properties
into the symbol table and localStorage. This results in a 0.4% progression in
SunSpider, with a 8% gain in math-partial-sums.

Files:
1 modified

Legend:

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

    r31225 r31226  
    8787        bool symbolTablePut(const Identifier&, JSValue*); 
    8888        bool symbolTableInitializeVariable(const Identifier&, JSValue*, unsigned attributes); 
     89        bool symbolTableInsert(const Identifier&, JSValue*, unsigned attributes); 
    8990 
    9091        JSVariableObjectData* d; 
     
    135136        return true; 
    136137    } 
     138     
     139    inline bool JSVariableObject::symbolTableInsert(const Identifier& propertyName, JSValue* value, unsigned attributes) 
     140    { 
     141        if (symbolTable().get(propertyName.ustring().rep()) != missingSymbolMarker()) 
     142            return false; 
    137143 
     144        ASSERT((attributes & DontDelete) != 0); 
     145        size_t localStorageIndex = d->localStorage.size(); 
     146        d->localStorage.append(LocalStorageEntry(value, attributes)); 
     147        symbolTable().add(propertyName.ustring().rep(), localStorageIndex); 
     148        return true; 
     149    } 
    138150} // namespace KJS 
    139151