Commit 90cf7d51 authored by oliver@apple.com's avatar oliver@apple.com

2011-03-15 Oliver Hunt <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make Structure creation require a JSGlobalData
        https://bugs.webkit.org/show_bug.cgi?id=56438

        Mechanical change to make Structure::create require JSGlobalData&, and
        require all users to provide the globalData.

        * API/JSCallbackConstructor.h:
        (JSC::JSCallbackConstructor::createStructure):
        * API/JSCallbackFunction.h:
        (JSC::JSCallbackFunction::createStructure):
        * API/JSCallbackObject.h:
        (JSC::JSCallbackObject::createStructure):
        * API/JSContextRef.cpp:
        * JavaScriptCore.exp:
        * debugger/DebuggerActivation.cpp:
        (JSC::DebuggerActivation::DebuggerActivation):
        * debugger/DebuggerActivation.h:
        (JSC::DebuggerActivation::createStructure):
        * jit/JITStubs.cpp:
        (JSC::DEFINE_STUB_FUNCTION):
        * jsc.cpp:
        (GlobalObject::GlobalObject):
        (functionRun):
        (jscmain):
        * runtime/Arguments.h:
        (JSC::Arguments::createStructure):
        * runtime/ArrayPrototype.h:
        (JSC::ArrayPrototype::createStructure):
        * runtime/BooleanObject.h:
        (JSC::BooleanObject::createStructure):
        * runtime/DateInstance.h:
        (JSC::DateInstance::createStructure):
        * runtime/DatePrototype.h:
        (JSC::DatePrototype::createStructure):
        * runtime/ErrorInstance.h:
        (JSC::ErrorInstance::createStructure):
        * runtime/Executable.h:
        (JSC::ExecutableBase::createStructure):
        (JSC::EvalExecutable::createStructure):
        (JSC::ProgramExecutable::createStructure):
        (JSC::FunctionExecutable::createStructure):
        * runtime/FunctionPrototype.h:
        (JSC::FunctionPrototype::createStructure):
        * runtime/GetterSetter.h:
        (JSC::GetterSetter::createStructure):
        * runtime/InternalFunction.h:
        (JSC::InternalFunction::createStructure):
        * runtime/JSAPIValueWrapper.h:
        (JSC::JSAPIValueWrapper::createStructure):
        * runtime/JSActivation.h:
        (JSC::JSActivation::createStructure):
        * runtime/JSArray.cpp:
        (JSC::JSArray::JSArray):
        * runtime/JSArray.h:
        (JSC::JSArray::createStructure):
        * runtime/JSByteArray.cpp:
        (JSC::JSByteArray::createStructure):
        * runtime/JSByteArray.h:
        (JSC::JSByteArray::JSByteArray):
        * runtime/JSCell.h:
        (JSC::JSCell::JSCell::createDummyStructure):
        * runtime/JSFunction.h:
        (JSC::JSFunction::createStructure):
        * runtime/JSGlobalData.cpp:
        (JSC::JSGlobalData::storeVPtrs):
        (JSC::JSGlobalData::JSGlobalData):
        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::reset):
        * runtime/JSGlobalObject.h:
        (JSC::JSGlobalObject::JSGlobalObject):
        (JSC::JSGlobalObject::createStructure):
        * runtime/JSNotAnObject.h:
        (JSC::JSNotAnObject::createStructure):
        * runtime/JSONObject.h:
        (JSC::JSONObject::createStructure):
        * runtime/JSObject.cpp:
        (JSC::JSObject::createInheritorID):
        * runtime/JSObject.h:
        (JSC::JSObject::createStructure):
        (JSC::JSNonFinalObject::createStructure):
        (JSC::JSFinalObject::createStructure):
        (JSC::createEmptyObjectStructure):
        (JSC::JSObject::inheritorID):
        * runtime/JSObjectWithGlobalObject.h:
        (JSC::JSObjectWithGlobalObject::createStructure):
        * runtime/JSPropertyNameIterator.h:
        (JSC::JSPropertyNameIterator::createStructure):
        * runtime/JSStaticScopeObject.h:
        (JSC::JSStaticScopeObject::createStructure):
        * runtime/JSString.h:
        (JSC::RopeBuilder::createStructure):
        * runtime/JSVariableObject.h:
        (JSC::JSVariableObject::createStructure):
        * runtime/JSWrapperObject.h:
        (JSC::JSWrapperObject::createStructure):
        * runtime/JSZombie.h:
        (JSC::JSZombie::createStructure):
        * runtime/MathObject.h:
        (JSC::MathObject::createStructure):
        * runtime/NativeErrorConstructor.cpp:
        (JSC::NativeErrorConstructor::NativeErrorConstructor):
        * runtime/NativeErrorConstructor.h:
        (JSC::NativeErrorConstructor::createStructure):
        * runtime/NumberConstructor.h:
        (JSC::NumberConstructor::createStructure):
        * runtime/NumberObject.h:
        (JSC::NumberObject::createStructure):
        * runtime/ObjectConstructor.h:
        (JSC::ObjectConstructor::createStructure):
        * runtime/RegExpConstructor.h:
        (JSC::RegExpConstructor::createStructure):
        * runtime/RegExpObject.h:
        (JSC::RegExpObject::createStructure):
        * runtime/ScopeChain.h:
        (JSC::ScopeChainNode::createStructure):
        * runtime/StringObject.h:
        (JSC::StringObject::createStructure):
        * runtime/StringObjectThatMasqueradesAsUndefined.h:
        (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
        * runtime/StringPrototype.h:
        (JSC::StringPrototype::createStructure):
        * runtime/Structure.h:
        (JSC::Structure::create):
2011-03-15  Oliver Hunt  <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make Structure creation require a JSGlobalData
        https://bugs.webkit.org/show_bug.cgi?id=56438

        Mechanical change to make all structure creation pass a JSGlobalData&.

        * JSRun.cpp:
        (JSGlueGlobalObject::JSGlueGlobalObject):
        (JSRun::JSRun):
        * JSRun.h:
        * JSUtils.cpp:
        (getThreadGlobalObject):
        * UserObjectImp.h:
        (UserObjectImp::createStructure):
2011-03-15  Oliver Hunt  <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make Structure creation require a JSGlobalData
        https://bugs.webkit.org/show_bug.cgi?id=56438

        Mechanical change to make all structure creation use GlobalData

        * bindings/js/JSAudioConstructor.cpp:
        (WebCore::JSAudioConstructor::JSAudioConstructor):
        * bindings/js/JSAudioConstructor.h:
        (WebCore::JSAudioConstructor::createStructure):
        * bindings/js/JSDOMBinding.h:
        (WebCore::DOMObjectWithGlobalPointer::createStructure):
        (WebCore::DOMConstructorObject::createStructure):
        (WebCore::getDOMStructure):
        * bindings/js/JSDOMGlobalObject.h:
        (WebCore::JSDOMGlobalObject::createStructure):
        * bindings/js/JSDOMWindowBase.h:
        (WebCore::JSDOMWindowBase::createStructure):
        * bindings/js/JSDOMWindowShell.cpp:
        (WebCore::JSDOMWindowShell::JSDOMWindowShell):
        (WebCore::JSDOMWindowShell::setWindow):
        * bindings/js/JSDOMWindowShell.h:
        (WebCore::JSDOMWindowShell::createStructure):
        * bindings/js/JSImageConstructor.cpp:
        (WebCore::JSImageConstructor::JSImageConstructor):
        * bindings/js/JSImageConstructor.h:
        (WebCore::JSImageConstructor::createStructure):
        * bindings/js/JSImageDataCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSOptionConstructor.cpp:
        (WebCore::JSOptionConstructor::JSOptionConstructor):
        * bindings/js/JSOptionConstructor.h:
        (WebCore::JSOptionConstructor::createStructure):
        * bindings/js/JSWorkerContextBase.h:
        (WebCore::JSWorkerContextBase::createStructure):
        * bindings/js/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::initScript):
        * bindings/scripts/CodeGeneratorJS.pm:
        * bridge/c/CRuntimeObject.h:
        (JSC::Bindings::CRuntimeObject::createStructure):
        * bridge/c/c_instance.cpp:
        (JSC::Bindings::CRuntimeMethod::createStructure):
        * bridge/jni/jsc/JavaInstanceJSC.cpp:
        (JavaRuntimeMethod::createStructure):
        * bridge/jni/jsc/JavaRuntimeObject.h:
        (JSC::Bindings::JavaRuntimeObject::createStructure):
        * bridge/objc/ObjCRuntimeObject.h:
        (JSC::Bindings::ObjCRuntimeObject::createStructure):
        * bridge/objc/objc_instance.mm:
        (ObjCRuntimeMethod::createStructure):
        * bridge/objc/objc_runtime.h:
        (JSC::Bindings::ObjcFallbackObjectImp::createStructure):
        * bridge/runtime_array.h:
        (JSC::RuntimeArray::createStructure):
        * bridge/runtime_method.h:
        (JSC::RuntimeMethod::createStructure):
        * bridge/runtime_object.h:
        (JSC::Bindings::RuntimeObject::createStructure):
2011-03-15  Oliver Hunt  <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make Structure creation require a JSGlobalData
        https://bugs.webkit.org/show_bug.cgi?id=56438

        Mechanical change to make all Structure creation use a JSGlobalData&

        * Plugins/Hosted/ProxyInstance.mm:
        (WebKit::ProxyRuntimeMethod::createStructure):
        * Plugins/Hosted/ProxyRuntimeObject.h:
        (WebKit::ProxyRuntimeObject::createStructure):
2011-03-15  Oliver Hunt  <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make Structure creation require a JSGlobalData
        https://bugs.webkit.org/show_bug.cgi?id=56438

        Mechanical change to make all Structure creation use a JSGlobalData&.

        * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
        (WebKit::JSNPMethod::JSNPMethod):
        * WebProcess/Plugins/Netscape/JSNPMethod.h:
        (WebKit::JSNPMethod::createStructure):
        * WebProcess/Plugins/Netscape/JSNPObject.cpp:
        (WebKit::JSNPObject::JSNPObject):
        * WebProcess/Plugins/Netscape/JSNPObject.h:
        (WebKit::JSNPObject::createStructure):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ef891620
......@@ -39,9 +39,9 @@ public:
JSObjectCallAsConstructorCallback callback() const { return m_callback; }
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue proto)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
......
......@@ -39,9 +39,9 @@ public:
// InternalFunction mish-mashes constructor and function behavior -- we should
// refactor the code so this override isn't necessary
static PassRefPtr<Structure> createStructure(JSValue proto)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
......
......@@ -128,9 +128,9 @@ public:
JSClassRef classRef() const { return m_callbackObjectData->jsClass; }
bool inherits(JSClassRef) const;
static PassRefPtr<Structure> createStructure(JSValue proto)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info);
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info);
}
JSValue getPrivateProperty(const Identifier& propertyName) const
......
......@@ -93,11 +93,11 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass
#endif
if (!globalObjectClass) {
JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject;
JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject(*globalData);
return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec()));
}
JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(jsNull()));
JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull()));
ExecState* exec = globalObject->globalExec();
JSValue prototype = globalObjectClass->prototype(exec);
if (!prototype)
......
2011-03-15 Oliver Hunt <oliver@apple.com>
Reviewed by Geoffrey Garen.
Make Structure creation require a JSGlobalData
https://bugs.webkit.org/show_bug.cgi?id=56438
Mechanical change to make Structure::create require JSGlobalData&, and
require all users to provide the globalData.
* API/JSCallbackConstructor.h:
(JSC::JSCallbackConstructor::createStructure):
* API/JSCallbackFunction.h:
(JSC::JSCallbackFunction::createStructure):
* API/JSCallbackObject.h:
(JSC::JSCallbackObject::createStructure):
* API/JSContextRef.cpp:
* JavaScriptCore.exp:
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::DebuggerActivation):
* debugger/DebuggerActivation.h:
(JSC::DebuggerActivation::createStructure):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* jsc.cpp:
(GlobalObject::GlobalObject):
(functionRun):
(jscmain):
* runtime/Arguments.h:
(JSC::Arguments::createStructure):
* runtime/ArrayPrototype.h:
(JSC::ArrayPrototype::createStructure):
* runtime/BooleanObject.h:
(JSC::BooleanObject::createStructure):
* runtime/DateInstance.h:
(JSC::DateInstance::createStructure):
* runtime/DatePrototype.h:
(JSC::DatePrototype::createStructure):
* runtime/ErrorInstance.h:
(JSC::ErrorInstance::createStructure):
* runtime/Executable.h:
(JSC::ExecutableBase::createStructure):
(JSC::EvalExecutable::createStructure):
(JSC::ProgramExecutable::createStructure):
(JSC::FunctionExecutable::createStructure):
* runtime/FunctionPrototype.h:
(JSC::FunctionPrototype::createStructure):
* runtime/GetterSetter.h:
(JSC::GetterSetter::createStructure):
* runtime/InternalFunction.h:
(JSC::InternalFunction::createStructure):
* runtime/JSAPIValueWrapper.h:
(JSC::JSAPIValueWrapper::createStructure):
* runtime/JSActivation.h:
(JSC::JSActivation::createStructure):
* runtime/JSArray.cpp:
(JSC::JSArray::JSArray):
* runtime/JSArray.h:
(JSC::JSArray::createStructure):
* runtime/JSByteArray.cpp:
(JSC::JSByteArray::createStructure):
* runtime/JSByteArray.h:
(JSC::JSByteArray::JSByteArray):
* runtime/JSCell.h:
(JSC::JSCell::JSCell::createDummyStructure):
* runtime/JSFunction.h:
(JSC::JSFunction::createStructure):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::storeVPtrs):
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::createStructure):
* runtime/JSNotAnObject.h:
(JSC::JSNotAnObject::createStructure):
* runtime/JSONObject.h:
(JSC::JSONObject::createStructure):
* runtime/JSObject.cpp:
(JSC::JSObject::createInheritorID):
* runtime/JSObject.h:
(JSC::JSObject::createStructure):
(JSC::JSNonFinalObject::createStructure):
(JSC::JSFinalObject::createStructure):
(JSC::createEmptyObjectStructure):
(JSC::JSObject::inheritorID):
* runtime/JSObjectWithGlobalObject.h:
(JSC::JSObjectWithGlobalObject::createStructure):
* runtime/JSPropertyNameIterator.h:
(JSC::JSPropertyNameIterator::createStructure):
* runtime/JSStaticScopeObject.h:
(JSC::JSStaticScopeObject::createStructure):
* runtime/JSString.h:
(JSC::RopeBuilder::createStructure):
* runtime/JSVariableObject.h:
(JSC::JSVariableObject::createStructure):
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::createStructure):
* runtime/JSZombie.h:
(JSC::JSZombie::createStructure):
* runtime/MathObject.h:
(JSC::MathObject::createStructure):
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::NativeErrorConstructor):
* runtime/NativeErrorConstructor.h:
(JSC::NativeErrorConstructor::createStructure):
* runtime/NumberConstructor.h:
(JSC::NumberConstructor::createStructure):
* runtime/NumberObject.h:
(JSC::NumberObject::createStructure):
* runtime/ObjectConstructor.h:
(JSC::ObjectConstructor::createStructure):
* runtime/RegExpConstructor.h:
(JSC::RegExpConstructor::createStructure):
* runtime/RegExpObject.h:
(JSC::RegExpObject::createStructure):
* runtime/ScopeChain.h:
(JSC::ScopeChainNode::createStructure):
* runtime/StringObject.h:
(JSC::StringObject::createStructure):
* runtime/StringObjectThatMasqueradesAsUndefined.h:
(JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
* runtime/StringPrototype.h:
(JSC::StringPrototype::createStructure):
* runtime/Structure.h:
(JSC::Structure::create):
2011-03-16 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
......
......@@ -113,7 +113,7 @@ __ZN3JSC10JSFunction6s_infoE
__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE
__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE
__ZN3JSC11JSByteArray13s_defaultInfoE
__ZN3JSC11JSByteArray15createStructureENS_7JSValueEPKNS_9ClassInfoE
__ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataENS_7JSValueEPKNS_9ClassInfoE
__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEN3WTF17NonNullPassRefPtrINS_9StructureEEEPNS3_9ByteArrayE
__ZN3JSC11MarkedSpace21allocateFromSizeClassERNS0_9SizeClassE
__ZN3JSC11ParserArena5resetEv
......@@ -287,7 +287,6 @@ __ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZN3JSC8JSObject14deletePropertyEPNS_9ExecStateEj
__ZN3JSC8JSObject15unwrappedObjectEv
__ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC8JSObject17createInheritorIDEv
__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj
__ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
......
......@@ -102,14 +102,13 @@ EXPORTS
?create@RegExp@JSC@@SA?AV?$PassRefPtr@VRegExp@JSC@@@WTF@@PAVJSGlobalData@2@ABVUString@2@W4RegExpFlags@2@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createInheritorID@JSObject@JSC@@AAEPAVStructure@2@XZ
?createInterruptedExecutionException@JSC@@YAPAVJSObject@1@PAVJSGlobalData@1@@Z
?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@@Z
?createRangeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z
?createStackOverflowError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@VJSValue@2@PBUClassInfo@2@@Z
?createStructure@JSByteArray@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@AAVJSGlobalData@2@VJSValue@2@PBUClassInfo@2@@Z
?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z
?createThread@WTF@@YAIP6APAXPAX@Z0@Z
......
......@@ -2638,6 +2638,7 @@
};
buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
......
......@@ -31,7 +31,7 @@
namespace JSC {
DebuggerActivation::DebuggerActivation(JSGlobalData& globalData, JSObject* activation)
: JSNonFinalObject(DebuggerActivation::createStructure(jsNull()))
: JSNonFinalObject(DebuggerActivation::createStructure(globalData, jsNull()))
{
ASSERT(activation);
ASSERT(activation->isActivationObject());
......
......@@ -49,9 +49,9 @@ namespace JSC {
virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName);
virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName);
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
......
......@@ -1174,7 +1174,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_this)
Structure* structure;
JSValue proto = stackFrame.args[0].jsValue();
if (proto.isObject())
structure = asObject(proto)->inheritorID();
structure = asObject(proto)->inheritorID(*stackFrame.globalData);
else
structure = constructor->scope()->globalObject->emptyObjectStructure();
JSValue result = constructEmptyObject(callFrame, structure);
......
......@@ -141,14 +141,14 @@ long StopWatch::getElapsedMS()
class GlobalObject : public JSGlobalObject {
public:
GlobalObject(const Vector<UString>& arguments);
GlobalObject(JSGlobalData&, const Vector<UString>& arguments);
virtual UString className() const { return "global"; }
};
COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false);
ASSERT_CLASS_FITS_IN_CELL(GlobalObject);
GlobalObject::GlobalObject(const Vector<UString>& arguments)
: JSGlobalObject()
GlobalObject::GlobalObject(JSGlobalData& globalData, const Vector<UString>& arguments)
: JSGlobalObject(globalData)
{
putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
putDirectFunction(globalExec(), new (globalExec()) JSFunction(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
......@@ -212,7 +212,7 @@ EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
GlobalObject* globalObject = new (&exec->globalData()) GlobalObject(Vector<UString>());
GlobalObject* globalObject = new (&exec->globalData()) GlobalObject(exec->globalData(), Vector<UString>());
StopWatch stopWatch;
stopWatch.start();
......@@ -536,7 +536,7 @@ int jscmain(int argc, char** argv, JSGlobalData* globalData)
Options options;
parseArguments(argc, argv, options, globalData);
GlobalObject* globalObject = new (globalData) GlobalObject(options.arguments);
GlobalObject* globalObject = new (globalData) GlobalObject(*globalData, options.arguments);
bool success = runWithScripts(globalObject, options.scripts, options.dump);
if (options.interactive && success)
runInteractive(globalObject);
......
......@@ -92,9 +92,9 @@ namespace JSC {
d->registers = &activation->registerAt(0);
}
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
......
......@@ -35,9 +35,9 @@ namespace JSC {
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
......
......@@ -31,9 +31,9 @@ namespace JSC {
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
};
......
......@@ -53,9 +53,9 @@ namespace JSC {
return calculateGregorianDateTimeUTC(exec);
}
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
......
......@@ -36,9 +36,9 @@ namespace JSC {
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
......
......@@ -29,9 +29,9 @@ namespace JSC {
public:
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
static ErrorInstance* create(JSGlobalData*, NonNullPassRefPtr<Structure>, const UString&);
......
......@@ -65,7 +65,7 @@ namespace JSC {
return m_numParametersForCall == NUM_PARAMETERS_IS_HOST;
}
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
protected:
static const unsigned StructureFlags = 0;
......@@ -237,7 +237,7 @@ namespace JSC {
return generatedJITCodeForCall();
}
#endif
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
private:
static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags;
......@@ -282,7 +282,7 @@ namespace JSC {
}
#endif
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
private:
static const unsigned StructureFlags = OverridesMarkChildren | ScriptExecutable::StructureFlags;
......@@ -372,7 +372,7 @@ namespace JSC {
void discardCode();
void markChildren(MarkStack&);
static FunctionExecutable* fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception);
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(CompoundType, StructureFlags), AnonymousSlotCount, 0); }
private:
FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, bool, int firstLine, int lastLine);
......
......@@ -30,9 +30,9 @@ namespace JSC {
FunctionPrototype(ExecState*, JSGlobalObject*, NonNullPassRefPtr<Structure>);
void addFunctionProperties(ExecState*, JSGlobalObject*, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction);
static PassRefPtr<Structure> createStructure(JSValue proto)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
......
......@@ -47,9 +47,9 @@ namespace JSC {
void setGetter(JSGlobalData& globalData, JSObject* getter) { m_getter.set(globalData, this, getter); }
JSObject* setter() const { return m_setter.get(); }
void setSetter(JSGlobalData& globalData, JSObject* setter) { m_setter.set(globalData, this, setter); }
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(GetterSetterType, OverridesMarkChildren), AnonymousSlotCount, 0);
return Structure::create(globalData, prototype, TypeInfo(GetterSetterType, OverridesMarkChildren), AnonymousSlotCount, 0);
}
private:
virtual bool isGetterSetter() const;
......
......@@ -39,9 +39,9 @@ namespace JSC {
const UString displayName(ExecState*);
const UString calculatedDisplayName(ExecState*);
static PassRefPtr<Structure> createStructure(JSValue proto)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
......
......@@ -35,9 +35,9 @@ namespace JSC {
virtual bool isAPIValueWrapper() const { return true; }
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren | OverridesGetPropertyNames), AnonymousSlotCount, 0);
return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren | OverridesGetPropertyNames), AnonymousSlotCount, 0);
}
......
......@@ -66,7 +66,7 @@ namespace JSC {
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); }
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto) { return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info); }
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NeedsThisConversion | OverridesMarkChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
......
......@@ -127,7 +127,7 @@ inline void JSArray::checkConsistency(ConsistencyCheckType)
#endif
JSArray::JSArray(VPtrStealingHackType)
: JSNonFinalObject(createStructure(jsNull()))
: JSNonFinalObject(Structure::create(Structure::VPtrStealingHack, &s_info))
{
ASSERT(inherits(&s_info));
......
......@@ -124,9 +124,9 @@ namespace JSC {
void fillArgList(ExecState*, MarkedArgumentBuffer&);
void copyToRegisters(ExecState*, Register*, uint32_t);
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
inline void markChildrenDirect(MarkStack& markStack);
......
......@@ -50,9 +50,9 @@ JSByteArray::~JSByteArray()
#endif
PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype, const JSC::ClassInfo* classInfo)
PassRefPtr<Structure> JSByteArray::createStructure(JSGlobalData& globalData, JSValue prototype, const JSC::ClassInfo* classInfo)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, classInfo);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, classInfo);
}
bool JSByteArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
......
......@@ -76,7 +76,7 @@ namespace JSC {
}
JSByteArray(ExecState*, NonNullPassRefPtr<Structure>, WTF::ByteArray* storage);
static PassRefPtr<Structure> createStructure(JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo);
static PassRefPtr<Structure> createStructure(JSGlobalData&, JSValue prototype, const JSC::ClassInfo* = &s_defaultInfo);
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
......@@ -102,7 +102,7 @@ namespace JSC {
private:
enum VPtrStealingHackType { VPtrStealingHack };
JSByteArray(VPtrStealingHackType)
: JSNonFinalObject(createStructure(jsNull()))
: JSNonFinalObject(Structure::create(Structure::VPtrStealingHack, &s_info))
{
}
......
......@@ -72,9 +72,9 @@ namespace JSC {
virtual ~JSCell();
public:
static PassRefPtr<Structure> createDummyStructure()
static PassRefPtr<Structure> createDummyStructure(JSGlobalData& globalData)
{
return Structure::create(jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, 0);
return Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), AnonymousSlotCount, 0);
}
// Querying the type.
......
......@@ -73,9 +73,9 @@ namespace JSC {
static JS_EXPORTDATA const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue prototype)
static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
NativeFunction nativeFunction();
......
......@@ -108,8 +108,8 @@ void JSGlobalData::storeVPtrs()
COMPILE_ASSERT(sizeof(JSFunction) <= sizeof(storage), sizeof_JSFunction_must_be_less_than_storage);
char executableStorage[sizeof(VPtrHackExecutable)];
VPtrHackExecutable* executable = new (executableStorage) VPtrHackExecutable(VPtrHackExecutable::createStructure(jsNull()));
JSCell* jsFunction = new (storage) JSFunction(JSFunction::createStructure(jsNull()), executable);
VPtrHackExecutable* executable = new (executableStorage) VPtrHackExecutable(Structure::create(Structure::VPtrStealingHack, 0));
JSCell* jsFunction = new (storage) JSFunction(Structure::create(Structure::VPtrStealingHack, &JSFunction::s_info), executable);
JSGlobalData::jsFunctionVPtr = jsFunction->vptr();
jsFunction->~JSCell();
}
......@@ -126,22 +126,6 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread
, regExpTable(fastNew<HashTable>(JSC::regExpTable))
, regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable))
, stringTable(fastNew<HashTable>(JSC::stringTable))
, activationStructure(JSActivation::createStructure(jsNull()))
, interruptedExecutionErrorStructure(JSNonFinalObject::createStructure(jsNull()))
, terminatedExecutionErrorStructure(JSNonFinalObject::createStructure(jsNull()))
, staticScopeStructure(JSStaticScopeObject::createStructure(jsNull()))
, strictEvalActivationStructure(StrictEvalActivation::createStructure(jsNull()))
, stringStructure(JSString::createStructure(jsNull()))
, notAnObjectStructure(JSNotAnObject::createStructure(jsNull()))
, propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull()))
, getterSetterStructure(GetterSetter::createStructure(jsNull()))
, apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull()))
, scopeChainNodeStructure(ScopeChainNode::createStructure(jsNull()))
, executableStructure(ExecutableBase::createStructure(jsNull()))
, evalExecutableStructure(EvalExecutable::createStructure(jsNull()))
, programExecutableStructure(ProgramExecutable::createStructure(jsNull()))
, functionExecutableStructure(FunctionExecutable::createStructure(jsNull()))
, dummyMarkableCellStructure(JSCell::createDummyStructure())
, identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
, propertyNames(new CommonIdentifiers(this))
, emptyList(new MarkedArgumentBuffer)
......@@ -161,6 +145,23 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread
, exclusiveThread(0)
#endif
{
activationStructure = JSActivation::createStructure(*this, jsNull());
interruptedExecutionErrorStructure = JSNonFinalObject::createStructure(*this, jsNull());
terminatedExecutionErrorStructure = JSNonFinalObject::createStructure(*this, jsNull());
staticScopeStructure = JSStaticScopeObject::createStructure(*this, jsNull());
strictEvalActivationStructure = StrictEvalActivation::createStructure(*this, jsNull());
stringStructure = JSString::createStructure(*this, jsNull());
notAnObjectStructure = JSNotAnObject::createStructure(*this, jsNull());
propertyNameIteratorStructure = JSPropertyNameIterator::createStructure(*this, jsNull());
getterSetterStructure = GetterSetter::createStructure(*this, jsNull());
apiWrapperStructure = JSAPIValueWrapper::createStructure(*this, jsNull());