Changeset 47292 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Aug 14, 2009, 1:18:09 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Arguments.h
r47022 r47292 29 29 #include "JSGlobalObject.h" 30 30 #include "Interpreter.h" 31 #include "ObjectConstructor.h" 31 32 32 33 namespace JSC { … … 99 100 100 101 void init(CallFrame*); 102 void initializeStandardProperties(CallFrame*); 101 103 102 104 OwnPtr<ArgumentsData> d; … … 132 134 , d(new ArgumentsData) 133 135 { 136 initializeStandardProperties(callFrame); 134 137 JSFunction* callee; 135 138 ptrdiff_t firstParameterIndex; … … 170 173 { 171 174 ASSERT(!callFrame->callee()->body()->parameterCount()); 172 175 176 initializeStandardProperties(callFrame); 173 177 unsigned numArguments = callFrame->argumentCount() - 1; 174 178 … … 238 242 } 239 243 244 245 inline void Arguments::initializeStandardProperties(CallFrame* callFrame) 246 { 247 putDirectFunction(callFrame->propertyNames().constructor, callFrame->lexicalGlobalObject()->objectConstructor(), DontEnum); 248 putDirectFunction(callFrame->propertyNames().toString, callFrame->lexicalGlobalObject()->objectToStringFunction(), DontEnum); 249 putDirectFunction(callFrame->propertyNames().toLocaleString, callFrame->lexicalGlobalObject()->objectToLocaleStringFunction(), DontEnum); 250 } 240 251 241 252 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSGlobalObject.cpp
r47271 r47292 211 211 d()->callFunction = callFunction; 212 212 d()->applyFunction = applyFunction; 213 d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get()); 213 NativeFunctionWrapper* objectToStringFunction = 0; 214 NativeFunctionWrapper* objectToLocaleStringFunction = 0; 215 d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get(), &objectToStringFunction, &objectToLocaleStringFunction); 216 d()->objectToStringFunction = objectToStringFunction; 217 d()->objectToLocaleStringFunction = objectToLocaleStringFunction; 214 218 d()->functionPrototype->structure()->setPrototypeWithoutTransition(d()->objectPrototype); 215 219 … … 218 222 d()->functionStructure = JSFunction::createStructure(d()->functionPrototype); 219 223 d()->callbackFunctionStructure = JSCallbackFunction::createStructure(d()->functionPrototype); 220 d()->argumentsStructure = Arguments::createStructure(d()->objectPrototype);221 224 d()->callbackConstructorStructure = JSCallbackConstructor::createStructure(d()->objectPrototype); 222 225 d()->callbackObjectStructure = JSCallbackObject<JSObject>::createStructure(d()->objectPrototype); 223 226 224 227 d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructure(d()->objectPrototype)); 228 d()->argumentsStructure = Arguments::createStructure(d()->arrayPrototype); 225 229 d()->arrayStructure = JSArray::createStructure(d()->arrayPrototype); 226 230 d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(d()->arrayPrototype); … … 257 261 // Constructors 258 262 259 JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());263 ObjectConstructor* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get()); 260 264 JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype); 261 265 JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get()); … … 271 275 RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(d()->functionPrototype); 272 276 277 d()->objectConstructor = objectConstructor; 273 278 d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, evalErrorPrototype); 274 279 d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, rangeErrorPrototype); … … 369 374 if (registerFile.globalObject() == this) 370 375 registerFile.markGlobals(markStack, &globalData()->heap); 371 376 377 markIfNeeded(markStack, d()->objectConstructor); 372 378 markIfNeeded(markStack, d()->regExpConstructor); 373 379 markIfNeeded(markStack, d()->errorConstructor); … … 382 388 markIfNeeded(markStack, d()->callFunction); 383 389 markIfNeeded(markStack, d()->applyFunction); 390 markIfNeeded(markStack, d()->objectToStringFunction); 391 markIfNeeded(markStack, d()->objectToLocaleStringFunction); 384 392 385 393 markIfNeeded(markStack, d()->objectPrototype); -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r47022 r47292 41 41 class GlobalEvalFunction; 42 42 class NativeErrorConstructor; 43 class ObjectConstructor; 43 44 class ProgramCodeBlock; 44 45 class PrototypeFunction; … … 61 62 , registerArraySize(0) 62 63 , globalScopeChain(NoScopeChain()) 64 , objectConstructor(0) 63 65 , regExpConstructor(0) 64 66 , errorConstructor(0) … … 72 74 , callFunction(0) 73 75 , applyFunction(0) 76 , objectToStringFunction(0) 77 , objectToLocaleStringFunction(0) 74 78 , objectPrototype(0) 75 79 , functionPrototype(0) … … 100 104 int recursion; 101 105 106 ObjectConstructor* objectConstructor; 102 107 RegExpConstructor* regExpConstructor; 103 108 ErrorConstructor* errorConstructor; … … 112 117 NativeFunctionWrapper* callFunction; 113 118 NativeFunctionWrapper* applyFunction; 119 NativeFunctionWrapper* objectToStringFunction; 120 NativeFunctionWrapper* objectToLocaleStringFunction; 114 121 115 122 ObjectPrototype* objectPrototype; … … 184 191 // replaces the global object's associated property. 185 192 193 ObjectConstructor* objectConstructor() const { return d()->objectConstructor; } 186 194 RegExpConstructor* regExpConstructor() const { return d()->regExpConstructor; } 187 195 … … 204 212 DatePrototype* datePrototype() const { return d()->datePrototype; } 205 213 RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; } 214 215 NativeFunctionWrapper* objectToStringFunction() const { return d()->objectToStringFunction; } 216 NativeFunctionWrapper* objectToLocaleStringFunction() const { return d()->objectToLocaleStringFunction; } 206 217 207 218 JSObject* methodCallDummy() const { return d()->methodCallDummy; } -
trunk/JavaScriptCore/runtime/ObjectPrototype.cpp
r43372 r47292 41 41 static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&); 42 42 43 ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure )43 ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure, NativeFunctionWrapper** toStringFunction, NativeFunctionWrapper** toLocaleStringFunction) 44 44 : JSObject(stucture) 45 45 { 46 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum); 47 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum); 46 NativeFunctionWrapper* toString = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString); 47 NativeFunctionWrapper* toLocaleString = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString); 48 *toStringFunction = toString; 49 *toLocaleStringFunction = toLocaleString; 50 putDirectFunctionWithoutTransition(exec, toString, DontEnum); 51 putDirectFunctionWithoutTransition(exec, toLocaleString, DontEnum); 48 52 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum); 49 53 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum); -
trunk/JavaScriptCore/runtime/ObjectPrototype.h
r43372 r47292 28 28 class ObjectPrototype : public JSObject { 29 29 public: 30 ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure );30 ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure, NativeFunctionWrapper** toStringFunction, NativeFunctionWrapper** toLocaleStringFunction); 31 31 }; 32 32
Note:
See TracChangeset
for help on using the changeset viewer.