Changeset 31226 in webkit
- Timestamp:
- Mar 21, 2008, 9:59:20 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r31225 r31226 1 2008-03-21 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej. 4 5 Optimise lookup of Math, undefined, NaN and Infinity 6 7 Added a method to JSVariableObject to allow us to inject DontDelete properties 8 into the symbol table and localStorage. This results in a 0.4% progression in 9 SunSpider, with a 8% gain in math-partial-sums. 10 11 * kjs/JSGlobalObject.cpp: 12 (KJS::JSGlobalObject::reset): 13 * kjs/JSVariableObject.h: 14 (KJS::JSVariableObject::symbolTableInsert): 15 1 16 2008-03-21 Oliver Hunt <oliver@apple.com> 2 17 -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r31173 r31226 310 310 311 311 // Set global values. 312 313 putDirect("Math", new MathObjectImp(exec, d()->objectPrototype), DontEnum); 314 315 putDirect("NaN", jsNaN(), DontEnum | DontDelete); 316 putDirect("Infinity", jsNumber(Inf), DontEnum | DontDelete); 317 putDirect("undefined", jsUndefined(), DontEnum | DontDelete); 312 Identifier mathIdent = "Math"; 313 JSValue* mathObject = new MathObjectImp(exec, d()->objectPrototype); 314 symbolTableInsert(mathIdent, mathObject, DontEnum | DontDelete); 315 316 Identifier nanIdent = "NaN"; 317 JSValue* nanValue = jsNaN(); 318 symbolTableInsert(nanIdent, nanValue, DontEnum | DontDelete); 319 320 Identifier infinityIdent = "Infinity"; 321 JSValue* infinityValue = jsNumber(Inf); 322 symbolTableInsert(infinityIdent, infinityValue, DontEnum | DontDelete); 323 324 Identifier undefinedIdent = "undefined"; 325 JSValue* undefinedValue = jsUndefined(); 326 symbolTableInsert(undefinedIdent, undefinedValue, DontEnum | DontDelete); 318 327 319 328 // Set global functions. -
trunk/JavaScriptCore/kjs/JSVariableObject.h
r31225 r31226 87 87 bool symbolTablePut(const Identifier&, JSValue*); 88 88 bool symbolTableInitializeVariable(const Identifier&, JSValue*, unsigned attributes); 89 bool symbolTableInsert(const Identifier&, JSValue*, unsigned attributes); 89 90 90 91 JSVariableObjectData* d; … … 135 136 return true; 136 137 } 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; 137 143 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 } 138 150 } // namespace KJS 139 151
Note:
See TracChangeset
for help on using the changeset viewer.