Changeset 91194 in webkit
- Timestamp:
- Jul 18, 2011 10:47:13 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 100 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackConstructor.h
r84052 r91194 33 33 34 34 class JSCallbackConstructor : public JSObjectWithGlobalObject { 35 protected: 36 JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback); 35 37 public: 36 JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback); 38 static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback) 39 { 40 return new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback); 41 } 42 37 43 virtual ~JSCallbackConstructor(); 38 44 JSClassRef classRef() const { return m_class; } -
trunk/Source/JavaScriptCore/API/JSCallbackFunction.h
r84052 r91194 33 33 34 34 class JSCallbackFunction : public InternalFunction { 35 protected: 36 JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name); 37 35 38 public: 36 JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name); 39 static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name) 40 { 41 return new (allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(exec, globalObject, callback, name); 42 } 37 43 38 44 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/API/JSCallbackObject.h
r87588 r91194 117 117 template <class Base> 118 118 class JSCallbackObject : public Base { 119 p ublic:119 protected: 120 120 JSCallbackObject(ExecState*, JSGlobalObject*, Structure*, JSClassRef, void* data); 121 121 JSCallbackObject(JSGlobalData&, JSClassRef, Structure*); 122 // We'd like to use the placement version of operator new defined in JSCell, but 123 // we can't because Base is a template argument, so we just duplicate the same 124 // functionality here. 125 void* operator new(size_t, void* ptr) { return ptr; } 126 127 public: 128 static JSCallbackObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, void* data) 129 { 130 return new (allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, globalObject, structure, classRef, data); 131 } 132 static JSCallbackObject* create(JSGlobalData& globalData, JSClassRef classRef, Structure* structure) 133 { 134 return new (allocateCell<JSCallbackObject>(globalData.heap)) JSCallbackObject(globalData, classRef, structure); 135 } 122 136 123 137 void setPrivate(void* data); -
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r88587 r91194 561 561 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { 562 562 563 JSObject* o = new (exec) JSCallbackFunction(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName);563 JSObject* o = JSCallbackFunction::create(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName); 564 564 thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes); 565 565 return o; -
trunk/Source/JavaScriptCore/API/JSClassRef.cpp
r83751 r91194 252 252 if (!jsClassData.cachedPrototype) { 253 253 // Recursive, but should be good enough for our purposes 254 jsClassData.cachedPrototype.set(exec->globalData(), new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction254 jsClassData.cachedPrototype.set(exec->globalData(), JSCallbackObject<JSObjectWithGlobalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction 255 255 if (parentClass) { 256 256 if (JSObject* prototype = parentClass->prototype(exec)) -
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r86785 r91194 98 98 } 99 99 100 JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(*globalData, globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull()));100 JSGlobalObject* globalObject = JSCallbackObject<JSGlobalObject>::create(*globalData, globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull())); 101 101 ExecState* exec = globalObject->globalExec(); 102 102 JSValue prototype = globalObjectClass->prototype(exec); -
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r83751 r91194 82 82 return toRef(constructEmptyObject(exec)); 83 83 84 JSCallbackObject<JSObjectWithGlobalObject>* object = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);84 JSCallbackObject<JSObjectWithGlobalObject>* object = JSCallbackObject<JSObjectWithGlobalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data); 85 85 if (JSObject* prototype = jsClass->prototype(exec)) 86 86 object->setPrototype(exec->globalData(), prototype); … … 96 96 Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); 97 97 98 return toRef( new (exec) JSCallbackFunction(exec, exec->lexicalGlobalObject(), callAsFunction, nameID));98 return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, nameID)); 99 99 } 100 100 … … 108 108 jsPrototype = exec->lexicalGlobalObject()->objectPrototype(); 109 109 110 JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);110 JSCallbackConstructor* constructor = JSCallbackConstructor::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor); 111 111 constructor->putDirect(exec->globalData(), exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly); 112 112 return toRef(constructor); -
trunk/Source/JavaScriptCore/ChangeLog
r91171 r91194 1 2011-07-18 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 Refactor JSC to replace JSCell::operator new with static create method 4 https://bugs.webkit.org/show_bug.cgi?id=64466 5 6 Reviewed by Oliver Hunt (oliver@apple.com) and Darin Adler (darin@apple.com). 7 8 First step in a longer refactoring process to remove the use of 9 operator new overloading in order to allocate GC objects and to replace 10 this method with static create methods for each individual type of heap-allocated 11 JS object. This particular patch only deals with replacing uses of 12 operator new within JSC proper. Future patches will remove it from the 13 parts that interface with the DOM. Due to the DOM's continued dependence 14 on it, operator new has not actually been removed from JSCell. 15 16 * API/JSCallbackConstructor.h: 17 (JSC::JSCallbackConstructor::create): 18 * API/JSCallbackFunction.h: 19 (JSC::JSCallbackFunction::create): 20 * API/JSCallbackObject.h: 21 (JSC::JSCallbackObject::operator new): 22 (JSC::JSCallbackObject::create): 23 * API/JSCallbackObjectFunctions.h: 24 (JSC::::staticFunctionGetter): 25 * API/JSClassRef.cpp: 26 (OpaqueJSClass::prototype): 27 * API/JSContextRef.cpp: 28 * API/JSObjectRef.cpp: 29 (JSObjectMake): 30 (JSObjectMakeFunctionWithCallback): 31 (JSObjectMakeConstructor): 32 * JavaScriptCore.exp: 33 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 34 * bytecode/CodeBlock.cpp: 35 (JSC::CodeBlock::createActivation): 36 * bytecompiler/BytecodeGenerator.cpp: 37 (JSC::BytecodeGenerator::BytecodeGenerator): 38 * bytecompiler/BytecodeGenerator.h: 39 (JSC::BytecodeGenerator::makeFunction): 40 * bytecompiler/NodesCodegen.cpp: 41 (JSC::RegExpNode::emitBytecode): 42 * interpreter/Interpreter.cpp: 43 (JSC::Interpreter::privateExecute): 44 (JSC::Interpreter::retrieveArguments): 45 * jit/JITStubs.cpp: 46 (JSC::DEFINE_STUB_FUNCTION): 47 * jsc.cpp: 48 (GlobalObject::create): 49 (GlobalObject::GlobalObject): 50 (functionRun): 51 (jscmain): 52 * runtime/Arguments.h: 53 (JSC::Arguments::create): 54 (JSC::Arguments::createNoParameters): 55 * runtime/ArrayConstructor.cpp: 56 (JSC::constructArrayWithSizeQuirk): 57 * runtime/ArrayConstructor.h: 58 (JSC::ArrayConstructor::create): 59 * runtime/ArrayPrototype.cpp: 60 (JSC::arrayProtoFuncSplice): 61 * runtime/ArrayPrototype.h: 62 (JSC::ArrayPrototype::create): 63 * runtime/BooleanConstructor.cpp: 64 (JSC::constructBoolean): 65 (JSC::constructBooleanFromImmediateBoolean): 66 * runtime/BooleanConstructor.h: 67 (JSC::BooleanConstructor::create): 68 * runtime/BooleanObject.h: 69 (JSC::BooleanObject::create): 70 * runtime/BooleanPrototype.h: 71 (JSC::BooleanPrototype::create): 72 * runtime/DateConstructor.cpp: 73 (JSC::constructDate): 74 * runtime/DateConstructor.h: 75 (JSC::DateConstructor::create): 76 * runtime/DateInstance.h: 77 (JSC::DateInstance::create): 78 * runtime/DatePrototype.h: 79 (JSC::DatePrototype::create): 80 * runtime/Error.cpp: 81 (JSC::createError): 82 (JSC::createEvalError): 83 (JSC::createRangeError): 84 (JSC::createReferenceError): 85 (JSC::createSyntaxError): 86 (JSC::createTypeError): 87 (JSC::createURIError): 88 (JSC::StrictModeTypeErrorFunction::create): 89 (JSC::createTypeErrorFunction): 90 * runtime/ErrorConstructor.h: 91 (JSC::ErrorConstructor::create): 92 * runtime/ErrorInstance.cpp: 93 (JSC::ErrorInstance::ErrorInstance): 94 (JSC::ErrorInstance::create): 95 * runtime/ErrorInstance.h: 96 * runtime/ErrorPrototype.cpp: 97 (JSC::ErrorPrototype::ErrorPrototype): 98 * runtime/ErrorPrototype.h: 99 (JSC::ErrorPrototype::create): 100 * runtime/ExceptionHelpers.cpp: 101 (JSC::InterruptedExecutionError::InterruptedExecutionError): 102 (JSC::InterruptedExecutionError::create): 103 (JSC::createInterruptedExecutionException): 104 (JSC::TerminatedExecutionError::TerminatedExecutionError): 105 (JSC::TerminatedExecutionError::create): 106 (JSC::createTerminatedExecutionException): 107 * runtime/Executable.cpp: 108 (JSC::FunctionExecutable::FunctionExecutable): 109 (JSC::FunctionExecutable::fromGlobalCode): 110 * runtime/Executable.h: 111 (JSC::ExecutableBase::create): 112 (JSC::NativeExecutable::create): 113 (JSC::ScriptExecutable::ScriptExecutable): 114 (JSC::EvalExecutable::create): 115 (JSC::ProgramExecutable::create): 116 (JSC::FunctionExecutable::create): 117 (JSC::FunctionExecutable::make): 118 * runtime/FunctionConstructor.cpp: 119 (JSC::constructFunctionSkippingEvalEnabledCheck): 120 * runtime/FunctionConstructor.h: 121 (JSC::FunctionConstructor::create): 122 * runtime/FunctionPrototype.cpp: 123 (JSC::FunctionPrototype::addFunctionProperties): 124 * runtime/FunctionPrototype.h: 125 (JSC::FunctionPrototype::create): 126 * runtime/GetterSetter.h: 127 (JSC::GetterSetter::create): 128 * runtime/JSAPIValueWrapper.h: 129 (JSC::JSAPIValueWrapper::create): 130 (JSC::jsAPIValueWrapper): 131 * runtime/JSActivation.cpp: 132 (JSC::JSActivation::argumentsGetter): 133 * runtime/JSActivation.h: 134 (JSC::JSActivation::create): 135 * runtime/JSArray.h: 136 (JSC::JSArray::create): 137 * runtime/JSCell.h: 138 (JSC::JSCell::allocateCell): 139 * runtime/JSFunction.h: 140 (JSC::JSFunction::create): 141 * runtime/JSGlobalObject.cpp: 142 (JSC::JSGlobalObject::init): 143 (JSC::JSGlobalObject::reset): 144 * runtime/JSGlobalObject.h: 145 (JSC::constructEmptyArray): 146 (JSC::constructArray): 147 * runtime/JSNotAnObject.h: 148 (JSC::JSNotAnObject::create): 149 * runtime/JSONObject.h: 150 (JSC::JSONObject::create): 151 * runtime/JSObject.cpp: 152 (JSC::JSObject::defineGetter): 153 (JSC::JSObject::defineSetter): 154 (JSC::putDescriptor): 155 * runtime/JSObject.h: 156 (JSC::JSFinalObject::create): 157 * runtime/JSPropertyNameIterator.cpp: 158 (JSC::JSPropertyNameIterator::create): 159 * runtime/JSPropertyNameIterator.h: 160 (JSC::JSPropertyNameIterator::create): 161 * runtime/JSString.cpp: 162 (JSC::JSString::substringFromRope): 163 (JSC::JSString::replaceCharacter): 164 (JSC::StringObject::create): 165 * runtime/JSString.h: 166 (JSC::RopeBuilder::JSString): 167 (JSC::RopeBuilder::create): 168 (JSC::RopeBuilder::createHasOtherOwner): 169 (JSC::jsSingleCharacterString): 170 (JSC::jsSingleCharacterSubstring): 171 (JSC::jsNontrivialString): 172 (JSC::jsString): 173 (JSC::jsSubstring): 174 (JSC::jsOwnedString): 175 * runtime/JSValue.cpp: 176 (JSC::JSValue::toObjectSlowCase): 177 (JSC::JSValue::synthesizeObject): 178 (JSC::JSValue::synthesizePrototype): 179 * runtime/Lookup.cpp: 180 (JSC::setUpStaticFunctionSlot): 181 * runtime/MathObject.h: 182 (JSC::MathObject::create): 183 * runtime/NativeErrorConstructor.cpp: 184 (JSC::NativeErrorConstructor::NativeErrorConstructor): 185 * runtime/NativeErrorConstructor.h: 186 (JSC::NativeErrorConstructor::create): 187 * runtime/NativeErrorPrototype.h: 188 (JSC::NativeErrorPrototype::create): 189 * runtime/NumberConstructor.cpp: 190 (JSC::constructWithNumberConstructor): 191 * runtime/NumberConstructor.h: 192 (JSC::NumberConstructor::create): 193 * runtime/NumberObject.cpp: 194 (JSC::constructNumber): 195 * runtime/NumberObject.h: 196 (JSC::NumberObject::create): 197 * runtime/NumberPrototype.h: 198 (JSC::NumberPrototype::create): 199 * runtime/ObjectConstructor.h: 200 (JSC::ObjectConstructor::create): 201 * runtime/ObjectPrototype.h: 202 (JSC::ObjectPrototype::create): 203 * runtime/Operations.h: 204 (JSC::jsString): 205 * runtime/RegExp.cpp: 206 (JSC::RegExp::RegExp): 207 (JSC::RegExp::createWithoutCaching): 208 (JSC::RegExp::create): 209 * runtime/RegExp.h: 210 * runtime/RegExpCache.cpp: 211 (JSC::RegExpCache::lookupOrCreate): 212 * runtime/RegExpConstructor.cpp: 213 (JSC::RegExpConstructor::arrayOfMatches): 214 (JSC::constructRegExp): 215 * runtime/RegExpConstructor.h: 216 (JSC::RegExpConstructor::create): 217 * runtime/RegExpMatchesArray.h: 218 (JSC::RegExpMatchesArray::create): 219 * runtime/RegExpObject.h: 220 (JSC::RegExpObject::create): 221 * runtime/RegExpPrototype.cpp: 222 (JSC::regExpProtoFuncCompile): 223 * runtime/RegExpPrototype.h: 224 (JSC::RegExpPrototype::create): 225 * runtime/ScopeChain.h: 226 (JSC::ScopeChainNode::create): 227 (JSC::ScopeChainNode::push): 228 * runtime/SmallStrings.cpp: 229 (JSC::SmallStrings::createEmptyString): 230 (JSC::SmallStrings::createSingleCharacterString): 231 * runtime/StringConstructor.cpp: 232 (JSC::constructWithStringConstructor): 233 * runtime/StringConstructor.h: 234 (JSC::StringConstructor::create): 235 * runtime/StringObject.h: 236 (JSC::StringObject::create): 237 * runtime/StringObjectThatMasqueradesAsUndefined.h: 238 (JSC::StringObjectThatMasqueradesAsUndefined::create): 239 * runtime/StringPrototype.cpp: 240 (JSC::stringProtoFuncMatch): 241 (JSC::stringProtoFuncSearch): 242 * runtime/StringPrototype.h: 243 (JSC::StringPrototype::create): 244 * runtime/Structure.h: 245 (JSC::Structure::create): 246 (JSC::Structure::createStructure): 247 * runtime/StructureChain.h: 248 (JSC::StructureChain::create): 249 1 250 2011-07-17 Ryuan Choi <ryuan.choi@samsung.com> 2 251 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r91039 r91194 168 168 __ZN3JSC14JSGlobalObject6s_infoE 169 169 __ZN3JSC14JSGlobalObjectD2Ev 170 __ZN3JSC14JSGlobalObjectnwEmPNS_12JSGlobalDataE171 170 __ZN3JSC14MachineThreads16addCurrentThreadEv 172 171 __ZN3JSC14SamplingThread4stopEv … … 264 263 __ZN3JSC6JSLock9lockCountEv 265 264 __ZN3JSC6JSLockC1EPNS_9ExecStateE 266 __ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringENS_11RegExpFlagsE267 265 __ZN3JSC6RegExpD1Ev 266 __ZN3JSC6RegExp6createERNS_12JSGlobalDataERKNS_7UStringENS_11RegExpFlagsE 268 267 __ZN3JSC7JSArray13visitChildrenERNS_11SlotVisitorE 269 268 __ZN3JSC7JSArray15setSubclassDataEPv -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r91039 r91194 4 4 ??0CString@WTF@@QAE@PBDI@Z 5 5 ??0Collator@WTF@@QAE@PBD@Z 6 ??0DateInstance@JSC@@ QAE@PAVExecState@1@PAVStructure@1@N@Z6 ??0DateInstance@JSC@@IAE@PAVExecState@1@PAVStructure@1@N@Z 7 7 ??0DefaultGCActivityCallback@JSC@@QAE@PAVHeap@1@@Z 8 8 ??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z 9 9 ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z 10 10 ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@PAVJSGlobalObject@1@PAVStructure@1@ABVIdentifier@1@@Z 11 ??0JSArray@JSC@@ QAE@AAVJSGlobalData@1@PAVStructure@1@@Z12 ??0JSArray@JSC@@ QAE@AAVJSGlobalData@1@PAVStructure@1@ABVArgList@1@@Z11 ??0JSArray@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z 12 ??0JSArray@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@ABVArgList@1@@Z 13 13 ??0JSByteArray@JSC@@QAE@PAVExecState@1@PAVStructure@1@PAVByteArray@WTF@@@Z 14 ??0JSFunction@JSC@@ QAE@PAVExecState@1@PAVJSGlobalObject@1@PAVStructure@1@HABVIdentifier@1@P6I_J0@Z@Z14 ??0JSFunction@JSC@@AAE@PAVExecState@1@PAVJSGlobalObject@1@PAVStructure@1@HABVIdentifier@1@P6I_J0@Z@Z 15 15 ??0JSLock@JSC@@QAE@PAVExecState@1@@Z 16 16 ??0JSObjectWithGlobalObject@JSC@@IAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@PAVStructure@1@@Z … … 19 19 ??0Mutex@WTF@@QAE@XZ 20 20 ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z 21 ??0RegExpObject@JSC@@ QAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@@Z21 ??0RegExpObject@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@@Z 22 22 ??0SHA1@WTF@@QAE@XZ 23 ??0StringObject@JSC@@ QAE@PAVExecState@1@PAVStructure@1@ABVUString@1@@Z23 ??0StringObject@JSC@@IAE@PAVExecState@1@PAVStructure@1@ABVUString@1@@Z 24 24 ??0Structure@JSC@@AAE@AAVJSGlobalData@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z 25 25 ??0ThreadCondition@WTF@@QAE@XZ … … 41 41 ??1WTFThreadData@WTF@@QAE@XZ 42 42 ??1WeakHandleOwner@JSC@@UAE@XZ 43 ??2JSGlobalObject@JSC@@SAPAXIPAVJSGlobalData@1@@Z44 43 ??8JSC@@YA_NABVUString@0@0@Z 45 44 ??8WTF@@YA_NABVCString@0@0@Z … … 100 99 ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z 101 100 ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z 102 ?create@RegExp@JSC@@SAPAV12@ PAVJSGlobalData@2@ABVUString@2@W4RegExpFlags@2@@Z101 ?create@RegExp@JSC@@SAPAV12@AAVJSGlobalData@2@ABVUString@2@W4RegExpFlags@2@@Z 103 102 ?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z 104 103 ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r91095 r91194 1738 1738 ASSERT(needsFullScopeChain()); 1739 1739 ASSERT(!callFrame->uncheckedR(activationRegister()).jsValue()); 1740 JSActivation* activation = new (callFrame) JSActivation(callFrame, static_cast<FunctionExecutable*>(ownerExecutable()));1740 JSActivation* activation = JSActivation::create(callFrame->globalData(), callFrame, static_cast<FunctionExecutable*>(ownerExecutable())); 1741 1741 callFrame->uncheckedR(activationRegister()) = JSValue(activation); 1742 1742 callFrame->setScopeChain(callFrame->scopeChain()->push(activation)); -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r91164 r91194 247 247 globalObject->removeDirect(*m_globalData, function->ident()); // Newly declared functions overwrite existing properties. 248 248 249 JSValue value = new (exec) JSFunction(exec, makeFunction(exec, function), scopeChain);249 JSValue value = JSFunction::create(exec, makeFunction(exec, function), scopeChain); 250 250 int index = addGlobalVar(function->ident(), false); 251 251 globalObject->registerAt(index).set(*m_globalData, globalObject, value); -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r91095 r91194 480 480 FunctionExecutable* makeFunction(JSGlobalData* globalData, FunctionBodyNode* body) 481 481 { 482 return FunctionExecutable::create( globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());482 return FunctionExecutable::create(*globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine()); 483 483 } 484 484 -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r91095 r91194 126 126 if (dst == generator.ignoredResult()) 127 127 return 0; 128 return generator.emitNewRegExp(generator.finalDestination(dst), RegExp::create( generator.globalData(), m_pattern.ustring(), regExpFlags(m_flags.ustring())));128 return generator.emitNewRegExp(generator.finalDestination(dst), RegExp::create(*generator.globalData(), m_pattern.ustring(), regExpFlags(m_flags.ustring()))); 129 129 } 130 130 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r91164 r91194 1680 1680 goto vm_throw; 1681 1681 } 1682 callFrame->uncheckedR(dst) = JSValue( new (globalData) RegExpObject(callFrame->lexicalGlobalObject(), callFrame->scopeChain()->globalObject->regExpStructure(), regExp));1682 callFrame->uncheckedR(dst) = JSValue(RegExpObject::create(globalData, callFrame->lexicalGlobalObject(), callFrame->scopeChain()->globalObject->regExpStructure(), regExp)); 1683 1683 1684 1684 vPC += OPCODE_LENGTH(op_new_regexp); … … 3431 3431 } 3432 3432 if (!arguments) { 3433 Arguments* arguments = new (globalData) Arguments(callFrame);3433 Arguments* arguments = Arguments::create(globalData, callFrame); 3434 3434 callFrame->uncheckedR(argumentsRegister) = JSValue(arguments); 3435 3435 callFrame->uncheckedR(unmodifiedArgumentsRegister(argumentsRegister)) = JSValue(arguments); … … 4561 4561 int activationReg = vPC[1].u.operand; 4562 4562 if (!callFrame->r(activationReg).jsValue()) { 4563 JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable()));4563 JSActivation* activation = JSActivation::create(globalData, callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable())); 4564 4564 callFrame->r(activationReg) = JSValue(activation); 4565 4565 callFrame->setScopeChain(callFrame->scopeChain()->push(activation)); … … 4652 4652 4653 4653 if (!callFrame->r(dst).jsValue()) { 4654 Arguments* arguments = new (globalData) Arguments(callFrame);4654 Arguments* arguments = Arguments::create(globalData, callFrame); 4655 4655 callFrame->uncheckedR(dst) = JSValue(arguments); 4656 4656 callFrame->uncheckedR(unmodifiedArgumentsRegister(dst)) = JSValue(arguments); … … 5114 5114 if (JSValue arguments = functionCallFrame->uncheckedR(argumentsRegister).jsValue()) 5115 5115 return arguments; 5116 JSValue arguments = JSValue( new (callFrame) Arguments(functionCallFrame));5116 JSValue arguments = JSValue(Arguments::create(callFrame->globalData(), functionCallFrame)); 5117 5117 functionCallFrame->r(argumentsRegister) = arguments; 5118 5118 functionCallFrame->r(realArgumentsRegister) = arguments; … … 5120 5120 } 5121 5121 5122 Arguments* arguments = new (functionCallFrame) Arguments(functionCallFrame);5122 Arguments* arguments = Arguments::create(functionCallFrame->globalData(), functionCallFrame); 5123 5123 arguments->copyRegisters(functionCallFrame->globalData()); 5124 5124 return arguments; -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r91164 r91194 2053 2053 STUB_INIT_STACK_FRAME(stackFrame); 2054 2054 2055 JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionExecutable*>(stackFrame.callFrame->codeBlock()->ownerExecutable()));2055 JSActivation* activation = JSActivation::create(stackFrame.callFrame->globalData(), stackFrame.callFrame, static_cast<FunctionExecutable*>(stackFrame.callFrame->codeBlock()->ownerExecutable())); 2056 2056 stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->push(activation)); 2057 2057 return activation; … … 2101 2101 STUB_INIT_STACK_FRAME(stackFrame); 2102 2102 2103 Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame);2103 Arguments* arguments = Arguments::create(*stackFrame.globalData, stackFrame.callFrame); 2104 2104 return JSValue::encode(JSValue(arguments)); 2105 2105 } … … 2109 2109 STUB_INIT_STACK_FRAME(stackFrame); 2110 2110 2111 Arguments* arguments = new (stackFrame.globalData) Arguments(stackFrame.callFrame, Arguments::NoParameters);2111 Arguments* arguments = Arguments::createNoParameters(*stackFrame.globalData, stackFrame.callFrame); 2112 2112 return JSValue::encode(JSValue(arguments)); 2113 2113 } … … 3161 3161 } 3162 3162 3163 return new (stackFrame.globalData) RegExpObject(stackFrame.callFrame->lexicalGlobalObject(), stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), regExp);3163 return RegExpObject::create(*stackFrame.globalData, stackFrame.callFrame->lexicalGlobalObject(), stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), regExp); 3164 3164 } 3165 3165 -
trunk/Source/JavaScriptCore/jsc.cpp
r89887 r91194 144 144 145 145 class GlobalObject : public JSGlobalObject { 146 private: 147 GlobalObject(JSGlobalData&, Structure*, const Vector<UString>& arguments); 148 146 149 public: 147 GlobalObject(JSGlobalData&, Structure*, const Vector<UString>& arguments); 150 static GlobalObject* create(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments) 151 { 152 return new (allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure, arguments); 153 } 148 154 virtual UString className() const { return "global"; } 149 155 }; … … 154 160 : JSGlobalObject(globalData, structure) 155 161 { 156 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));157 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));158 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));159 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));162 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug)); 163 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint)); 164 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit)); 165 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "gc"), functionGC)); 160 166 #ifndef NDEBUG 161 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "releaseExecutableMemory"), functionReleaseExecutableMemory));162 #endif 163 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));164 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "run"), functionRun));165 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));166 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));167 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));167 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "releaseExecutableMemory"), functionReleaseExecutableMemory)); 168 #endif 169 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "version"), functionVersion)); 170 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "run"), functionRun)); 171 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "load"), functionLoad)); 172 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax)); 173 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline)); 168 174 169 175 #if ENABLE(SAMPLING_FLAGS) 170 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));171 putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));176 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags)); 177 putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags)); 172 178 #endif 173 179 … … 228 234 return JSValue::encode(throwError(exec, createError(exec, "Could not open file."))); 229 235 230 GlobalObject* globalObject = new (&exec->globalData()) GlobalObject(exec->globalData(), GlobalObject::createStructure(exec->globalData(), jsNull()), Vector<UString>());236 GlobalObject* globalObject = GlobalObject::create(exec->globalData(), GlobalObject::createStructure(exec->globalData(), jsNull()), Vector<UString>()); 231 237 232 238 StopWatch stopWatch; … … 553 559 parseArguments(argc, argv, options, globalData); 554 560 555 GlobalObject* globalObject = new (globalData) GlobalObject(*globalData, GlobalObject::createStructure(*globalData, jsNull()), options.arguments);561 GlobalObject* globalObject = GlobalObject::create(*globalData, GlobalObject::createStructure(*globalData, jsNull()), options.arguments); 556 562 bool success = runWithScripts(globalObject, options.scripts, options.dump); 557 563 if (options.interactive && success) -
trunk/Source/JavaScriptCore/runtime/Arguments.h
r84556 r91194 60 60 class Arguments : public JSNonFinalObject { 61 61 public: 62 static Arguments* create(JSGlobalData& globalData, CallFrame* callFrame) 63 { 64 return new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame); 65 } 66 67 static Arguments* createNoParameters(JSGlobalData& globalData, CallFrame* callFrame) 68 { 69 return new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame, NoParameters); 70 } 71 62 72 // Use an enum because otherwise gcc insists on doing a memory 63 73 // read. 64 74 enum { MaxArguments = 0x10000 }; 65 75 76 private: 66 77 enum NoParametersType { NoParameters }; 67 78 68 79 Arguments(CallFrame*); 69 80 Arguments(CallFrame*, NoParametersType); 81 82 public: 70 83 virtual ~Arguments(); 71 84 -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
r86727 r91194 80 80 if (n != args.at(0).toNumber(exec)) 81 81 return throwError(exec, createRangeError(exec, "Array size is not a small enough positive integer.")); 82 return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), n, CreateInitialized);82 return JSArray::create(exec->globalData(), globalObject->arrayStructure(), n, CreateInitialized); 83 83 } 84 84 85 85 // otherwise the array is constructed with the arguments in it 86 return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), args);86 return JSArray::create(exec->globalData(), globalObject->arrayStructure(), args); 87 87 } 88 88 -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h
r86727 r91194 29 29 30 30 class ArrayConstructor : public InternalFunction { 31 private: 32 ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*); 33 31 34 public: 32 ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*); 35 static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrPrototype) 36 { 37 return new (allocateCell<ArrayConstructor>(*exec->heap())) ArrayConstructor(exec, globalObject, structure, arrPrototype); 38 } 33 39 34 40 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r88506 r91194 583 583 } 584 584 585 JSArray* resObj = new (exec) JSArray(exec->globalData(), exec->lexicalGlobalObject()->arrayStructure(), deleteCount, CreateCompact);585 JSArray* resObj = JSArray::create(exec->globalData(), exec->lexicalGlobalObject()->arrayStructure(), deleteCount, CreateCompact); 586 586 JSValue result = resObj; 587 587 JSGlobalData& globalData = exec->globalData(); -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h
r86727 r91194 28 28 29 29 class ArrayPrototype : public JSArray { 30 private: 31 ArrayPrototype(JSGlobalObject*, Structure*); 32 30 33 public: 31 explicit ArrayPrototype(JSGlobalObject*, Structure*); 32 34 static ArrayPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 35 { 36 return new (allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure); 37 } 38 33 39 bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 34 40 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); -
trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
r84052 r91194 41 41 JSObject* constructBoolean(ExecState* exec, const ArgList& args) 42 42 { 43 BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure());43 BooleanObject* obj = BooleanObject::create(exec->globalData(), asInternalFunction(exec->callee())->globalObject()->booleanObjectStructure()); 44 44 obj->setInternalValue(exec->globalData(), jsBoolean(args.at(0).toBoolean(exec))); 45 45 return obj; … … 72 72 JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSGlobalObject* globalObject, JSValue immediateBooleanValue) 73 73 { 74 BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), globalObject->booleanObjectStructure());74 BooleanObject* obj = BooleanObject::create(exec->globalData(), globalObject->booleanObjectStructure()); 75 75 obj->setInternalValue(exec->globalData(), immediateBooleanValue); 76 76 return obj; -
trunk/Source/JavaScriptCore/runtime/BooleanConstructor.h
r84052 r91194 29 29 30 30 class BooleanConstructor : public InternalFunction { 31 private: 32 BooleanConstructor(ExecState*, JSGlobalObject*, Structure*, BooleanPrototype*); 33 31 34 public: 32 BooleanConstructor(ExecState*, JSGlobalObject*, Structure*, BooleanPrototype*); 35 static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* boolPrototype) 36 { 37 return new (allocateCell<BooleanConstructor>(*exec->heap())) BooleanConstructor(exec, globalObject, structure, boolPrototype); 38 } 33 39 34 40 private: -
trunk/Source/JavaScriptCore/runtime/BooleanObject.h
r84052 r91194 27 27 28 28 class BooleanObject : public JSWrapperObject { 29 protected: 30 BooleanObject(JSGlobalData&, Structure*); 31 29 32 public: 30 explicit BooleanObject(JSGlobalData&, Structure*); 31 33 static BooleanObject* create(JSGlobalData& globalData, Structure* structure) 34 { 35 return new (allocateCell<BooleanObject>(globalData.heap)) BooleanObject(globalData, structure); 36 } 37 32 38 static const ClassInfo s_info; 33 39 -
trunk/Source/JavaScriptCore/runtime/BooleanPrototype.h
r86727 r91194 27 27 28 28 class BooleanPrototype : public BooleanObject { 29 p ublic:29 private: 30 30 BooleanPrototype(ExecState*, JSGlobalObject*, Structure*); 31 31 32 public: 33 static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 34 { 35 return new (allocateCell<BooleanPrototype>(*exec->heap())) BooleanPrototype(exec, globalObject, structure); 36 } 37 32 38 static const ClassInfo s_info; 33 39 -
trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp
r88587 r91194 143 143 } 144 144 145 return new (exec) DateInstance(exec, globalObject->dateStructure(), value);145 return DateInstance::create(exec, globalObject->dateStructure(), value); 146 146 } 147 147 -
trunk/Source/JavaScriptCore/runtime/DateConstructor.h
r86727 r91194 29 29 30 30 class DateConstructor : public InternalFunction { 31 private: 32 DateConstructor(ExecState*, JSGlobalObject*, Structure*, DatePrototype*); 33 31 34 public: 32 DateConstructor(ExecState*, JSGlobalObject*, Structure*, DatePrototype*); 35 static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype) 36 { 37 return new (allocateCell<DateConstructor>(*exec->heap())) DateConstructor(exec, globalObject, structure, datePrototype); 38 } 33 39 34 40 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/runtime/DateInstance.h
r84052 r91194 31 31 32 32 class DateInstance : public JSWrapperObject { 33 protected: 34 DateInstance(ExecState*, Structure*, double); 35 DateInstance(ExecState*, Structure*); 36 33 37 public: 34 DateInstance(ExecState*, Structure*, double); 35 explicit DateInstance(ExecState*, Structure*); 36 38 static DateInstance* create(ExecState* exec, Structure* structure, double date) 39 { 40 return new (allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure, date); 41 } 42 static DateInstance* create(ExecState* exec, Structure* structure) 43 { 44 return new (allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure); 45 } 46 37 47 double internalNumber() const { return internalValue().uncheckedGetNumber(); } 38 48 -
trunk/Source/JavaScriptCore/runtime/DatePrototype.h
r84052 r91194 29 29 30 30 class DatePrototype : public DateInstance { 31 p ublic:31 private: 32 32 DatePrototype(ExecState*, JSGlobalObject*, Structure*); 33 33 34 public: 35 static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 36 { 37 return new (allocateCell<DatePrototype>(*exec->heap())) DatePrototype(exec, globalObject, structure); 38 } 34 39 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 35 40 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); -
trunk/Source/JavaScriptCore/runtime/Error.cpp
r84052 r91194 43 43 { 44 44 ASSERT(!message.isEmpty()); 45 return ErrorInstance::create( &globalObject->globalData(), globalObject->errorStructure(), message);45 return ErrorInstance::create(globalObject->globalData(), globalObject->errorStructure(), message); 46 46 } 47 47 … … 49 49 { 50 50 ASSERT(!message.isEmpty()); 51 return ErrorInstance::create( &globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message);51 return ErrorInstance::create(globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message); 52 52 } 53 53 … … 55 55 { 56 56 ASSERT(!message.isEmpty()); 57 return ErrorInstance::create( &globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message);57 return ErrorInstance::create(globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message); 58 58 } 59 59 … … 61 61 { 62 62 ASSERT(!message.isEmpty()); 63 return ErrorInstance::create( &globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message);63 return ErrorInstance::create(globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message); 64 64 } 65 65 … … 67 67 { 68 68 ASSERT(!message.isEmpty()); 69 return ErrorInstance::create( &globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message);69 return ErrorInstance::create(globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message); 70 70 } 71 71 … … 73 73 { 74 74 ASSERT(!message.isEmpty()); 75 return ErrorInstance::create( &globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message);75 return ErrorInstance::create(globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message); 76 76 } 77 77 … … 79 79 { 80 80 ASSERT(!message.isEmpty()); 81 return ErrorInstance::create( &globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message);81 return ErrorInstance::create(globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message); 82 82 } 83 83 … … 167 167 168 168 class StrictModeTypeErrorFunction : public InternalFunction { 169 p ublic:169 private: 170 170 StrictModeTypeErrorFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message) 171 171 : InternalFunction(&exec->globalData(), globalObject, structure, exec->globalData().propertyNames->emptyIdentifier) … … 173 173 { 174 174 } 175 176 public: 177 static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message) 178 { 179 return new (allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(exec, globalObject, structure, message); 180 } 175 181 176 182 static EncodedJSValue JSC_HOST_CALL constructThrowTypeError(ExecState* exec) … … 206 212 JSValue createTypeErrorFunction(ExecState* exec, const UString& message) 207 213 { 208 return new (exec) StrictModeTypeErrorFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message);214 return StrictModeTypeErrorFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->internalFunctionStructure(), message); 209 215 } 210 216 -
trunk/Source/JavaScriptCore/runtime/ErrorConstructor.h
r84052 r91194 30 30 31 31 class ErrorConstructor : public InternalFunction { 32 p ublic:32 private: 33 33 ErrorConstructor(ExecState*, JSGlobalObject*, Structure*, ErrorPrototype*); 34 34 35 public: 36 static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errPrototype) 37 { 38 return new (allocateCell<ErrorConstructor>(*exec->heap())) ErrorConstructor(exec, globalObject, structure, errPrototype); 39 } 40 35 41 private: 36 42 virtual ConstructType getConstructData(ConstructData&); -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp
r88559 r91194 26 26 const ClassInfo ErrorInstance::s_info = { "Error", &JSNonFinalObject::s_info, 0, 0 }; 27 27 28 ErrorInstance::ErrorInstance(JSGlobalData *globalData, Structure* structure)29 : JSNonFinalObject( *globalData, structure)28 ErrorInstance::ErrorInstance(JSGlobalData& globalData, Structure* structure) 29 : JSNonFinalObject(globalData, structure) 30 30 , m_appendSourceToMessage(false) 31 31 { 32 32 ASSERT(inherits(&s_info)); 33 putDirect( *globalData, globalData->propertyNames->message, jsString(globalData, ""), DontEnum);33 putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, ""), DontEnum); 34 34 } 35 35 36 ErrorInstance::ErrorInstance(JSGlobalData *globalData, Structure* structure, const UString& message)37 : JSNonFinalObject( *globalData, structure)36 ErrorInstance::ErrorInstance(JSGlobalData& globalData, Structure* structure, const UString& message) 37 : JSNonFinalObject(globalData, structure) 38 38 , m_appendSourceToMessage(false) 39 39 { 40 40 ASSERT(inherits(&s_info)); 41 putDirect( *globalData, globalData->propertyNames->message, jsString(globalData, message), DontEnum);41 putDirect(globalData, globalData.propertyNames->message, jsString(&globalData, message), DontEnum); 42 42 } 43 43 44 ErrorInstance* ErrorInstance::create(JSGlobalData *globalData, Structure* structure, const UString& message)44 ErrorInstance* ErrorInstance::create(JSGlobalData& globalData, Structure* structure, const UString& message) 45 45 { 46 return new ( globalData) ErrorInstance(globalData, structure, message);46 return new (allocateCell<ErrorInstance>(globalData.heap)) ErrorInstance(globalData, structure, message); 47 47 } 48 48 … … 50 50 { 51 51 if (message.isUndefined()) 52 return new ( exec) ErrorInstance(&exec->globalData(), structure);53 return new ( exec) ErrorInstance(&exec->globalData(), structure, message.toString(exec));52 return new (allocateCell<ErrorInstance>(*exec->heap())) ErrorInstance(exec->globalData(), structure); 53 return new (allocateCell<ErrorInstance>(*exec->heap())) ErrorInstance(exec->globalData(), structure, message.toString(exec)); 54 54 } 55 55 -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.h
r84052 r91194 35 35 } 36 36 37 static ErrorInstance* create(JSGlobalData *, Structure*, const UString&);37 static ErrorInstance* create(JSGlobalData&, Structure*, const UString&); 38 38 static ErrorInstance* create(ExecState*, Structure*, JSValue message); 39 39 … … 46 46 47 47 protected: 48 explicit ErrorInstance(JSGlobalData *, Structure*);49 explicit ErrorInstance(JSGlobalData *, Structure*, const UString&);48 explicit ErrorInstance(JSGlobalData&, Structure*); 49 explicit ErrorInstance(JSGlobalData&, Structure*, const UString&); 50 50 51 51 bool m_appendSourceToMessage; -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r91116 r91194 52 52 53 53 ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 54 : ErrorInstance( &exec->globalData(), structure)54 : ErrorInstance(exec->globalData(), structure) 55 55 { 56 56 putDirect(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum); -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.h
r86727 r91194 29 29 30 30 class ErrorPrototype : public ErrorInstance { 31 p ublic:31 protected: 32 32 ErrorPrototype(ExecState*, JSGlobalObject*, Structure*); 33 33 34 public: 35 static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 36 { 37 return new (allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, globalObject, structure); 38 } 39 34 40 static const ClassInfo s_info; 35 41 -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r84052 r91194 43 43 44 44 class InterruptedExecutionError : public JSNonFinalObject { 45 private: 46 InterruptedExecutionError(JSGlobalData& globalData) 47 : JSNonFinalObject(globalData, globalData.interruptedExecutionErrorStructure.get()) 48 { 49 } 50 45 51 public: 46 InterruptedExecutionError(JSGlobalData* globalData) 47 : JSNonFinalObject(*globalData, globalData->interruptedExecutionErrorStructure.get()) 52 static InterruptedExecutionError* create(JSGlobalData& globalData) 48 53 { 54 return new (allocateCell<InterruptedExecutionError>(globalData.heap)) InterruptedExecutionError(globalData); 49 55 } 50 56 … … 56 62 JSObject* createInterruptedExecutionException(JSGlobalData* globalData) 57 63 { 58 return new (globalData) InterruptedExecutionError(globalData);64 return InterruptedExecutionError::create(*globalData); 59 65 } 60 66 61 67 class TerminatedExecutionError : public JSNonFinalObject { 68 private: 69 TerminatedExecutionError(JSGlobalData& globalData) 70 : JSNonFinalObject(globalData, globalData.terminatedExecutionErrorStructure.get()) 71 { 72 } 73 62 74 public: 63 TerminatedExecutionError(JSGlobalData* globalData) 64 : JSNonFinalObject(*globalData, globalData->terminatedExecutionErrorStructure.get()) 75 static TerminatedExecutionError* create(JSGlobalData& globalData) 65 76 { 77 return new (allocateCell<TerminatedExecutionError>(globalData.heap)) TerminatedExecutionError(globalData); 66 78 } 67 79 … … 73 85 JSObject* createTerminatedExecutionException(JSGlobalData* globalData) 74 86 { 75 return new (globalData) TerminatedExecutionError(globalData);87 return TerminatedExecutionError::create(*globalData); 76 88 } 77 89 -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r91115 r91194 91 91 const ClassInfo FunctionExecutable::s_info = { "FunctionExecutable", &ScriptExecutable::s_info, 0, 0 }; 92 92 93 FunctionExecutable::FunctionExecutable(JSGlobalData *globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine)94 : ScriptExecutable(globalData ->functionExecutableStructure.get(), globalData, source, inStrictContext)93 FunctionExecutable::FunctionExecutable(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool inStrictContext, int firstLine, int lastLine) 94 : ScriptExecutable(globalData.functionExecutableStructure.get(), globalData, source, inStrictContext) 95 95 , m_numCapturedVariables(0) 96 96 , m_forceUsesArguments(forceUsesArguments) … … 485 485 ASSERT(body); 486 486 487 return FunctionExecutable::create( &exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());487 return FunctionExecutable::create(exec->globalData(), functionName, body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine()); 488 488 } 489 489 -
trunk/Source/JavaScriptCore/runtime/Executable.h
r90938 r91194 53 53 static const int NUM_PARAMETERS_IS_HOST = 0; 54 54 static const int NUM_PARAMETERS_NOT_COMPILED = -1; 55 56 p ublic:55 56 protected: 57 57 ExecutableBase(JSGlobalData& globalData, Structure* structure, int numParameters) 58 58 : JSCell(globalData, structure) … … 64 64 finalizer.leakHandle(); 65 65 #endif 66 } 67 68 public: 69 static ExecutableBase* create(JSGlobalData& globalData, Structure* structure, int numParameters) 70 { 71 return new (allocateCell<ExecutableBase>(globalData.heap)) ExecutableBase(globalData, structure, numParameters); 66 72 } 67 73 … … 167 173 { 168 174 if (!callThunk) 169 return new ( &globalData) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor);170 return new ( &globalData) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor);175 return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor); 176 return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor); 171 177 } 172 178 #else 173 179 static NativeExecutable* create(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor) 174 180 { 175 return new ( &globalData) NativeExecutable(globalData, function, constructor);181 return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor); 176 182 } 177 183 #endif … … 214 220 class ScriptExecutable : public ExecutableBase { 215 221 public: 216 ScriptExecutable(Structure* structure, JSGlobalData *globalData, const SourceCode& source, bool isInStrictContext)217 : ExecutableBase( *globalData, structure, NUM_PARAMETERS_NOT_COMPILED)222 ScriptExecutable(Structure* structure, JSGlobalData& globalData, const SourceCode& source, bool isInStrictContext) 223 : ExecutableBase(globalData, structure, NUM_PARAMETERS_NOT_COMPILED) 218 224 , m_source(source) 219 225 , m_features(isInStrictContext ? StrictModeFeature : 0) 220 226 { 221 227 #if ENABLE(CODEBLOCK_SAMPLING) 222 if (SamplingTool* sampler = globalData ->interpreter->sampler())228 if (SamplingTool* sampler = globalData.interpreter->sampler()) 223 229 sampler->notifyOfScope(*globalData, this); 224 230 #else … … 291 297 } 292 298 293 static EvalExecutable* create(ExecState* exec, const SourceCode& source, bool isInStrictContext) { return new (exec) EvalExecutable(exec, source, isInStrictContext); } 299 static EvalExecutable* create(ExecState* exec, const SourceCode& source, bool isInStrictContext) 300 { 301 return new (allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext); 302 } 294 303 295 304 #if ENABLE(JIT) … … 320 329 static ProgramExecutable* create(ExecState* exec, const SourceCode& source) 321 330 { 322 return new ( exec) ProgramExecutable(exec, source);331 return new (allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source); 323 332 } 324 333 … … 373 382 static FunctionExecutable* create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine) 374 383 { 375 return new ( exec) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);376 } 377 378 static FunctionExecutable* create(JSGlobalData *globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)379 { 380 return new ( globalData) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);384 return new (allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine); 385 } 386 387 static FunctionExecutable* create(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine) 388 { 389 return new (allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine); 381 390 } 382 391 383 392 JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain) 384 393 { 385 return new (exec) JSFunction(exec, this, scopeChain);394 return JSFunction::create(exec, this, scopeChain); 386 395 } 387 396 … … 480 489 481 490 private: 482 FunctionExecutable(JSGlobalData *, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine);491 FunctionExecutable(JSGlobalData&, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine); 483 492 FunctionExecutable(ExecState*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine); 484 493 -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r86837 r91194 113 113 } 114 114 115 ScopeChainNode* scopeChain = new (exec) ScopeChainNode(0, globalObject, &globalData, globalObject, exec->globalThisValue());116 return new (exec) JSFunction(exec, function, scopeChain);115 ScopeChainNode* scopeChain = ScopeChainNode::create(exec, 0, globalObject, &globalData, globalObject, exec->globalThisValue()); 116 return JSFunction::create(exec, function, scopeChain); 117 117 } 118 118 -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.h
r86100 r91194 29 29 30 30 class FunctionConstructor : public InternalFunction { 31 private: 32 FunctionConstructor(ExecState*, JSGlobalObject*, Structure*, FunctionPrototype*); 33 31 34 public: 32 FunctionConstructor(ExecState*, JSGlobalObject*, Structure*, FunctionPrototype*); 35 static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* funcPrototype) 36 { 37 return new (allocateCell<FunctionConstructor>(*exec->heap())) FunctionConstructor(exec, globalObject, structure, funcPrototype); 38 } 33 39 34 40 private: -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
r84052 r91194 46 46 void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction) 47 47 { 48 putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);49 *applyFunction = new (exec) JSFunction(exec, globalObject, functionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);48 putDirectFunctionWithoutTransition(exec, JSFunction::create(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 49 *applyFunction = JSFunction::create(exec, globalObject, functionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply); 50 50 putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum); 51 *callFunction = new (exec) JSFunction(exec, globalObject, functionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);51 *callFunction = JSFunction::create(exec, globalObject, functionStructure, 1, exec->propertyNames().call, functionProtoFuncCall); 52 52 putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum); 53 53 } -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.h
r84052 r91194 27 27 28 28 class FunctionPrototype : public InternalFunction { 29 private: 30 FunctionPrototype(ExecState*, JSGlobalObject*, Structure*); 31 29 32 public: 30 FunctionPrototype(ExecState*, JSGlobalObject*, Structure*); 33 static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 34 { 35 return new (allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(exec, globalObject, structure); 36 } 37 31 38 void addFunctionProperties(ExecState*, JSGlobalObject*, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction); 32 39 33 40 static Structure* createStructure(JSGlobalData& globalData, JSValue proto) 34 41 { -
trunk/Source/JavaScriptCore/runtime/GetterSetter.h
r86499 r91194 37 37 class GetterSetter : public JSCell { 38 38 friend class JIT; 39 public: 39 40 private: 40 41 GetterSetter(ExecState* exec) 41 42 : JSCell(exec->globalData(), exec->globalData().getterSetterStructure.get()) 42 43 { 44 } 45 46 public: 47 static GetterSetter* create(ExecState* exec) 48 { 49 return new (allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec); 43 50 } 44 51 -
trunk/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
r86499 r91194 43 43 44 44 static const ClassInfo s_info; 45 46 static JSAPIValueWrapper* create(ExecState* exec, JSValue value) 47 { 48 return new (allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec, value); 49 } 45 50 46 51 private: … … 57 62 inline JSValue jsAPIValueWrapper(ExecState* exec, JSValue value) 58 63 { 59 return new (exec) JSAPIValueWrapper(exec, value);64 return JSAPIValueWrapper::create(exec, value); 60 65 } 61 66 -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r87316 r91194 221 221 int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister); 222 222 223 JSValue arguments = JSValue( new (callFrame) Arguments(callFrame));223 JSValue arguments = JSValue(Arguments::create(callFrame->globalData(), callFrame)); 224 224 callFrame->uncheckedR(argumentsRegister) = arguments; 225 225 callFrame->uncheckedR(realArgumentsRegister) = arguments; -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r91095 r91194 41 41 42 42 class JSActivation : public JSVariableObject { 43 private: 43 44 typedef JSVariableObject Base; 45 JSActivation(CallFrame*, FunctionExecutable*); 46 44 47 public: 45 JSActivation(CallFrame*, FunctionExecutable*); 48 static JSActivation* create(JSGlobalData& globalData, CallFrame* callFrame, FunctionExecutable* funcExec) 49 { 50 return new (allocateCell<JSActivation>(globalData.heap)) JSActivation(callFrame, funcExec); 51 } 52 46 53 virtual ~JSActivation(); 47 54 -
trunk/Source/JavaScriptCore/runtime/JSArray.h
r87316 r91194 61 61 friend class Walker; 62 62 63 public: 64 JSArray(VPtrStealingHackType); 65 63 protected: 66 64 explicit JSArray(JSGlobalData&, Structure*); 67 65 JSArray(JSGlobalData&, Structure*, unsigned initialLength, ArrayCreationMode); 68 66 JSArray(JSGlobalData&, Structure*, const ArgList& initialValues); 67 68 public: 69 JSArray(VPtrStealingHackType); 69 70 virtual ~JSArray(); 70 71 72 static JSArray* create(JSGlobalData& globalData, Structure* structure) 73 { 74 return new (allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure); 75 } 76 77 static JSArray* create(JSGlobalData& globalData, Structure* structure, unsigned initialLength, ArrayCreationMode createMode) 78 { 79 return new (allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure, initialLength, createMode); 80 } 81 82 static JSArray* create(JSGlobalData& globalData, Structure* structure, const ArgList& initialValues) 83 { 84 return new (allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure, initialValues); 85 } 86 71 87 virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); 72 88 virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r91164 r91194 382 382 } 383 383 384 template <typename T> void* allocateCell(Heap& heap) 385 { 386 return heap.allocate(sizeof(T)); 387 } 388 384 389 } // namespace JSC 385 390 -
trunk/Source/JavaScriptCore/runtime/JSFunction.h
r90437 r91194 49 49 typedef JSObjectWithGlobalObject Base; 50 50 51 public:52 51 JSFunction(ExecState*, JSGlobalObject*, Structure*, int length, const Identifier&, NativeFunction); 53 52 JSFunction(ExecState*, JSGlobalObject*, Structure*, int length, const Identifier&, NativeExecutable*); 54 53 JSFunction(ExecState*, FunctionExecutable*, ScopeChainNode*); 54 55 public: 56 static JSFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, int length, const Identifier& ident, NativeFunction nativeFunc) 57 { 58 return new (allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, structure, length, ident, nativeFunc); 59 } 60 static JSFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, int length, const Identifier& ident, NativeExecutable* nativeExec) 61 { 62 return new (allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, structure, length, ident, nativeExec); 63 } 64 static JSFunction* create(ExecState* exec, FunctionExecutable* funcExec, ScopeChainNode* scopeChain) 65 { 66 return new (allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, funcExec, scopeChain); 67 } 68 55 69 virtual ~JSFunction(); 56 70 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r89465 r91194 125 125 126 126 m_globalData = Heap::heap(this)->globalData(); 127 m_globalScopeChain.set(*m_globalData, this, new (m_globalData.get()) ScopeChainNode(0, this, m_globalData.get(), this, thisValue));127 m_globalScopeChain.set(*m_globalData, this, ScopeChainNode::create(0, this, m_globalData.get(), this, thisValue)); 128 128 129 129 JSGlobalObject::globalExec()->init(0, 0, m_globalScopeChain.get(), CallFrame::noCaller(), 0, 0); … … 188 188 ExecState* exec = JSGlobalObject::globalExec(); 189 189 190 m_functionPrototype.set(exec->globalData(), this, new (exec) FunctionPrototype(exec, this, FunctionPrototype::createStructure(exec->globalData(), jsNull()))); // The real prototype will be set once ObjectPrototype is created.190 m_functionPrototype.set(exec->globalData(), this, FunctionPrototype::create(exec, this, FunctionPrototype::createStructure(exec->globalData(), jsNull()))); // The real prototype will be set once ObjectPrototype is created. 191 191 m_functionStructure.set(exec->globalData(), this, JSFunction::createStructure(exec->globalData(), m_functionPrototype.get())); 192 192 m_internalFunctionStructure.set(exec->globalData(), this, InternalFunction::createStructure(exec->globalData(), m_functionPrototype.get())); … … 196 196 m_callFunction.set(exec->globalData(), this, callFunction); 197 197 m_applyFunction.set(exec->globalData(), this, applyFunction); 198 m_objectPrototype.set(exec->globalData(), this, new (exec) ObjectPrototype(exec, this, ObjectPrototype::createStructure(exec->globalData(), jsNull())));198 m_objectPrototype.set(exec->globalData(), this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(exec->globalData(), jsNull()))); 199 199 m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get()); 200 200 … … 207 207 m_callbackObjectStructure.set(exec->globalData(), this, JSCallbackObject<JSObjectWithGlobalObject>::createStructure(exec->globalData(), m_objectPrototype.get())); 208 208 209 m_arrayPrototype.set(exec->globalData(), this, new (exec) ArrayPrototype(this, ArrayPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));209 m_arrayPrototype.set(exec->globalData(), this, ArrayPrototype::create(exec, this, ArrayPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); 210 210 m_arrayStructure.set(exec->globalData(), this, JSArray::createStructure(exec->globalData(), m_arrayPrototype.get())); 211 211 m_regExpMatchesArrayStructure.set(exec->globalData(), this, RegExpMatchesArray::createStructure(exec->globalData(), m_arrayPrototype.get())); 212 212 213 m_stringPrototype.set(exec->globalData(), this, new (exec) StringPrototype(exec, this, StringPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));213 m_stringPrototype.set(exec->globalData(), this, StringPrototype::create(exec, this, StringPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); 214 214 m_stringObjectStructure.set(exec->globalData(), this, StringObject::createStructure(exec->globalData(), m_stringPrototype.get())); 215 215 216 m_booleanPrototype.set(exec->globalData(), this, new (exec) BooleanPrototype(exec, this, BooleanPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));216 m_booleanPrototype.set(exec->globalData(), this, BooleanPrototype::create(exec, this, BooleanPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); 217 217 m_booleanObjectStructure.set(exec->globalData(), this, BooleanObject::createStructure(exec->globalData(), m_booleanPrototype.get())); 218 218 219 m_numberPrototype.set(exec->globalData(), this, new (exec) NumberPrototype(exec, this, NumberPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));219 m_numberPrototype.set(exec->globalData(), this, NumberPrototype::create(exec, this, NumberPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); 220 220 m_numberObjectStructure.set(exec->globalData(), this, NumberObject::createStructure(exec->globalData(), m_numberPrototype.get())); 221 221 222 m_datePrototype.set(exec->globalData(), this, new (exec) DatePrototype(exec, this, DatePrototype::createStructure(exec->globalData(), m_objectPrototype.get())));222 m_datePrototype.set(exec->globalData(), this, DatePrototype::create(exec, this, DatePrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); 223 223 m_dateStructure.set(exec->globalData(), this, DateInstance::createStructure(exec->globalData(), m_datePrototype.get())); 224 224 225 RegExp* emptyRegex = RegExp::create( &exec->globalData(), "", NoFlags);225 RegExp* emptyRegex = RegExp::create(exec->globalData(), "", NoFlags); 226 226 227 m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), emptyRegex));227 m_regExpPrototype.set(exec->globalData(), this, RegExpPrototype::create(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), emptyRegex)); 228 228 m_regExpStructure.set(exec->globalData(), this, RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get())); 229 229 230 230 m_methodCallDummy.set(exec->globalData(), this, constructEmptyObject(exec)); 231 231 232 ErrorPrototype* errorPrototype = new (exec) ErrorPrototype(exec, this, ErrorPrototype::createStructure(exec->globalData(), m_objectPrototype.get()));232 ErrorPrototype* errorPrototype = ErrorPrototype::create(exec, this, ErrorPrototype::createStructure(exec->globalData(), m_objectPrototype.get())); 233 233 m_errorStructure.set(exec->globalData(), this, ErrorInstance::createStructure(exec->globalData(), errorPrototype)); 234 234 235 235 // Constructors 236 236 237 JSCell* objectConstructor = new (exec) ObjectConstructor(exec, this, ObjectConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_objectPrototype.get());238 JSCell* functionConstructor = new (exec) FunctionConstructor(exec, this, FunctionConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionPrototype.get());239 JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, this, ArrayConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_arrayPrototype.get());240 JSCell* stringConstructor = new (exec) StringConstructor(exec, this, StringConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_stringPrototype.get());241 JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, this, BooleanConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_booleanPrototype.get());242 JSCell* numberConstructor = new (exec) NumberConstructor(exec, this, NumberConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_numberPrototype.get());243 JSCell* dateConstructor = new (exec) DateConstructor(exec, this, DateConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_datePrototype.get());244 245 m_regExpConstructor.set(exec->globalData(), this, new (exec) RegExpConstructor(exec, this, RegExpConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_regExpPrototype.get()));246 247 m_errorConstructor.set(exec->globalData(), this, new (exec) ErrorConstructor(exec, this, ErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), errorPrototype));237 JSCell* objectConstructor = ObjectConstructor::create(exec, this, ObjectConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_objectPrototype.get()); 238 JSCell* functionConstructor = FunctionConstructor::create(exec, this, FunctionConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_functionPrototype.get()); 239 JSCell* arrayConstructor = ArrayConstructor::create(exec, this, ArrayConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_arrayPrototype.get()); 240 JSCell* stringConstructor = StringConstructor::create(exec, this, StringConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_stringPrototype.get()); 241 JSCell* booleanConstructor = BooleanConstructor::create(exec, this, BooleanConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_booleanPrototype.get()); 242 JSCell* numberConstructor = NumberConstructor::create(exec, this, NumberConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_numberPrototype.get()); 243 JSCell* dateConstructor = DateConstructor::create(exec, this, DateConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_datePrototype.get()); 244 245 m_regExpConstructor.set(exec->globalData(), this, RegExpConstructor::create(exec, this, RegExpConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), m_regExpPrototype.get())); 246 247 m_errorConstructor.set(exec->globalData(), this, ErrorConstructor::create(exec, this, ErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()), errorPrototype)); 248 248 249 249 Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->globalData(), errorPrototype); 250 250 Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(exec->globalData(), m_functionPrototype.get()); 251 m_evalErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError"));252 m_rangeErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError"));253 m_referenceErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError"));254 m_syntaxErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "SyntaxError"));255 m_typeErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "TypeError"));256 m_URIErrorConstructor.set(exec->globalData(), this, new (exec) NativeErrorConstructor(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError"));251 m_evalErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "EvalError")); 252 m_rangeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "RangeError")); 253 m_referenceErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "ReferenceError")); 254 m_syntaxErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "SyntaxError")); 255 m_typeErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "TypeError")); 256 m_URIErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError")); 257 257 258 258 m_objectPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum); … … 282 282 putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum); 283 283 284 m_evalFunction.set(exec->globalData(), this, new (exec) JSFunction(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval));284 m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval)); 285 285 putDirectFunctionWithoutTransition(exec, m_evalFunction.get(), DontEnum); 286 286 287 287 GlobalPropertyInfo staticGlobals[] = { 288 GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, this, MathObject::createStructure(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete),288 GlobalPropertyInfo(Identifier(exec, "Math"), MathObject::create(exec, this, MathObject::createStructure(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete), 289 289 GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(), DontEnum | DontDelete | ReadOnly), 290 290 GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(std::numeric_limits<double>::infinity()), DontEnum | DontDelete | ReadOnly), 291 291 GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly), 292 GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(this, JSONObject::createStructure(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete)292 GlobalPropertyInfo(Identifier(exec, "JSON"), JSONObject::create(exec, this, JSONObject::createStructure(exec->globalData(), m_objectPrototype.get())), DontEnum | DontDelete) 293 293 }; 294 294 addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); … … 396 396 } 397 397 398 void* JSGlobalObject::operator new(size_t size, JSGlobalData* globalData)399 {400 return globalData->heap.allocate(size);401 }402 403 398 void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count) 404 399 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r89465 r91194 123 123 124 124 public: 125 void* operator new(size_t, JSGlobalData*);126 127 125 explicit JSGlobalObject(JSGlobalData& globalData, Structure* structure) 128 126 : JSVariableObject(globalData, structure, &m_symbolTable, 0) … … 288 286 289 287 void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray, size_t count); 290 291 void* operator new(size_t); // can only be allocated with JSGlobalData292 288 }; 293 289 … … 379 375 inline JSArray* constructEmptyArray(ExecState* exec, JSGlobalObject* globalObject) 380 376 { 381 return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure());377 return JSArray::create(exec->globalData(), globalObject->arrayStructure()); 382 378 } 383 379 … … 389 385 inline JSArray* constructEmptyArray(ExecState* exec, JSGlobalObject* globalObject, unsigned initialLength) 390 386 { 391 return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), initialLength, CreateInitialized);387 return JSArray::create(exec->globalData(), globalObject->arrayStructure(), initialLength, CreateInitialized); 392 388 } 393 389 … … 401 397 MarkedArgumentBuffer values; 402 398 values.append(singleItemValue); 403 return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), values);399 return JSArray::create(exec->globalData(), globalObject->arrayStructure(), values); 404 400 } 405 401 … … 411 407 inline JSArray* constructArray(ExecState* exec, JSGlobalObject* globalObject, const ArgList& values) 412 408 { 413 return new (exec) JSArray(exec->globalData(), globalObject->arrayStructure(), values);409 return JSArray::create(exec->globalData(), globalObject->arrayStructure(), values); 414 410 } 415 411 -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r84052 r91194 38 38 // any operations performed on the result of a failed toObject call. 39 39 class JSNotAnObject : public JSNonFinalObject { 40 p ublic:40 private: 41 41 JSNotAnObject(ExecState* exec) 42 42 : JSNonFinalObject(exec->globalData(), exec->globalData().notAnObjectStructure.get()) 43 43 { 44 } 45 46 public: 47 static JSNotAnObject* create(ExecState* exec) 48 { 49 return new (allocateCell<JSNotAnObject>(*exec->heap())) JSNotAnObject(exec); 44 50 } 45 51 -
trunk/Source/JavaScriptCore/runtime/JSONObject.h
r86499 r91194 34 34 35 35 class JSONObject : public JSObjectWithGlobalObject { 36 p ublic:36 private: 37 37 JSONObject(JSGlobalObject*, Structure*); 38 38 39 public: 40 static JSONObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 41 { 42 return new (allocateCell<JSONObject>(*exec->heap())) JSONObject(globalObject, structure); 43 } 44 39 45 static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) 40 46 { -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r91095 r91194 325 325 JSGlobalData& globalData = exec->globalData(); 326 326 PutPropertySlot slot; 327 GetterSetter* getterSetter = new (exec) GetterSetter(exec);327 GetterSetter* getterSetter = GetterSetter::create(exec); 328 328 putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot); 329 329 … … 350 350 351 351 PutPropertySlot slot; 352 GetterSetter* getterSetter = new (exec) GetterSetter(exec);352 GetterSetter* getterSetter = GetterSetter::create(exec); 353 353 putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot); 354 354 … … 636 636 if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) { 637 637 if (descriptor.isGenericDescriptor() && oldDescriptor.isAccessorDescriptor()) { 638 GetterSetter* accessor = new (exec) GetterSetter(exec);638 GetterSetter* accessor = GetterSetter::create(exec); 639 639 if (oldDescriptor.getter()) { 640 640 attributes |= Getter; -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r90950 r91194 360 360 static JSFinalObject* create(ExecState* exec, Structure* structure) 361 361 { 362 return new ( exec) JSFinalObject(exec->globalData(), structure);362 return new (allocateCell<JSFinalObject>(*exec->heap())) JSFinalObject(exec->globalData(), structure); 363 363 } 364 364 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
r87316 r91194 62 62 !o->structure()->typeInfo().overridesGetPropertyNames()) 63 63 numCacheableSlots = o->structure()->propertyStorageSize(); 64 65 JSPropertyNameIterator* jsPropertyNameIterator = new ( exec) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots);64 65 JSPropertyNameIterator* jsPropertyNameIterator = new (allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots); 66 66 67 67 if (o->structure()->isDictionary()) -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
r86499 r91194 45 45 public: 46 46 static JSPropertyNameIterator* create(ExecState*, JSObject*); 47 static JSPropertyNameIterator* create(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot) 48 { 49 return new (allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNameArrayData, numCacheableSlot); 50 } 47 51 48 52 static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r84934 r91194 200 200 } 201 201 if (substringFiberCount == 1) 202 return new (globalData) JSString(globalData, substringFibers[0]);202 return JSString::create(*globalData, substringFibers[0]); 203 203 if (substringFiberCount == 2) 204 return new (globalData) JSString(globalData, substringFibers[0], substringFibers[1]);205 return new (globalData) JSString(globalData, substringFibers[0], substringFibers[1], substringFibers[2]);204 return JSString::create(*globalData, substringFibers[0], substringFibers[1]); 205 return JSString::create(*globalData, substringFibers[0], substringFibers[1], substringFibers[2]); 206 206 } 207 207 … … 255 255 256 256 JSGlobalData* globalData = &exec->globalData(); 257 return JSValue( new (globalData) JSString(globalData, builder.release()));257 return JSValue(JSString::create(*globalData, builder.release())); 258 258 } 259 259 … … 299 299 inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string) 300 300 { 301 return new ( exec) StringObject(exec->globalData(), globalObject->stringObjectStructure(), string);301 return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure(), string); 302 302 } 303 303 -
trunk/Source/JavaScriptCore/runtime/JSString.h
r91095 r91194 181 181 Vector<WorkItem, 16> m_workQueue; 182 182 }; 183 184 ALWAYS_INLINE JSString(JSGlobalData* globalData, const UString& value) 185 : JSCell(*globalData, globalData->stringStructure.get()) 183 184 private: 185 ALWAYS_INLINE JSString(JSGlobalData& globalData, const UString& value) 186 : JSCell(globalData, globalData.stringStructure.get()) 186 187 , m_length(value.length()) 187 188 , m_value(value) … … 193 194 194 195 enum HasOtherOwnerType { HasOtherOwner }; 195 JSString(JSGlobalData *globalData, const UString& value, HasOtherOwnerType)196 : JSCell( *globalData, globalData->stringStructure.get())196 JSString(JSGlobalData& globalData, const UString& value, HasOtherOwnerType) 197 : JSCell(globalData, globalData.stringStructure.get()) 197 198 , m_length(value.length()) 198 199 , m_value(value) … … 201 202 ASSERT(!m_value.isNull()); 202 203 } 203 JSString(JSGlobalData *globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType)204 : JSCell( *globalData, globalData->stringStructure.get())204 JSString(JSGlobalData& globalData, PassRefPtr<StringImpl> value, HasOtherOwnerType) 205 : JSCell(globalData, globalData.stringStructure.get()) 205 206 , m_length(value->length()) 206 207 , m_value(value) … … 209 210 ASSERT(!m_value.isNull()); 210 211 } 211 JSString(JSGlobalData *globalData, PassRefPtr<RopeImpl> rope)212 : JSCell( *globalData, globalData->stringStructure.get())212 JSString(JSGlobalData& globalData, PassRefPtr<RopeImpl> rope) 213 : JSCell(globalData, globalData.stringStructure.get()) 213 214 , m_length(rope->length()) 214 215 , m_fiberCount(1) … … 218 219 // This constructor constructs a new string by concatenating s1 & s2. 219 220 // This should only be called with fiberCount <= 3. 220 JSString(JSGlobalData *globalData, unsigned fiberCount, JSString* s1, JSString* s2)221 : JSCell( *globalData, globalData->stringStructure.get())221 JSString(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, JSString* s2) 222 : JSCell(globalData, globalData.stringStructure.get()) 222 223 , m_length(s1->length() + s2->length()) 223 224 , m_fiberCount(fiberCount) … … 231 232 // This constructor constructs a new string by concatenating s1 & s2. 232 233 // This should only be called with fiberCount <= 3. 233 JSString(JSGlobalData *globalData, unsigned fiberCount, JSString* s1, const UString& u2)234 : JSCell( *globalData, globalData->stringStructure.get())234 JSString(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, const UString& u2) 235 : JSCell(globalData, globalData.stringStructure.get()) 235 236 , m_length(s1->length() + u2.length()) 236 237 , m_fiberCount(fiberCount) … … 244 245 // This constructor constructs a new string by concatenating s1 & s2. 245 246 // This should only be called with fiberCount <= 3. 246 JSString(JSGlobalData *globalData, unsigned fiberCount, const UString& u1, JSString* s2)247 : JSCell( *globalData, globalData->stringStructure.get())247 JSString(JSGlobalData& globalData, unsigned fiberCount, const UString& u1, JSString* s2) 248 : JSCell(globalData, globalData.stringStructure.get()) 248 249 , m_length(u1.length() + s2->length()) 249 250 , m_fiberCount(fiberCount) … … 272 273 273 274 // This constructor constructs a new string by concatenating u1 & u2. 274 JSString(JSGlobalData *globalData, const UString& u1, const UString& u2)275 : JSCell( *globalData, globalData->stringStructure.get())275 JSString(JSGlobalData& globalData, const UString& u1, const UString& u2) 276 : JSCell(globalData, globalData.stringStructure.get()) 276 277 , m_length(u1.length() + u2.length()) 277 278 , m_fiberCount(2) … … 284 285 285 286 // This constructor constructs a new string by concatenating u1, u2 & u3. 286 JSString(JSGlobalData *globalData, const UString& u1, const UString& u2, const UString& u3)287 : JSCell( *globalData, globalData->stringStructure.get())287 JSString(JSGlobalData& globalData, const UString& u1, const UString& u2, const UString& u3) 288 : JSCell(globalData, globalData.stringStructure.get()) 288 289 , m_length(u1.length() + u2.length() + u3.length()) 289 290 , m_fiberCount(s_maxInternalRopeLength) … … 294 295 appendStringInConstruct(index, u3); 295 296 ASSERT(index <= s_maxInternalRopeLength); 297 } 298 299 public: 300 static JSString* create(JSGlobalData& globalData, const UString& value) 301 { 302 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value); 303 } 304 static JSString* createHasOtherOwner(JSGlobalData& globalData, const UString& value) 305 { 306 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value, HasOtherOwner); 307 } 308 static JSString* createHasOtherOwner(JSGlobalData& globalData, PassRefPtr<StringImpl> value) 309 { 310 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, value, HasOtherOwner); 311 } 312 static JSString* create(JSGlobalData& globalData, PassRefPtr<RopeImpl> rope) 313 { 314 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, rope); 315 } 316 static JSString* create(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, JSString* s2) 317 { 318 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, s1, s2); 319 } 320 static JSString* create(JSGlobalData& globalData, unsigned fiberCount, JSString* s1, const UString& u2) 321 { 322 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, s1, u2); 323 } 324 static JSString* create(JSGlobalData& globalData, unsigned fiberCount, const UString& u1, JSString* s2) 325 { 326 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, fiberCount, u1, s2); 327 } 328 static JSString* create(ExecState* exec, JSValue v1, JSValue v2, JSValue v3) 329 { 330 return new (allocateCell<JSString>(*exec->heap())) JSString(exec, v1, v2, v3); 331 } 332 static JSString* create(JSGlobalData& globalData, const UString& u1, const UString& u2) 333 { 334 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, u1, u2); 335 } 336 static JSString* create(JSGlobalData& globalData, const UString& u1, const UString& u2, const UString& u3) 337 { 338 return new (allocateCell<JSString>(globalData.heap)) JSString(globalData, u1, u2, u3); 296 339 } 297 340 … … 443 486 if (c <= maxSingleCharacterString) 444 487 return globalData->smallStrings.singleCharacterString(globalData, c); 445 return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(&c, 1)));488 return fixupVPtr(globalData, JSString::create(*globalData, UString(&c, 1))); 446 489 } 447 490 … … 453 496 if (c <= maxSingleCharacterString) 454 497 return globalData->smallStrings.singleCharacterString(globalData, c); 455 return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(StringImpl::create(s.impl(), offset, 1))));498 return fixupVPtr(globalData, JSString::create(*globalData, UString(StringImpl::create(s.impl(), offset, 1)))); 456 499 } 457 500 … … 461 504 ASSERT(s[0]); 462 505 ASSERT(s[1]); 463 return fixupVPtr(globalData, new (globalData) JSString(globalData, s));506 return fixupVPtr(globalData, JSString::create(*globalData, s)); 464 507 } 465 508 … … 467 510 { 468 511 ASSERT(s.length() > 1); 469 return fixupVPtr(globalData, new (globalData) JSString(globalData, s));512 return fixupVPtr(globalData, JSString::create(*globalData, s)); 470 513 } 471 514 … … 489 532 return globalData->smallStrings.singleCharacterString(globalData, c); 490 533 } 491 return fixupVPtr(globalData, new (globalData) JSString(globalData, s));534 return fixupVPtr(globalData, JSString::create(*globalData, s)); 492 535 } 493 536 … … 517 560 return globalData->smallStrings.singleCharacterString(globalData, c); 518 561 } 519 return fixupVPtr(globalData, new (globalData) JSString(globalData, UString(StringImpl::create(s.impl(), offset, length)), JSString::HasOtherOwner));562 return fixupVPtr(globalData, JSString::createHasOtherOwner(*globalData, UString(StringImpl::create(s.impl(), offset, length)))); 520 563 } 521 564 … … 530 573 return globalData->smallStrings.singleCharacterString(globalData, c); 531 574 } 532 return fixupVPtr(globalData, new (globalData) JSString(globalData, s, JSString::HasOtherOwner));575 return fixupVPtr(globalData, JSString::createHasOtherOwner(*globalData, s)); 533 576 } 534 577 -
trunk/Source/JavaScriptCore/runtime/JSValue.cpp
r88587 r91194 66 66 ASSERT(isUndefinedOrNull()); 67 67 throwError(exec, createNotAnObjectError(exec, *this)); 68 return new (exec) JSNotAnObject(exec);68 return JSNotAnObject::create(exec); 69 69 } 70 70 … … 91 91 ASSERT(isUndefinedOrNull()); 92 92 throwError(exec, createNotAnObjectError(exec, *this)); 93 return new (exec) JSNotAnObject(exec);93 return JSNotAnObject::create(exec); 94 94 } 95 95 … … 104 104 ASSERT(isUndefinedOrNull()); 105 105 throwError(exec, createNotAnObjectError(exec, *this)); 106 return new (exec) JSNotAnObject(exec);106 return JSNotAnObject::create(exec); 107 107 } 108 108 -
trunk/Source/JavaScriptCore/runtime/Lookup.cpp
r88604 r91194 81 81 #if ENABLE(JIT) 82 82 if (entry->generator()) 83 function = new (exec) JSFunction(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator()));83 function = JSFunction::create(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, exec->globalData().getHostFunction(entry->function(), entry->generator())); 84 84 else 85 85 #endif 86 function = new (exec) JSFunction(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, entry->function());86 function = JSFunction::create(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, entry->function()); 87 87 88 88 thisObj->putDirectFunction(exec->globalData(), propertyName, function, entry->attributes()); -
trunk/Source/JavaScriptCore/runtime/MathObject.h
r84052 r91194 27 27 28 28 class MathObject : public JSObjectWithGlobalObject { 29 p ublic:29 private: 30 30 MathObject(ExecState*, JSGlobalObject*, Structure*); 31 31 32 public: 33 static MathObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 34 { 35 return new (allocateCell<MathObject>(*exec->heap())) MathObject(exec, globalObject, structure); 36 } 32 37 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 33 38 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
r86499 r91194 38 38 ASSERT(inherits(&s_info)); 39 39 40 NativeErrorPrototype* prototype = new (exec) NativeErrorPrototype(exec, globalObject, prototypeStructure, nameAndMessage, this);40 NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, nameAndMessage, this); 41 41 42 42 putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5 -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
r84556 r91194 31 31 32 32 class NativeErrorConstructor : public InternalFunction { 33 p ublic:33 private: 34 34 NativeErrorConstructor(ExecState*, JSGlobalObject*, Structure*, Structure* prototypeStructure, const UString&); 35 35 36 public: 37 static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& nameAndMessage) 38 { 39 return new (allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(exec, globalObject, structure, prototypeStructure, nameAndMessage); 40 } 41 36 42 static const ClassInfo s_info; 37 43 -
trunk/Source/JavaScriptCore/runtime/NativeErrorPrototype.h
r91116 r91194 28 28 29 29 class NativeErrorPrototype : public ErrorPrototype { 30 private: 31 NativeErrorPrototype(ExecState*, JSGlobalObject*, Structure*, const UString&, NativeErrorConstructor*); 32 30 33 public: 31 NativeErrorPrototype(ExecState*, JSGlobalObject*, Structure*, const UString&, NativeErrorConstructor*); 34 static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor) 35 { 36 return new (allocateCell<NativeErrorPrototype>(*exec->heap())) NativeErrorPrototype(exec, globalObject, structure, nameAndMessage, constructor); 37 } 32 38 }; 33 39 -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp
r88587 r91194 105 105 static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec) 106 106 { 107 NumberObject* object = new (exec) NumberObject(exec->globalData(), asInternalFunction(exec->callee())->globalObject()->numberObjectStructure());107 NumberObject* object = NumberObject::create(exec->globalData(), asInternalFunction(exec->callee())->globalObject()->numberObjectStructure()); 108 108 double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0; 109 109 object->setInternalValue(exec->globalData(), jsNumber(n)); -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.h
r84052 r91194 29 29 30 30 class NumberConstructor : public InternalFunction { 31 private: 32 NumberConstructor(ExecState*, JSGlobalObject*, Structure*, NumberPrototype*); 33 31 34 public: 32 NumberConstructor(ExecState*, JSGlobalObject*, Structure*, NumberPrototype*); 35 static NumberConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, NumberPrototype* numPrototype) 36 { 37 return new (allocateCell<NumberConstructor>(*exec->heap())) NumberConstructor(exec, globalObject, structure, numPrototype); 38 } 33 39 34 40 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); -
trunk/Source/JavaScriptCore/runtime/NumberObject.cpp
r84052 r91194 45 45 NumberObject* constructNumber(ExecState* exec, JSGlobalObject* globalObject, JSValue number) 46 46 { 47 NumberObject* object = new (exec) NumberObject(exec->globalData(), globalObject->numberObjectStructure());47 NumberObject* object = NumberObject::create(exec->globalData(), globalObject->numberObjectStructure()); 48 48 object->setInternalValue(exec->globalData(), number); 49 49 return object; -
trunk/Source/JavaScriptCore/runtime/NumberObject.h
r84052 r91194 27 27 28 28 class NumberObject : public JSWrapperObject { 29 protected: 30 NumberObject(JSGlobalData&, Structure*); 31 29 32 public: 30 explicit NumberObject(JSGlobalData&, Structure*); 33 static NumberObject* create(JSGlobalData& globalData, Structure* structure) 34 { 35 return new (allocateCell<NumberObject>(globalData.heap)) NumberObject(globalData, structure); 36 } 31 37 32 38 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/runtime/NumberPrototype.h
r86727 r91194 27 27 28 28 class NumberPrototype : public NumberObject { 29 p ublic:29 private: 30 30 NumberPrototype(ExecState*, JSGlobalObject*, Structure*); 31 31 32 public: 33 static NumberPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 34 { 35 return new (allocateCell<NumberPrototype>(*exec->heap())) NumberPrototype(exec, globalObject, structure); 36 } 37 32 38 static const ClassInfo s_info; 33 39 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h
r84052 r91194 29 29 30 30 class ObjectConstructor : public InternalFunction { 31 private: 32 ObjectConstructor(ExecState*, JSGlobalObject*, Structure*, ObjectPrototype*); 33 31 34 public: 32 ObjectConstructor(ExecState*, JSGlobalObject*, Structure*, ObjectPrototype*); 35 static ObjectConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objPrototype) 36 { 37 return new (allocateCell<ObjectConstructor>(*exec->heap())) ObjectConstructor(exec, globalObject, structure, objPrototype); 38 } 33 39 34 40 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h
r86727 r91194 27 27 28 28 class ObjectPrototype : public JSNonFinalObject { 29 private: 30 ObjectPrototype(ExecState*, JSGlobalObject*, Structure*); 31 29 32 public: 30 ObjectPrototype(ExecState*, JSGlobalObject*, Structure*); 33 static ObjectPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 34 { 35 return new (allocateCell<ObjectPrototype>(*exec->heap())) ObjectPrototype(exec, globalObject, structure); 36 } 31 37 32 38 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/runtime/Operations.h
r90401 r91194 50 50 51 51 if (fiberCount <= JSString::s_maxInternalRopeLength) 52 return new (globalData) JSString(globalData, fiberCount, s1, s2);52 return JSString::create(*globalData, fiberCount, s1, s2); 53 53 54 54 JSString::RopeBuilder ropeBuilder(fiberCount); … … 57 57 ropeBuilder.append(s1); 58 58 ropeBuilder.append(s2); 59 return new (globalData) JSString(globalData, ropeBuilder.release());59 return JSString::create(*globalData, ropeBuilder.release()); 60 60 } 61 61 … … 75 75 76 76 if (fiberCount <= JSString::s_maxInternalRopeLength) 77 return new (globalData) JSString(globalData, fiberCount, u1, s2);77 return JSString::create(*globalData, fiberCount, u1, s2); 78 78 79 79 JSString::RopeBuilder ropeBuilder(fiberCount); … … 82 82 ropeBuilder.append(u1); 83 83 ropeBuilder.append(s2); 84 return new (globalData) JSString(globalData, ropeBuilder.release());84 return JSString::create(*globalData, ropeBuilder.release()); 85 85 } 86 86 … … 100 100 101 101 if (fiberCount <= JSString::s_maxInternalRopeLength) 102 return new (globalData) JSString(globalData, fiberCount, s1, u2);102 return JSString::create(*globalData, fiberCount, s1, u2); 103 103 104 104 JSString::RopeBuilder ropeBuilder(fiberCount); … … 107 107 ropeBuilder.append(s1); 108 108 ropeBuilder.append(u2); 109 return new (globalData) JSString(globalData, ropeBuilder.release());109 return JSString::create(*globalData, ropeBuilder.release()); 110 110 } 111 111 … … 122 122 123 123 JSGlobalData* globalData = &exec->globalData(); 124 return new (globalData) JSString(globalData, u1, u2);124 return JSString::create(*globalData, u1, u2); 125 125 } 126 126 … … 143 143 144 144 JSGlobalData* globalData = &exec->globalData(); 145 return new (globalData) JSString(globalData, u1, u2, u3);145 return JSString::create(*globalData, u1, u2, u3); 146 146 } 147 147 … … 161 161 JSGlobalData* globalData = &exec->globalData(); 162 162 if (fiberCount == 3) 163 return new (globalData) JSString(exec, strings[0].jsValue(), strings[1].jsValue(), strings[2].jsValue());163 return JSString::create(exec, strings[0].jsValue(), strings[1].jsValue(), strings[2].jsValue()); 164 164 165 165 JSString::RopeBuilder ropeBuilder(fiberCount); … … 186 186 return throwOutOfMemoryError(exec); 187 187 188 return new (globalData) JSString(globalData, ropeBuilder.release());188 return JSString::create(*globalData, ropeBuilder.release()); 189 189 } 190 190 … … 233 233 234 234 JSGlobalData* globalData = &exec->globalData(); 235 return new (globalData) JSString(globalData, ropeBuilder.release());235 return JSString::create(*globalData, ropeBuilder.release()); 236 236 } 237 237 -
trunk/Source/JavaScriptCore/runtime/RegExp.cpp
r90415 r91194 77 77 }; 78 78 79 RegExp::RegExp(JSGlobalData *globalData, const UString& patternString, RegExpFlags flags)80 : JSCell( *globalData, globalData->regExpStructure.get())79 RegExp::RegExp(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags) 80 : JSCell(globalData, globalData.regExpStructure.get()) 81 81 , m_state(NotCompiled) 82 82 , m_patternString(patternString) … … 100 100 } 101 101 102 RegExp* RegExp::create(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags) 103 { 104 return globalData->regExpCache()->lookupOrCreate(patternString, flags); 102 RegExp* RegExp::createWithoutCaching(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags) 103 { 104 return new (allocateCell<RegExp>(globalData.heap)) RegExp(globalData, patternString, flags); 105 } 106 107 RegExp* RegExp::create(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags) 108 { 109 return globalData.regExpCache()->lookupOrCreate(patternString, flags); 105 110 } 106 111 -
trunk/Source/JavaScriptCore/runtime/RegExp.h
r90415 r91194 39 39 class RegExp : public JSCell { 40 40 public: 41 static RegExp* create(JSGlobalData *, const UString& pattern, RegExpFlags);41 static RegExp* create(JSGlobalData&, const UString& pattern, RegExpFlags); 42 42 ~RegExp(); 43 43 … … 76 76 private: 77 77 friend class RegExpCache; 78 RegExp(JSGlobalData* globalData, const UString& pattern, RegExpFlags); 78 RegExp(JSGlobalData&, const UString&, RegExpFlags); 79 80 static RegExp* createWithoutCaching(JSGlobalData&, const UString&, RegExpFlags); 79 81 80 82 enum RegExpState { -
trunk/Source/JavaScriptCore/runtime/RegExpCache.cpp
r87529 r91194 39 39 if (result != m_weakCache.end()) 40 40 return result->second.get(); 41 RegExp* regExp = new (m_globalData) RegExp(m_globalData, patternString, flags);41 RegExp* regExp = RegExp::createWithoutCaching(*m_globalData, patternString, flags); 42 42 #if ENABLE(REGEXP_TRACING) 43 43 m_globalData->addRegExpToTrace(regExp); -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r89946 r91194 154 154 JSObject* RegExpConstructor::arrayOfMatches(ExecState* exec) const 155 155 { 156 return new (exec) RegExpMatchesArray(exec, d.get());156 return RegExpMatchesArray::create(exec, d.get()); 157 157 } 158 158 … … 305 305 if (callAsConstructor) { 306 306 RegExp* regExp = static_cast<RegExpObject*>(asObject(arg0))->regExp(); 307 return new (exec) RegExpObject(globalObject, globalObject->regExpStructure(), regExp);307 return RegExpObject::create(exec, globalObject, globalObject->regExpStructure(), regExp); 308 308 } 309 309 return asObject(arg0); … … 323 323 } 324 324 325 RegExp* regExp = RegExp::create( &exec->globalData(), pattern, flags);325 RegExp* regExp = RegExp::create(exec->globalData(), pattern, flags); 326 326 if (!regExp->isValid()) 327 327 return throwError(exec, createSyntaxError(exec, regExp->errorMessage())); 328 return new (exec) RegExpObject(exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp);328 return RegExpObject::create(exec, exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp); 329 329 } 330 330 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h
r89946 r91194 57 57 58 58 class RegExpConstructor : public InternalFunction { 59 private: 60 RegExpConstructor(ExecState*, JSGlobalObject*, Structure*, RegExpPrototype*); 61 59 62 public: 60 RegExpConstructor(ExecState*, JSGlobalObject*, Structure*, RegExpPrototype*); 63 static RegExpConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype) 64 { 65 return new (allocateCell<RegExpConstructor>(*exec->heap())) RegExpConstructor(exec, globalObject, structure, regExpPrototype); 66 } 61 67 62 68 static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) -
trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
r55262 r91194 26 26 27 27 class RegExpMatchesArray : public JSArray { 28 private: 29 RegExpMatchesArray(ExecState*, RegExpConstructorPrivate*); 30 28 31 public: 29 RegExpMatchesArray(ExecState*, RegExpConstructorPrivate*); 32 static RegExpMatchesArray* create(ExecState* exec, RegExpConstructorPrivate* ctorPrivate) 33 { 34 return new (allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec, ctorPrivate); 35 } 30 36 virtual ~RegExpMatchesArray(); 31 37 -
trunk/Source/JavaScriptCore/runtime/RegExpObject.h
r87346 r91194 28 28 29 29 class RegExpObject : public JSObjectWithGlobalObject { 30 protected: 31 RegExpObject(JSGlobalObject*, Structure*, RegExp*); 32 30 33 public: 34 static RegExpObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 35 { 36 return new (allocateCell<RegExpObject>(*exec->heap())) RegExpObject(globalObject, structure, regExp); 37 } 38 39 static RegExpObject* create(JSGlobalData& globalData, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 40 { 41 return new (allocateCell<RegExpObject>(globalData.heap)) RegExpObject(globalObject, structure, regExp); 42 } 43 31 44 typedef JSObjectWithGlobalObject Base; 32 45 33 RegExpObject(JSGlobalObject*, Structure*, RegExp*);34 46 virtual ~RegExpObject(); 35 47 -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
r89895 r91194 123 123 return throwVMError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor.")); 124 124 } 125 regExp = RegExp::create( &exec->globalData(), pattern, flags);125 regExp = RegExp::create(exec->globalData(), pattern, flags); 126 126 } 127 127 -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.h
r87346 r91194 28 28 29 29 class RegExpPrototype : public RegExpObject { 30 p ublic:30 protected: 31 31 RegExpPrototype(ExecState*, JSGlobalObject*, Structure*, RegExp*); 32 32 33 public: 34 static RegExpPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 35 { 36 return new (allocateCell<RegExpPrototype>(*exec->heap())) RegExpPrototype(exec, globalObject, structure, regExp); 37 } 38 33 39 static const ClassInfo s_info; 34 40 -
trunk/Source/JavaScriptCore/runtime/ScopeChain.h
r89077 r91194 35 35 36 36 class ScopeChainNode : public JSCell { 37 p ublic:37 private: 38 38 ScopeChainNode(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 39 39 : JSCell(*globalData, globalData->scopeChainNodeStructure.get()) … … 48 48 } 49 49 50 public: 51 static ScopeChainNode* create(ExecState* exec, ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 52 { 53 return new (allocateCell<ScopeChainNode>(*exec->heap())) ScopeChainNode(next, object, globalData, globalObject, globalThis); 54 } 55 static ScopeChainNode* create(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 56 { 57 return new (allocateCell<ScopeChainNode>(globalData->heap)) ScopeChainNode(next, object, globalData, globalObject, globalThis); 58 } 59 50 60 JSGlobalData* globalData; 51 61 WriteBarrier<ScopeChainNode> next; … … 77 87 { 78 88 ASSERT(o); 79 return new (globalData) ScopeChainNode(this, o, globalData, globalObject.get(), globalThis.get());89 return ScopeChainNode::create(this, o, globalData, globalObject.get(), globalThis.get()); 80 90 } 81 91 -
trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp
r87448 r91194 107 107 { 108 108 ASSERT(!m_emptyString); 109 m_emptyString = new (globalData) JSString(globalData, "", JSString::HasOtherOwner);109 m_emptyString = JSString::createHasOtherOwner(*globalData, ""); 110 110 } 111 111 … … 115 115 m_storage = adoptPtr(new SmallStringsStorage); 116 116 ASSERT(!m_singleCharacterStrings[character]); 117 m_singleCharacterStrings[character] = new (globalData) JSString(globalData, PassRefPtr<StringImpl>(m_storage->rep(character)), JSString::HasOtherOwner);117 m_singleCharacterStrings[character] = JSString::createHasOtherOwner(*globalData, PassRefPtr<StringImpl>(m_storage->rep(character))); 118 118 } 119 119 -
trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp
r86727 r91194 88 88 JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); 89 89 if (!exec->argumentCount()) 90 return JSValue::encode( new (exec) StringObject(exec, globalObject->stringObjectStructure()));91 return JSValue::encode( new (exec) StringObject(exec, globalObject->stringObjectStructure(), exec->argument(0).toString(exec)));90 return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure())); 91 return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure(), exec->argument(0).toString(exec))); 92 92 } 93 93 -
trunk/Source/JavaScriptCore/runtime/StringConstructor.h
r86727 r91194 29 29 30 30 class StringConstructor : public InternalFunction { 31 private: 32 StringConstructor(ExecState*, JSGlobalObject*, Structure*, StringPrototype*); 33 31 34 public: 32 StringConstructor(ExecState*, JSGlobalObject*, Structure*, StringPrototype*); 35 static StringConstructor* create(ExecState* exec, JSGlobalObject* globalObject , Structure* structure, StringPrototype* strPrototype) 36 { 37 return new (allocateCell<StringConstructor>(*exec->heap())) StringConstructor(exec, globalObject, structure, strPrototype); 38 } 33 39 34 40 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/runtime/StringObject.h
r84052 r91194 28 28 29 29 class StringObject : public JSWrapperObject { 30 p ublic:30 protected: 31 31 StringObject(ExecState*, Structure*); 32 32 StringObject(ExecState*, Structure*, const UString&); 33 33 34 public: 35 static StringObject* create(ExecState* exec, Structure* structure) 36 { 37 return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec, structure); 38 } 39 static StringObject* create(ExecState* exec, Structure* structure, const UString& str) 40 { 41 return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec, structure, str); 42 } 34 43 static StringObject* create(ExecState*, JSGlobalObject*, JSString*); 44 35 45 36 46 virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); -
trunk/Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
r84052 r91194 33 33 static StringObjectThatMasqueradesAsUndefined* create(ExecState* exec, const UString& string) 34 34 { 35 return new ( exec) StringObjectThatMasqueradesAsUndefined(exec,35 return new (allocateCell<StringObjectThatMasqueradesAsUndefined>(*exec->heap())) StringObjectThatMasqueradesAsUndefined(exec, 36 36 createStructure(exec->globalData(), exec->lexicalGlobalObject()->stringPrototype()), string); 37 37 } -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r87445 r91194 616 616 * replaced with the result of the expression new RegExp(regexp). 617 617 */ 618 reg = RegExp::create( &exec->globalData(), a0.toString(exec), NoFlags);618 reg = RegExp::create(exec->globalData(), a0.toString(exec), NoFlags); 619 619 } 620 620 RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor(); … … 665 665 * replaced with the result of the expression new RegExp(regexp). 666 666 */ 667 reg = RegExp::create( &exec->globalData(), a0.toString(exec), NoFlags);667 reg = RegExp::create(exec->globalData(), a0.toString(exec), NoFlags); 668 668 } 669 669 RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor(); -
trunk/Source/JavaScriptCore/runtime/StringPrototype.h
r84052 r91194 29 29 30 30 class StringPrototype : public StringObject { 31 private: 32 StringPrototype(ExecState*, JSGlobalObject*, Structure*); 33 31 34 public: 32 StringPrototype(ExecState*, JSGlobalObject*, Structure*); 35 static StringPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 36 { 37 return new (allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, globalObject, structure); 38 } 33 39 34 40 virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r91095 r91194 64 64 ASSERT(globalData.structureStructure); 65 65 ASSERT(classInfo); 66 return new ( &globalData) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo);66 return new (allocateCell<Structure>(globalData.heap)) Structure(globalData, prototype, typeInfo, anonymousSlotCount, classInfo); 67 67 } 68 68 … … 158 158 { 159 159 ASSERT(!globalData.structureStructure); 160 return new ( &globalData) Structure(globalData);160 return new (allocateCell<Structure>(globalData.heap)) Structure(globalData); 161 161 } 162 162 … … 171 171 { 172 172 ASSERT(globalData.structureStructure); 173 return new ( &globalData) Structure(globalData, structure);173 return new (allocateCell<Structure>(globalData.heap)) Structure(globalData, structure); 174 174 } 175 175 -
trunk/Source/JavaScriptCore/runtime/StructureChain.h
r86499 r91194 43 43 44 44 public: 45 static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new ( &globalData) StructureChain(globalData, globalData.structureChainStructure.get(), head); }45 static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new (allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get(), head); } 46 46 WriteBarrier<Structure>* head() { return m_vector.get(); } 47 47 void visitChildren(SlotVisitor&); -
trunk/Source/WebCore/ChangeLog
r91192 r91194 1 2011-07-18 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 Refactor JSC to replace JSCell::operator new with static create method 4 https://bugs.webkit.org/show_bug.cgi?id=64466 5 6 Reviewed by Oliver Hunt (oliver@apple.com) and Darin Adler (darin@apple.com). 7 8 First step in a longer refactoring process to remove the use of 9 operator new overloading in order to allocate GC objects and to replace 10 this method with static create methods for each individual type of heap-allocated 11 JS object. This particular patch only deals with replacing uses of 12 operator new within JSC proper. Future patches will remove it from the 13 parts that interface with the DOM. Due to the DOM's continued dependence 14 on it, operator new has not actually been removed from JSCell. 15 16 * bindings/js/JSDOMBinding.cpp: 17 (WebCore::jsDateOrNull): 18 (WebCore::objectToStringFunctionGetter): 19 * bindings/js/JSDOMWindowCustom.cpp: 20 (WebCore::nonCachingStaticFunctionGetter): 21 * bindings/js/JSHistoryCustom.cpp: 22 (WebCore::nonCachingStaticBackFunctionGetter): 23 (WebCore::nonCachingStaticForwardFunctionGetter): 24 (WebCore::nonCachingStaticGoFunctionGetter): 25 * bindings/js/JSLocationCustom.cpp: 26 (WebCore::nonCachingStaticReplaceFunctionGetter): 27 (WebCore::nonCachingStaticReloadFunctionGetter): 28 (WebCore::nonCachingStaticAssignFunctionGetter): 29 * bindings/js/SerializedScriptValue.cpp: 30 (WebCore::CloneDeserializer::readTerminal): 31 * bridge/qt/qt_runtime.cpp: 32 (JSC::Bindings::convertQVariantToValue): 33 1 34 2011-07-18 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> 2 35 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp
r90154 r91194 157 157 if (!isfinite(value)) 158 158 return jsNull(); 159 return new (exec) DateInstance(exec, exec->lexicalGlobalObject()->dateStructure(), value);159 return DateInstance::create(exec, exec->lexicalGlobalObject()->dateStructure(), value); 160 160 } 161 161 … … 308 308 JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 309 309 { 310 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, objectProtoFuncToString);310 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, objectProtoFuncToString); 311 311 } 312 312 -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r87197 r91194 89 89 JSValue nonCachingStaticFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 90 90 { 91 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), length, propertyName, nativeFunction);91 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), length, propertyName, nativeFunction); 92 92 } 93 93 -
trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp
r85484 r91194 41 41 static JSValue nonCachingStaticBackFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 42 42 { 43 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, jsHistoryPrototypeFunctionBack);43 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, jsHistoryPrototypeFunctionBack); 44 44 } 45 45 46 46 static JSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 47 47 { 48 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, jsHistoryPrototypeFunctionForward);48 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, jsHistoryPrototypeFunctionForward); 49 49 } 50 50 51 51 static JSValue nonCachingStaticGoFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 52 52 { 53 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 1, propertyName, jsHistoryPrototypeFunctionGo);53 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 1, propertyName, jsHistoryPrototypeFunctionGo); 54 54 } 55 55 -
trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp
r79611 r91194 33 33 static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 34 34 { 35 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace);35 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace); 36 36 } 37 37 38 38 static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 39 39 { 40 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload);40 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload); 41 41 } 42 42 43 43 static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName) 44 44 { 45 return new (exec) JSFunction(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign);45 return JSFunction::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->functionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign); 46 46 } 47 47 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r89653 r91194 1087 1087 if (!read(d)) 1088 1088 return JSValue(); 1089 return new (m_exec) DateInstance(m_exec, m_globalObject->dateStructure(), d);1089 return DateInstance::create(m_exec, m_globalObject->dateStructure(), d); 1090 1090 } 1091 1091 case FileTag: { … … 1167 1167 RegExpFlags reFlags = regExpFlags(flags->ustring()); 1168 1168 ASSERT(reFlags != InvalidFlags); 1169 RegExp* regExp = RegExp::create( &m_exec->globalData(), pattern->ustring(), reFlags);1170 return new (m_exec) RegExpObject(m_exec->lexicalGlobalObject(), m_globalObject->regExpStructure(), regExp);1169 RegExp* regExp = RegExp::create(m_exec->globalData(), pattern->ustring(), reFlags); 1170 return RegExpObject::create(m_exec, m_exec->lexicalGlobalObject(), m_globalObject->regExpStructure(), regExp); 1171 1171 } 1172 1172 case ObjectReferenceTag: { -
trunk/Source/WebCore/bridge/qt/qt_runtime.cpp
r89830 r91194 874 874 RegExpFlags flags = (re.caseSensitivity() == Qt::CaseInsensitive) ? FlagIgnoreCase : NoFlags; 875 875 876 JSC::RegExp* regExp = JSC::RegExp::create( &exec->globalData(), pattern, flags);876 JSC::RegExp* regExp = JSC::RegExp::create(exec->globalData(), pattern, flags); 877 877 if (regExp->isValid()) 878 return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp);878 return RegExpObject::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp); 879 879 return jsNull(); 880 880 } … … 909 909 double ms = gregorianDateTimeToMS(exec, dt, time.msec(), /*inputIsUTC*/ false); 910 910 911 return new (exec) DateInstance(exec, exec->lexicalGlobalObject()->dateStructure(), trunc(ms));911 return DateInstance::create(exec, exec->lexicalGlobalObject()->dateStructure(), trunc(ms)); 912 912 } 913 913
Note: See TracChangeset
for help on using the changeset viewer.