Changeset 37747 in webkit
- Timestamp:
- Oct 20, 2008 2:27:44 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r37744 r37747 1 2008-10-16 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Cameron Zwarich. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=21683 6 Don't create intermediate StructureIDs for builtin objects 7 8 Second stage in reduce number of StructureIDs created when initializing the 9 JSGlobalObject. 10 11 - Use putDirectWithoutTransition for the remaining singleton objects to reduce 12 the number of StructureIDs create for about:blank from 132 to 73. 13 14 * kjs/ArrayConstructor.cpp: 15 (JSC::ArrayConstructor::ArrayConstructor): 16 * kjs/BooleanConstructor.cpp: 17 (JSC::BooleanConstructor::BooleanConstructor): 18 * kjs/BooleanPrototype.cpp: 19 (JSC::BooleanPrototype::BooleanPrototype): 20 * kjs/DateConstructor.cpp: 21 (JSC::DateConstructor::DateConstructor): 22 * kjs/ErrorConstructor.cpp: 23 (JSC::ErrorConstructor::ErrorConstructor): 24 * kjs/ErrorPrototype.cpp: 25 (JSC::ErrorPrototype::ErrorPrototype): 26 * kjs/FunctionConstructor.cpp: 27 (JSC::FunctionConstructor::FunctionConstructor): 28 * kjs/FunctionPrototype.cpp: 29 (JSC::FunctionPrototype::FunctionPrototype): 30 (JSC::FunctionPrototype::addFunctionProperties): 31 * kjs/FunctionPrototype.h: 32 (JSC::FunctionPrototype::createStructureID): 33 * kjs/InternalFunction.cpp: 34 * kjs/InternalFunction.h: 35 (JSC::InternalFunction::InternalFunction): 36 * kjs/JSGlobalObject.cpp: 37 (JSC::JSGlobalObject::reset): 38 * kjs/JSObject.h: 39 * kjs/MathObject.cpp: 40 (JSC::MathObject::MathObject): 41 * kjs/NumberConstructor.cpp: 42 (JSC::NumberConstructor::NumberConstructor): 43 * kjs/NumberPrototype.cpp: 44 (JSC::NumberPrototype::NumberPrototype): 45 * kjs/ObjectConstructor.cpp: 46 (JSC::ObjectConstructor::ObjectConstructor): 47 * kjs/RegExpConstructor.cpp: 48 (JSC::RegExpConstructor::RegExpConstructor): 49 * kjs/RegExpPrototype.cpp: 50 (JSC::RegExpPrototype::RegExpPrototype): 51 * kjs/StringConstructor.cpp: 52 (JSC::StringConstructor::StringConstructor): 53 * kjs/StringPrototype.cpp: 54 (JSC::StringPrototype::StringPrototype): 55 * kjs/StructureID.cpp: 56 (JSC::StructureID::dumpStatistics): 57 * kjs/StructureID.h: 58 (JSC::StructureID::setPrototypeWithoutTransition): 59 1 60 2008-10-20 Alp Toker <alp@nuanti.com> 2 61 -
trunk/JavaScriptCore/kjs/ArrayConstructor.cpp
r37684 r37747 37 37 { 38 38 // ECMA 15.4.3.1 Array.prototype 39 putDirect (exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);39 putDirectWithoutTransition(exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); 40 40 41 41 // no. of arguments for constructor 42 putDirect (exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);42 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); 43 43 } 44 44 -
trunk/JavaScriptCore/kjs/BooleanConstructor.cpp
r37684 r37747 32 32 : InternalFunction(&exec->globalData(), structure, Identifier(exec, booleanPrototype->classInfo()->className)) 33 33 { 34 putDirect (exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);34 putDirectWithoutTransition(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); 35 35 36 36 // no. of arguments for constructor 37 putDirect (exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);37 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); 38 38 } 39 39 -
trunk/JavaScriptCore/kjs/BooleanPrototype.cpp
r37684 r37747 42 42 setInternalValue(jsBoolean(false)); 43 43 44 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);45 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);44 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum); 45 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum); 46 46 } 47 47 -
trunk/JavaScriptCore/kjs/DateConstructor.cpp
r37684 r37747 55 55 : InternalFunction(&exec->globalData(), structure, Identifier(exec, datePrototype->classInfo()->className)) 56 56 { 57 putDirect (exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly);57 putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly); 58 58 59 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);60 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);61 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);59 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum); 60 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum); 61 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum); 62 62 63 putDirect (exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete);63 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete); 64 64 } 65 65 -
trunk/JavaScriptCore/kjs/ErrorConstructor.cpp
r37684 r37747 34 34 { 35 35 // ECMA 15.11.3.1 Error.prototype 36 putDirect (exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);37 putDirect (exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum);36 putDirectWithoutTransition(exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); 37 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), DontDelete | ReadOnly | DontEnum); 38 38 } 39 39 -
trunk/JavaScriptCore/kjs/ErrorPrototype.cpp
r37684 r37747 39 39 // The constructor will be added later in ErrorConstructor's constructor 40 40 41 putDirect (exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum);42 putDirect (exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum);41 putDirectWithoutTransition(exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum); 42 putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum); 43 43 44 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);44 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum); 45 45 } 46 46 -
trunk/JavaScriptCore/kjs/FunctionConstructor.cpp
r37684 r37747 38 38 : InternalFunction(&exec->globalData(), structure, Identifier(exec, functionPrototype->classInfo()->className)) 39 39 { 40 putDirect (exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);40 putDirectWithoutTransition(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); 41 41 42 42 // Number of arguments for constructor 43 putDirect (exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);43 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum); 44 44 } 45 45 -
trunk/JavaScriptCore/kjs/FunctionPrototype.cpp
r37684 r37747 37 37 static JSValuePtr functionProtoFuncCall(ExecState*, JSObject*, JSValuePtr, const ArgList&); 38 38 39 FunctionPrototype::FunctionPrototype(ExecState* exec )40 : InternalFunction(&exec->globalData() )39 FunctionPrototype::FunctionPrototype(ExecState* exec, PassRefPtr<StructureID> structure) 40 : InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier) 41 41 { 42 putDirect (exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);42 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum); 43 43 } 44 44 45 45 void FunctionPrototype::addFunctionProperties(ExecState* exec, StructureID* prototypeFunctionStructure) 46 46 { 47 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);48 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);49 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);47 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 48 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum); 49 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum); 50 50 } 51 51 -
trunk/JavaScriptCore/kjs/FunctionPrototype.h
r36726 r37747 28 28 class FunctionPrototype : public InternalFunction { 29 29 public: 30 FunctionPrototype(ExecState* );30 FunctionPrototype(ExecState*, PassRefPtr<StructureID>); 31 31 void addFunctionProperties(ExecState*, StructureID* prototypeFunctionStructure); 32 33 static PassRefPtr<StructureID> createStructureID(JSValuePtr proto) 34 { 35 return StructureID::create(proto, TypeInfo(ObjectType)); 36 } 32 37 33 38 private: -
trunk/JavaScriptCore/kjs/InternalFunction.cpp
r37681 r37747 38 38 } 39 39 40 InternalFunction::InternalFunction(JSGlobalData* globalData)41 : JSObject(globalData->nullProtoStructureID)42 {43 putDirect(globalData->propertyNames->name, jsString(globalData, globalData->propertyNames->nullIdentifier.ustring()), DontDelete | ReadOnly | DontEnum);44 }45 46 40 InternalFunction::InternalFunction(JSGlobalData* globalData, PassRefPtr<StructureID> structure, const Identifier& name) 47 41 : JSObject(structure) -
trunk/JavaScriptCore/kjs/InternalFunction.h
r37684 r37747 46 46 protected: 47 47 InternalFunction(PassRefPtr<StructureID> structure) : JSObject(structure) { } 48 InternalFunction(JSGlobalData*);49 48 InternalFunction(JSGlobalData*, PassRefPtr<StructureID>, const Identifier&); 50 49 -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r37684 r37747 201 201 // Prototypes 202 202 203 d()->functionPrototype = new (exec) FunctionPrototype(exec); 203 d()->functionPrototype = new (exec) FunctionPrototype(exec, FunctionPrototype::createStructureID(jsNull())); // The real prototype will be set once ObjectPrototype is created. 204 d()->prototypeFunctionStructure = PrototypeFunction::createStructureID(d()->functionPrototype); 205 d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get()); 206 d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructureID(jsNull()), d()->prototypeFunctionStructure.get()); 207 d()->functionPrototype->structureID()->setPrototypeWithoutTransition(d()->objectPrototype); 208 209 d()->emptyObjectStructure = d()->objectPrototype->inheritorID(); 210 204 211 d()->functionStructure = JSFunction::createStructureID(d()->functionPrototype); 205 212 d()->callbackFunctionStructure = JSCallbackFunction::createStructureID(d()->functionPrototype); 206 d()->prototypeFunctionStructure = PrototypeFunction::createStructureID(d()->functionPrototype);207 d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get());208 209 d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructureID(jsNull()), d()->prototypeFunctionStructure.get());210 d()->emptyObjectStructure = d()->objectPrototype->inheritorID();211 d()->functionPrototype->setPrototype(d()->objectPrototype);212 213 d()->argumentsStructure = Arguments::createStructureID(d()->objectPrototype); 213 214 d()->callbackConstructorStructure = JSCallbackConstructor::createStructureID(d()->objectPrototype); 214 215 d()->callbackObjectStructure = JSCallbackObject<JSObject>::createStructureID(d()->objectPrototype); 216 215 217 d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructureID(d()->objectPrototype)); 216 218 d()->arrayStructure = JSArray::createStructureID(d()->arrayPrototype); 217 219 d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructureID(d()->arrayPrototype); 220 218 221 d()->stringPrototype = new (exec) StringPrototype(exec, StringPrototype::createStructureID(d()->objectPrototype)); 219 222 d()->stringObjectStructure = StringObject::createStructureID(d()->stringPrototype); 223 220 224 d()->booleanPrototype = new (exec) BooleanPrototype(exec, BooleanPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get()); 221 225 d()->booleanObjectStructure = BooleanObject::createStructureID(d()->booleanPrototype); 226 222 227 d()->numberPrototype = new (exec) NumberPrototype(exec, NumberPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get()); 223 228 d()->numberObjectStructure = NumberObject::createStructureID(d()->numberPrototype); 229 224 230 d()->datePrototype = new (exec) DatePrototype(exec, DatePrototype::createStructureID(d()->objectPrototype)); 225 231 d()->dateStructure = DateInstance::createStructureID(d()->datePrototype); 232 226 233 d()->regExpPrototype = new (exec) RegExpPrototype(exec, RegExpPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get()); 227 234 d()->regExpStructure = RegExpObject::createStructureID(d()->regExpPrototype); 235 228 236 ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, ErrorPrototype::createStructureID(d()->objectPrototype), d()->prototypeFunctionStructure.get()); 229 237 d()->errorStructure = ErrorInstance::createStructureID(errorPrototype); … … 261 269 d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, URIErrorPrototype); 262 270 263 d()->functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);264 265 271 d()->objectPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, objectConstructor, DontEnum); 266 267 d()-> functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);268 d()-> arrayPrototype->putDirect(exec->propertyNames().constructor, arrayConstructor, DontEnum);269 d()-> booleanPrototype->putDirect(exec->propertyNames().constructor, booleanConstructor, DontEnum);270 d()-> stringPrototype->putDirect(exec->propertyNames().constructor, stringConstructor, DontEnum);271 d()-> numberPrototype->putDirect(exec->propertyNames().constructor, numberConstructor, DontEnum);272 d()-> datePrototype->putDirect(exec->propertyNames().constructor, dateConstructor, DontEnum);273 d()->regExpPrototype->putDirect(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);274 errorPrototype->putDirect(exec->propertyNames().constructor, d()->errorConstructor, DontEnum); 272 d()->functionPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, functionConstructor, DontEnum); 273 d()->arrayPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, arrayConstructor, DontEnum); 274 d()->booleanPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, booleanConstructor, DontEnum); 275 d()->stringPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, stringConstructor, DontEnum); 276 d()->numberPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, numberConstructor, DontEnum); 277 d()->datePrototype->putDirectWithoutTransition(exec->propertyNames().constructor, dateConstructor, DontEnum); 278 d()->regExpPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum); 279 errorPrototype->putDirectWithoutTransition(exec->propertyNames().constructor, d()->errorConstructor, DontEnum); 280 275 281 evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum); 276 282 rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum); … … 284 290 // FIXME: These properties could be handled by a static hash table. 285 291 286 putDirect (Identifier(exec, "Object"), objectConstructor, DontEnum);287 putDirect (Identifier(exec, "Function"), functionConstructor, DontEnum);288 putDirect (Identifier(exec, "Array"), arrayConstructor, DontEnum);289 putDirect (Identifier(exec, "Boolean"), booleanConstructor, DontEnum);290 putDirect (Identifier(exec, "String"), stringConstructor, DontEnum);291 putDirect (Identifier(exec, "Number"), numberConstructor, DontEnum);292 putDirect (Identifier(exec, "Date"), dateConstructor, DontEnum);293 putDirect (Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum);294 putDirect (Identifier(exec, "Error"), d()->errorConstructor, DontEnum);295 putDirect (Identifier(exec, "EvalError"), d()->evalErrorConstructor);296 putDirect (Identifier(exec, "RangeError"), d()->rangeErrorConstructor);297 putDirect (Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor);298 putDirect (Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor);299 putDirect (Identifier(exec, "TypeError"), d()->typeErrorConstructor);300 putDirect (Identifier(exec, "URIError"), d()->URIErrorConstructor);292 putDirectWithoutTransition(Identifier(exec, "Object"), objectConstructor, DontEnum); 293 putDirectWithoutTransition(Identifier(exec, "Function"), functionConstructor, DontEnum); 294 putDirectWithoutTransition(Identifier(exec, "Array"), arrayConstructor, DontEnum); 295 putDirectWithoutTransition(Identifier(exec, "Boolean"), booleanConstructor, DontEnum); 296 putDirectWithoutTransition(Identifier(exec, "String"), stringConstructor, DontEnum); 297 putDirectWithoutTransition(Identifier(exec, "Number"), numberConstructor, DontEnum); 298 putDirectWithoutTransition(Identifier(exec, "Date"), dateConstructor, DontEnum); 299 putDirectWithoutTransition(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum); 300 putDirectWithoutTransition(Identifier(exec, "Error"), d()->errorConstructor, DontEnum); 301 putDirectWithoutTransition(Identifier(exec, "EvalError"), d()->evalErrorConstructor); 302 putDirectWithoutTransition(Identifier(exec, "RangeError"), d()->rangeErrorConstructor); 303 putDirectWithoutTransition(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor); 304 putDirectWithoutTransition(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor); 305 putDirectWithoutTransition(Identifier(exec, "TypeError"), d()->typeErrorConstructor); 306 putDirectWithoutTransition(Identifier(exec, "URIError"), d()->URIErrorConstructor); 301 307 302 308 // Set global values. … … 313 319 314 320 d()->evalFunction = new (exec) GlobalEvalFunction(exec, GlobalEvalFunction::createStructureID(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this); 315 putDirectFunction (exec, d()->evalFunction, DontEnum);316 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);317 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);318 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);319 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);320 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);321 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);322 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);323 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);324 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);325 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);321 putDirectFunctionWithoutTransition(exec, d()->evalFunction, DontEnum); 322 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum); 323 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum); 324 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum); 325 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum); 326 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum); 327 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum); 328 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum); 329 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum); 330 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum); 331 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum); 326 332 #ifndef NDEBUG 327 putDirectFunction (exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);333 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum); 328 334 #endif 329 335 -
trunk/JavaScriptCore/kjs/JSObject.h
r37684 r37747 158 158 void putDirect(const Identifier& propertyName, JSValuePtr value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot); 159 159 void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0); 160 void putDirectWithoutTransition(const Identifier& propertyName, JSValuePtr value, unsigned attr );161 void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr );160 void putDirectWithoutTransition(const Identifier& propertyName, JSValuePtr value, unsigned attr = 0); 161 void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0); 162 162 163 163 // Fast access to known property offsets. -
trunk/JavaScriptCore/kjs/MathObject.cpp
r37684 r37747 87 87 : JSObject(structure) 88 88 { 89 putDirect (Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);90 putDirect (Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly);91 putDirect (Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly);92 putDirect (Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);93 putDirect (Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly);94 putDirect (Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly);95 putDirect (Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly);96 putDirect (Identifier(exec, "SQRT2"), jsNumber(exec, sqrt(2.0)), DontDelete | DontEnum | ReadOnly);89 putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly); 90 putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly); 91 putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly); 92 putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly); 93 putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly); 94 putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly); 95 putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly); 96 putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(exec, sqrt(2.0)), DontDelete | DontEnum | ReadOnly); 97 97 } 98 98 -
trunk/JavaScriptCore/kjs/NumberConstructor.cpp
r37684 r37747 58 58 { 59 59 // Number.Prototype 60 putDirect (exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly);60 putDirectWithoutTransition(exec->propertyNames().prototype, numberPrototype, DontEnum | DontDelete | ReadOnly); 61 61 62 62 // no. of arguments for constructor 63 putDirect (exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);63 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); 64 64 } 65 65 -
trunk/JavaScriptCore/kjs/NumberPrototype.cpp
r37684 r37747 52 52 // The constructor will be added later, after NumberConstructor has been constructed 53 53 54 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);55 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);56 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);57 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);58 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);59 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);54 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum); 55 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum); 56 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum); 57 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum); 58 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum); 59 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum); 60 60 } 61 61 -
trunk/JavaScriptCore/kjs/ObjectConstructor.cpp
r37684 r37747 33 33 { 34 34 // ECMA 15.2.3.1 35 putDirect (exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);35 putDirectWithoutTransition(exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly); 36 36 37 37 // no. of arguments for constructor 38 putDirect (exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);38 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); 39 39 } 40 40 -
trunk/JavaScriptCore/kjs/RegExpConstructor.cpp
r37684 r37747 109 109 { 110 110 // ECMA 15.10.5.1 RegExp.prototype 111 putDirect (exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);111 putDirectWithoutTransition(exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly); 112 112 113 113 // no. of arguments for constructor 114 putDirect (exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum);114 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum); 115 115 } 116 116 -
trunk/JavaScriptCore/kjs/RegExpPrototype.cpp
r37684 r37747 48 48 : JSObject(structure) 49 49 { 50 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);51 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);52 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);53 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);50 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum); 51 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum); 52 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum); 53 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum); 54 54 } 55 55 -
trunk/JavaScriptCore/kjs/StringConstructor.cpp
r37684 r37747 51 51 { 52 52 // ECMA 15.5.3.1 String.prototype 53 putDirect (exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);53 putDirectWithoutTransition(exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete); 54 54 55 55 // ECMA 15.5.3.2 fromCharCode() 56 putDirectFunction (exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);56 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum); 57 57 58 58 // no. of arguments for constructor 59 putDirect (exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete);59 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); 60 60 } 61 61 -
trunk/JavaScriptCore/kjs/StringPrototype.cpp
r37684 r37747 122 122 { 123 123 // The constructor will be added later, after StringConstructor has been built 124 putDirect (exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);124 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum); 125 125 } 126 126 -
trunk/JavaScriptCore/kjs/StructureID.cpp
r37684 r37747 58 58 void StructureID::dumpStatistics() 59 59 { 60 unsigned numberLeaf = 0; 60 61 unsigned numberUsingSingleSlot = 0; 62 unsigned numberSingletons = 0; 61 63 62 64 HashSet<StructureID*>::const_iterator end = liveStructureIDSet.end(); 63 65 for (HashSet<StructureID*>::const_iterator it = liveStructureIDSet.begin(); it != end; ++it) { 64 66 StructureID* structureID = *it; 65 if (structureID->m_usingSingleTransitionSlot) 66 ++numberUsingSingleSlot; 67 if (structureID->m_usingSingleTransitionSlot) { 68 if (!structureID->m_transitions.singleTransition) 69 ++numberLeaf; 70 else 71 ++numberUsingSingleSlot; 72 73 if (!structureID->m_previous && !structureID->m_transitions.singleTransition) 74 ++numberSingletons; 75 } 67 76 } 68 77 69 78 printf("Number of live StructureIDs: %d\n", liveStructureIDSet.size()); 70 79 printf("Number of StructureIDs using the single item optimization for transition map: %d\n", numberUsingSingleSlot); 80 printf("Number of StructureIDs that are leaf nodes: %d\n", numberLeaf); 81 printf("Number of StructureIDs that singletons: %d\n", numberSingletons); 71 82 } 72 83 #endif -
trunk/JavaScriptCore/kjs/StructureID.h
r37706 r37747 105 105 } 106 106 107 // These should be used with caution. 107 108 size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes); 109 void setPrototypeWithoutTransition(JSValuePtr prototype) { m_prototype = prototype; } 108 110 109 111 bool isDictionary() const { return m_isDictionary; }
Note: See TracChangeset
for help on using the changeset viewer.