Changeset 95318 in webkit
- Timestamp:
- Sep 16, 2011 1:32:15 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95316 r95318 1 2011-09-16 Gavin Barraclough <barraclough@apple.com> 2 3 Rationalize JSObject::putDirect* methods 4 https://bugs.webkit.org/show_bug.cgi?id=68274 5 6 Reviewed by Sam Weinig. 7 8 Delete the *Function variants. These are overall inefficient, 9 in the way they get the name back from the function rather 10 than just passing it in. 11 12 * JavaScriptCore.exp: 13 * jsc.cpp: 14 (GlobalObject::finishCreation): 15 (GlobalObject::addFunction): 16 * runtime/FunctionPrototype.cpp: 17 (JSC::FunctionPrototype::addFunctionProperties): 18 * runtime/JSGlobalObject.cpp: 19 (JSC::JSGlobalObject::reset): 20 * runtime/JSObject.cpp: 21 (JSC::JSObject::put): 22 (JSC::JSObject::putWithAttributes): 23 (JSC::JSObject::defineGetter): 24 (JSC::JSObject::defineSetter): 25 * runtime/JSObject.h: 26 (JSC::JSObject::putDirect): 27 (JSC::JSObject::putDirectWithoutTransition): 28 * runtime/Lookup.cpp: 29 (JSC::setUpStaticFunctionSlot): 30 * runtime/Lookup.h: 31 (JSC::lookupPut): 32 1 33 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 34 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r95229 r95318 133 133 __ZN3JSC12JSGlobalData13startSamplingEv 134 134 __ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE 135 __ZN3JSC12JSGlobalData14jsFunctionVPtrE 135 136 __ZN3JSC12JSGlobalData14resetDateCacheEv 136 137 __ZN3JSC12JSGlobalData14sharedInstanceEv … … 249 250 __ZN3JSC4Heap8capacityEv 250 251 __ZN3JSC4Heap9unprotectENS_7JSValueE 251 __ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi252 252 __ZN3JSC4Yarr11YarrPatternC1ERKNS_7UStringEbbPPKc 253 253 __ZN3JSC4Yarr11byteCompileERNS0_11YarrPatternEPN3WTF20BumpPointerAllocatorE 254 __ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi 254 255 __ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE 255 256 __ZN3JSC6JSCell11getCallDataERNS_8CallDataE … … 315 316 __ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb 316 317 __ZN3JSC8JSObject17preventExtensionsERNS_12JSGlobalDataE 317 __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj318 __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj319 318 __ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEj 320 319 __ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE -
trunk/Source/JavaScriptCore/jsc.cpp
r95108 r95318 163 163 { 164 164 Base::finishCreation(globalData, this); 165 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug)); 166 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint)); 167 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit)); 168 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "gc"), functionGC)); 165 166 addFunction(globalData, "debug", functionDebug, 1); 167 addFunction(globalData, "print", functionPrint, 1); 168 addFunction(globalData, "quit", functionQuit, 0); 169 addFunction(globalData, "gc", functionGC, 0); 169 170 #ifndef NDEBUG 170 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "releaseExecutableMemory"), functionReleaseExecutableMemory)); 171 #endif 172 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "version"), functionVersion)); 173 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "run"), functionRun)); 174 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "load"), functionLoad)); 175 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax)); 176 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline)); 177 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "preciseTime"), functionPreciseTime)); 178 171 addFunction(globalData, "releaseExecutableMemory", functionReleaseExecutableMemory, 0); 172 #endif 173 addFunction(globalData, "version", functionVersion, 1); 174 addFunction(globalData, "run", functionRun, 1); 175 addFunction(globalData, "load", functionLoad, 1); 176 addFunction(globalData, "checkSyntax", functionCheckSyntax, 1); 177 addFunction(globalData, "readline", functionReadline, 0); 178 addFunction(globalData, "preciseTime", functionPreciseTime, 0); 179 179 #if ENABLE(SAMPLING_FLAGS) 180 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));181 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));180 addFunction(globalData, "setSamplingFlags", functionSetSamplingFlags, 1); 181 addFunction(globalData, "clearSamplingFlags", functionClearSamplingFlags, 1); 182 182 #endif 183 183 … … 185 185 for (size_t i = 0; i < arguments.size(); ++i) 186 186 array->put(globalExec(), i, jsString(globalExec(), arguments[i])); 187 putDirect(globalExec()->globalData(), Identifier(globalExec(), "arguments"), array); 187 putDirect(globalData, Identifier(globalExec(), "arguments"), array); 188 } 189 190 void addFunction(JSGlobalData& globalData, const char* name, NativeFunction function, unsigned arguments) 191 { 192 Identifier identifier(globalExec(), name); 193 putDirect(globalData, identifier, JSFunction::create(globalExec(), this, functionStructure(), arguments, identifier, function)); 188 194 } 189 195 }; -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
r95108 r95318 51 51 void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction) 52 52 { 53 putDirectFunctionWithoutTransition(exec, JSFunction::create(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 53 JSFunction* toStringFunction = JSFunction::create(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString); 54 putDirectWithoutTransition(exec->globalData(), exec->propertyNames().toString, toStringFunction, DontEnum); 55 54 56 *applyFunction = JSFunction::create(exec, globalObject, functionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply); 55 putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum); 57 putDirectWithoutTransition(exec->globalData(), exec->propertyNames().apply, *applyFunction, DontEnum); 58 56 59 *callFunction = JSFunction::create(exec, globalObject, functionStructure, 1, exec->propertyNames().call, functionProtoFuncCall); 57 putDirect FunctionWithoutTransition(exec, *callFunction, DontEnum);60 putDirectWithoutTransition(exec->globalData(), exec->propertyNames().call, *callFunction, DontEnum); 58 61 } 59 62 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r94701 r95318 255 255 m_URIErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError")); 256 256 257 m_objectPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum);258 m_functionPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, functionConstructor, DontEnum);259 m_arrayPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, arrayConstructor, DontEnum);260 m_booleanPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, booleanConstructor, DontEnum);261 m_stringPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, stringConstructor, DontEnum);262 m_numberPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, numberConstructor, DontEnum);263 m_datePrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, dateConstructor, DontEnum);264 m_regExpPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum);265 errorPrototype->putDirect FunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum);266 267 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum);268 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Function"), functionConstructor, DontEnum);269 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Array"), arrayConstructor, DontEnum);270 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Boolean"), booleanConstructor, DontEnum);271 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "String"), stringConstructor, DontEnum);272 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Number"), numberConstructor, DontEnum);273 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Date"), dateConstructor, DontEnum);274 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "RegExp"), m_regExpConstructor.get(), DontEnum);275 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "Error"), m_errorConstructor.get(), DontEnum);276 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "EvalError"), m_evalErrorConstructor.get(), DontEnum);277 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "RangeError"), m_rangeErrorConstructor.get(), DontEnum);278 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "ReferenceError"), m_referenceErrorConstructor.get(), DontEnum);279 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "SyntaxError"), m_syntaxErrorConstructor.get(), DontEnum);280 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum);281 putDirect FunctionWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum);257 m_objectPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum); 258 m_functionPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, functionConstructor, DontEnum); 259 m_arrayPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, arrayConstructor, DontEnum); 260 m_booleanPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, booleanConstructor, DontEnum); 261 m_stringPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, stringConstructor, DontEnum); 262 m_numberPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, numberConstructor, DontEnum); 263 m_datePrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, dateConstructor, DontEnum); 264 m_regExpPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum); 265 errorPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum); 266 267 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum); 268 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Function"), functionConstructor, DontEnum); 269 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Array"), arrayConstructor, DontEnum); 270 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Boolean"), booleanConstructor, DontEnum); 271 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "String"), stringConstructor, DontEnum); 272 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Number"), numberConstructor, DontEnum); 273 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Date"), dateConstructor, DontEnum); 274 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "RegExp"), m_regExpConstructor.get(), DontEnum); 275 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Error"), m_errorConstructor.get(), DontEnum); 276 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "EvalError"), m_evalErrorConstructor.get(), DontEnum); 277 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "RangeError"), m_rangeErrorConstructor.get(), DontEnum); 278 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "ReferenceError"), m_referenceErrorConstructor.get(), DontEnum); 279 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "SyntaxError"), m_syntaxErrorConstructor.get(), DontEnum); 280 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum); 281 putDirectWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum); 282 282 283 283 m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval)); 284 putDirect FunctionWithoutTransition(exec, m_evalFunction.get(), DontEnum);284 putDirectWithoutTransition(exec->globalData(), exec->propertyNames().eval, m_evalFunction.get(), DontEnum); 285 285 286 286 GlobalPropertyInfo staticGlobals[] = { -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r95011 r95318 106 106 ASSERT(value); 107 107 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 108 JSGlobalData& globalData = exec->globalData(); 108 109 109 110 if (propertyName == exec->propertyNames().underscoreProto) { … … 118 119 } 119 120 120 if (!setPrototypeWithCycleCheck( exec->globalData(), value))121 if (!setPrototypeWithCycleCheck(globalData, value)) 121 122 throwError(exec, createError(exec, "cyclic __proto__ value")); 122 123 return; … … 128 129 prototype = obj->prototype(); 129 130 if (prototype.isNull()) { 130 if (!putDirectInternal( exec->globalData(), propertyName, value, 0, true, slot) && slot.isStrictMode())131 if (!putDirectInternal(globalData, propertyName, value, 0, true, slot, getJSFunction(globalData, value)) && slot.isStrictMode()) 131 132 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 132 133 return; … … 136 137 unsigned attributes; 137 138 JSCell* specificValue; 138 if ((m_structure->get( exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) {139 if ((m_structure->get(globalData, propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) { 139 140 if (slot.isStrictMode()) 140 141 throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError)); … … 143 144 144 145 for (JSObject* obj = this; ; obj = asObject(prototype)) { 145 if (JSValue gs = obj->getDirect( exec->globalData(), propertyName)) {146 if (JSValue gs = obj->getDirect(globalData, propertyName)) { 146 147 if (gs.isGetterSetter()) { 147 148 JSObject* setterFunc = asGetterSetter(gs)->setter(); … … 170 171 break; 171 172 } 172 173 if (!putDirectInternal( exec->globalData(), propertyName, value, 0, true, slot) && slot.isStrictMode())173 174 if (!putDirectInternal(globalData, propertyName, value, 0, true, slot, getJSFunction(globalData, value)) && slot.isStrictMode()) 174 175 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 175 176 return; … … 184 185 void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) 185 186 { 186 putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot );187 putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot, getJSFunction(*globalData, value)); 187 188 } 188 189 189 190 void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes) 190 191 { 191 putDirectInternal(*globalData, propertyName, value, attributes); 192 PutPropertySlot slot; 193 putDirectInternal(*globalData, propertyName, value, attributes, true, slot, getJSFunction(*globalData, value)); 192 194 } 193 195 … … 199 201 void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) 200 202 { 201 putDirectInternal(exec->globalData(), propertyName, value, attributes, checkReadOnly, slot); 203 JSGlobalData& globalData = exec->globalData(); 204 putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, getJSFunction(globalData, value)); 202 205 } 203 206 204 207 void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) 205 208 { 206 putDirectInternal(exec->globalData(), propertyName, value, attributes); 209 PutPropertySlot slot; 210 JSGlobalData& globalData = exec->globalData(); 211 putDirectInternal(globalData, propertyName, value, attributes, true, slot, getJSFunction(globalData, value)); 207 212 } 208 213 … … 338 343 PutPropertySlot slot; 339 344 GetterSetter* getterSetter = GetterSetter::create(exec); 340 putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot );345 putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot, 0); 341 346 342 347 // putDirect will change our Structure if we add a new property. For … … 368 373 PutPropertySlot slot; 369 374 GetterSetter* getterSetter = GetterSetter::create(exec); 370 putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot );375 putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot, 0); 371 376 372 377 // putDirect will change our Structure if we add a new property. For … … 565 570 if (offset != WTF::notFound) 566 571 putUndefinedAtDirectOffset(offset); 567 }568 569 void JSObject::putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr)570 {571 putDirectFunction(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);572 }573 574 void JSObject::putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr)575 {576 putDirectFunction(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);577 }578 579 void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr)580 {581 putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);582 }583 584 void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr)585 {586 putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);587 572 } 588 573 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r95229 r95318 181 181 bool putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&); 182 182 183 void putDirectFunction(JSGlobalData&, const Identifier& propertyName, JSCell*, unsigned attr = 0);184 void putDirectFunction(JSGlobalData&, const Identifier& propertyName, JSCell*, unsigned attr, bool checkReadOnly, PutPropertySlot&);185 void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);186 void putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr = 0);187 188 183 void putDirectWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr = 0); 189 void putDirectFunctionWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSCell* value, unsigned attr = 0);190 void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0);191 void putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr = 0);192 184 193 185 // Fast access to known property offsets. … … 302 294 303 295 bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&, JSCell*); 304 bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&);305 void putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue value, unsigned attr = 0);306 296 307 297 bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); … … 716 706 } 717 707 718 inline bool JSObject::putDirect Internal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)708 inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) 719 709 { 720 710 ASSERT(value); … … 724 714 } 725 715 726 inline void JSObject::putDirect Internal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)716 inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) 727 717 { 728 718 PutPropertySlot slot; … … 730 720 } 731 721 732 inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)733 {734 ASSERT(value);735 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));736 737 return putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, 0);738 }739 740 inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)741 {742 PutPropertySlot slot;743 putDirectInternal(globalData, propertyName, value, attributes, false, slot, 0);744 }745 746 722 inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 747 723 { 748 return putDirectInternal(globalData, propertyName, value, 0, false, slot, 0); 749 } 750 751 inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) 752 { 753 putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, value); 754 } 755 756 inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attr) 757 { 758 PutPropertySlot slot; 759 putDirectInternal(globalData, propertyName, value, attr, false, slot, value); 724 return putDirectInternal(globalData, propertyName, value, 0, false, slot, getJSFunction(globalData, value)); 760 725 } 761 726 … … 763 728 { 764 729 size_t currentCapacity = m_structure->propertyStorageCapacity(); 765 size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, 0); 766 if (currentCapacity != m_structure->propertyStorageCapacity()) 767 allocatePropertyStorage(globalData, currentCapacity, m_structure->propertyStorageCapacity()); 768 putDirectOffset(globalData, offset, value); 769 } 770 771 inline void JSObject::putDirectFunctionWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes) 772 { 773 size_t currentCapacity = m_structure->propertyStorageCapacity(); 774 size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, value); 730 size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, getJSFunction(globalData, value)); 775 731 if (currentCapacity != m_structure->propertyStorageCapacity()) 776 732 allocatePropertyStorage(globalData, currentCapacity, m_structure->propertyStorageCapacity()); -
trunk/Source/JavaScriptCore/runtime/Lookup.cpp
r95310 r95318 88 88 function = JSFunction::create(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, entry->function()); 89 89 90 thisObj->putDirect Function(exec->globalData(), propertyName, function, entry->attributes());90 thisObj->putDirect(exec->globalData(), propertyName, function, entry->attributes()); 91 91 location = thisObj->getDirectLocation(exec->globalData(), propertyName); 92 92 } -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r95310 r95318 334 334 if (entry->attributes() & Function) { // function: put as override property 335 335 if (LIKELY(value.isCell())) 336 thisObj->putDirect Function(exec->globalData(), propertyName, value.asCell());336 thisObj->putDirect(exec->globalData(), propertyName, value.asCell()); 337 337 else 338 338 thisObj->putDirect(exec->globalData(), propertyName, value);
Note: See TracChangeset
for help on using the changeset viewer.