Commit 59875529 authored by akling@apple.com's avatar akling@apple.com

Pass VM instead of JSGlobalObject to function constructors.

<https://webkit.org/b/122082>

Reviewed by Darin Adler.

Functions don't need anything from the global object during their
construction and only use it to get to the VM. Reduce loads by
simply passing the VM around instead.

This patch is mostly mechanical, I just changed the signature of
InternalFunction and worked my way from there until it built.

JSC release binary size -= 4840 bytes.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6d7750ca
......@@ -45,8 +45,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSCallbackFunction);
const ClassInfo JSCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackFunction) };
JSCallbackFunction::JSCallbackFunction(JSGlobalObject* globalObject, Structure* structure, JSObjectCallAsFunctionCallback callback)
: InternalFunction(globalObject, structure)
JSCallbackFunction::JSCallbackFunction(VM& vm, Structure* structure, JSObjectCallAsFunctionCallback callback)
: InternalFunction(vm, structure)
, m_callback(callback)
{
}
......@@ -57,10 +57,10 @@ void JSCallbackFunction::finishCreation(VM& vm, const String& name)
ASSERT(inherits(info()));
}
JSCallbackFunction* JSCallbackFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name)
JSCallbackFunction* JSCallbackFunction::create(VM& vm, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name)
{
JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, globalObject->callbackFunctionStructure(), callback);
function->finishCreation(exec->vm(), name);
JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(vm.heap)) JSCallbackFunction(vm, globalObject->callbackFunctionStructure(), callback);
function->finishCreation(vm, name);
return function;
}
......
......@@ -36,7 +36,7 @@ class JSCallbackFunction : public InternalFunction {
public:
typedef InternalFunction Base;
static JSCallbackFunction* create(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const String& name);
static JSCallbackFunction* create(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, const String& name);
DECLARE_INFO;
......@@ -48,7 +48,7 @@ public:
}
private:
JSCallbackFunction(JSGlobalObject*, Structure*, JSObjectCallAsFunctionCallback);
JSCallbackFunction(VM&, Structure*, JSObjectCallAsFunctionCallback);
void finishCreation(VM&, const String& name);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -592,15 +592,15 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue
PropertySlot slot2(thisObj);
if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2))
return slot2.getValue(exec, propertyName);
if (StringImpl* name = propertyName.publicName()) {
for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
if (StaticFunctionEntry* entry = staticFunctions->get(name)) {
if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, name);
thisObj->putDirect(exec->vm(), propertyName, o, entry->attributes);
VM& vm = exec->vm();
JSObject* o = JSCallbackFunction::create(vm, thisObj->globalObject(), callAsFunction, name);
thisObj->putDirect(vm, propertyName, o, entry->attributes);
return o;
}
}
......
......@@ -105,7 +105,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
}
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->string() : ASCIILiteral("anonymous")));
return toRef(JSCallbackFunction::create(exec->vm(), exec->lexicalGlobalObject(), callAsFunction, name ? name->string() : ASCIILiteral("anonymous")));
}
JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor)
......
......@@ -47,7 +47,7 @@ class ObjCCallbackFunction : public InternalFunction {
public:
typedef InternalFunction Base;
static ObjCCallbackFunction* create(ExecState*, JSGlobalObject*, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl>);
static ObjCCallbackFunction* create(VM&, JSGlobalObject*, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl>);
static void destroy(JSCell*);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
......@@ -61,7 +61,7 @@ public:
ObjCCallbackFunctionImpl* impl() { return m_impl.get(); }
protected:
ObjCCallbackFunction(JSGlobalObject*, JSObjectCallAsFunctionCallback, PassOwnPtr<ObjCCallbackFunctionImpl>);
ObjCCallbackFunction(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, PassOwnPtr<ObjCCallbackFunctionImpl>);
private:
static CallType getCallData(JSCell*, CallData&);
......
......@@ -467,17 +467,17 @@ static JSValueRef objCCallbackFunctionCallAsFunction(JSContextRef callerContext,
const JSC::ClassInfo ObjCCallbackFunction::s_info = { "CallbackFunction", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ObjCCallbackFunction) };
ObjCCallbackFunction::ObjCCallbackFunction(JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
: Base(globalObject, globalObject->objcCallbackFunctionStructure())
ObjCCallbackFunction::ObjCCallbackFunction(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
: Base(vm, globalObject->objcCallbackFunctionStructure())
, m_callback(callback)
, m_impl(impl)
{
}
ObjCCallbackFunction* ObjCCallbackFunction::create(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
ObjCCallbackFunction* ObjCCallbackFunction::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
{
ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(*exec->heap())) ObjCCallbackFunction(globalObject, objCCallbackFunctionCallAsFunction, impl);
function->finishCreation(exec->vm(), name);
ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(vm.heap)) ObjCCallbackFunction(vm, globalObject, objCCallbackFunctionCallAsFunction, impl);
function->finishCreation(vm, name);
return function;
}
......@@ -589,7 +589,7 @@ static JSObjectRef objCCallbackFunctionForInvocation(JSContext *context, NSInvoc
JSC::APIEntryShim shim(exec);
OwnPtr<JSC::ObjCCallbackFunctionImpl> impl = adoptPtr(new JSC::ObjCCallbackFunctionImpl(context, invocation, type, instanceClass, arguments.release(), result.release()));
// FIXME: Maybe we could support having the selector as the name of the function to make it a bit more user-friendly from the JS side?
return toRef(JSC::ObjCCallbackFunction::create(exec, exec->lexicalGlobalObject(), "", impl.release()));
return toRef(JSC::ObjCCallbackFunction::create(exec->vm(), exec->lexicalGlobalObject(), "", impl.release()));
}
JSObjectRef objCCallbackFunctionForMethod(JSContext *context, Class cls, Protocol *protocol, BOOL isInstanceMethod, SEL sel, const char* types)
......
2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of JSGlobalObject to function constructors.
<https://webkit.org/b/122082>
Reviewed by Darin Adler.
Functions don't need anything from the global object during their
construction and only use it to get to the VM. Reduce loads by
simply passing the VM around instead.
This patch is mostly mechanical, I just changed the signature of
InternalFunction and worked my way from there until it built.
JSC release binary size -= 4840 bytes.
2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of JSGlobalObject to ArrayPrototype constructor.
......@@ -54,8 +54,8 @@ const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_in
@end
*/
ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
ArrayConstructor::ArrayConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
......
......@@ -33,10 +33,9 @@ class ArrayConstructor : public InternalFunction {
public:
typedef InternalFunction Base;
static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype)
static ArrayConstructor* create(VM& vm, Structure* structure, ArrayPrototype* arrayPrototype)
{
VM& vm = exec->vm();
ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(globalObject, structure);
ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(vm, structure);
constructor->finishCreation(vm, arrayPrototype);
return constructor;
}
......@@ -53,7 +52,7 @@ protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private:
ArrayConstructor(JSGlobalObject*, Structure*);
ArrayConstructor(VM&, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static ConstructType getConstructData(JSCell*, ConstructData&);
......
......@@ -31,8 +31,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanConstructor);
const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) };
BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
BooleanConstructor::BooleanConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
......
......@@ -31,10 +31,9 @@ class BooleanConstructor : public InternalFunction {
public:
typedef InternalFunction Base;
static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype)
static BooleanConstructor* create(VM& vm, Structure* structure, BooleanPrototype* booleanPrototype)
{
VM& vm = exec->vm();
BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(globalObject, structure);
BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(vm, structure);
constructor->finishCreation(vm, booleanPrototype);
return constructor;
}
......@@ -50,7 +49,7 @@ protected:
void finishCreation(VM&, BooleanPrototype*);
private:
BooleanConstructor(JSGlobalObject*, Structure*);
BooleanConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -74,8 +74,8 @@ const ClassInfo DateConstructor::s_info = { "Function", &InternalFunction::s_inf
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(DateConstructor);
DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
DateConstructor::DateConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
......
......@@ -31,10 +31,10 @@ namespace JSC {
public:
typedef InternalFunction Base;
static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype)
static DateConstructor* create(VM& vm, Structure* structure, DatePrototype* datePrototype)
{
DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure);
constructor->finishCreation(exec->vm(), datePrototype);
DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(vm.heap)) DateConstructor(vm, structure);
constructor->finishCreation(vm, datePrototype);
return constructor;
}
......@@ -50,7 +50,7 @@ namespace JSC {
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private:
DateConstructor(JSGlobalObject*, Structure*);
DateConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -73,8 +73,8 @@ namespace JSC {
class StrictModeTypeErrorFunction : public InternalFunction {
private:
StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const String& message)
: InternalFunction(globalObject, structure)
StrictModeTypeErrorFunction(VM& vm, Structure* structure, const String& message)
: InternalFunction(vm, structure)
, m_message(message)
{
}
......@@ -84,10 +84,10 @@ namespace JSC {
public:
typedef InternalFunction Base;
static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const String& message)
static StrictModeTypeErrorFunction* create(VM& vm, Structure* structure, const String& message)
{
StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message);
function->finishCreation(exec->vm(), String());
StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(vm.heap)) StrictModeTypeErrorFunction(vm, structure, message);
function->finishCreation(vm, String());
return function;
}
......
......@@ -33,8 +33,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ErrorConstructor);
const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorConstructor) };
ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
ErrorConstructor::ErrorConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
......
......@@ -32,10 +32,9 @@ namespace JSC {
public:
typedef InternalFunction Base;
static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype)
static ErrorConstructor* create(VM& vm, Structure* structure, ErrorPrototype* errorPrototype)
{
VM& vm = exec->vm();
ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(globalObject, structure);
ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(vm, structure);
constructor->finishCreation(vm, errorPrototype);
return constructor;
}
......@@ -51,7 +50,7 @@ namespace JSC {
void finishCreation(VM&, ErrorPrototype*);
private:
ErrorConstructor(JSGlobalObject*, Structure*);
ErrorConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -39,8 +39,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(FunctionConstructor);
const ClassInfo FunctionConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionConstructor) };
FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
FunctionConstructor::FunctionConstructor(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
......
......@@ -35,10 +35,9 @@ namespace JSC {
public:
typedef InternalFunction Base;
static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype)
static FunctionConstructor* create(VM& vm, Structure* structure, FunctionPrototype* functionPrototype)
{
VM& vm = exec->vm();
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(globalObject, structure);
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(vm, structure);
constructor->finishCreation(vm, functionPrototype);
return constructor;
}
......@@ -51,7 +50,7 @@ namespace JSC {
}
private:
FunctionConstructor(JSGlobalObject*, Structure*);
FunctionConstructor(VM&, Structure*);
void finishCreation(VM&, FunctionPrototype*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
......
......@@ -42,8 +42,8 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*);
FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure)
: InternalFunction(globalObject, structure)
FunctionPrototype::FunctionPrototype(VM& vm, Structure* structure)
: InternalFunction(vm, structure)
{
}
......
......@@ -29,10 +29,9 @@ namespace JSC {
public:
typedef InternalFunction Base;
static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static FunctionPrototype* create(VM& vm, Structure* structure)
{
VM& vm = exec->vm();
FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(globalObject, structure);
FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(vm, structure);
prototype->finishCreation(vm, String());
return prototype;
}
......@@ -50,7 +49,7 @@ namespace JSC {
void finishCreation(VM&, const String& name);
private:
FunctionPrototype(JSGlobalObject*, Structure*);
FunctionPrototype(VM&, Structure*);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -34,8 +34,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(InternalFunction);
const ClassInfo InternalFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(InternalFunction) };
InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* structure)
: JSDestructibleObject(globalObject->vm(), structure)
InternalFunction::InternalFunction(VM& vm, Structure* structure)
: JSDestructibleObject(vm, structure)
{
}
......
......@@ -49,7 +49,7 @@ namespace JSC {
protected:
static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
JS_EXPORT_PRIVATE InternalFunction(JSGlobalObject*, Structure*);
JS_EXPORT_PRIVATE InternalFunction(VM&, Structure*);
JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name);
......
......@@ -40,9 +40,8 @@ const ClassInfo JSArrayBufferConstructor::s_info = {
CREATE_METHOD_TABLE(JSArrayBufferConstructor)
};
JSArrayBufferConstructor::JSArrayBufferConstructor(
JSGlobalObject* globalObject, Structure* structure)
: Base(globalObject, structure)
JSArrayBufferConstructor::JSArrayBufferConstructor(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
......@@ -53,12 +52,11 @@ void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* pr
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly);
}
JSArrayBufferConstructor* JSArrayBufferConstructor::create(CallFrame* callFrame, JSGlobalObject* globalObject, Structure* structure, JSArrayBufferPrototype* prototype)
JSArrayBufferConstructor* JSArrayBufferConstructor::create(VM& vm, Structure* structure, JSArrayBufferPrototype* prototype)
{
VM& vm = callFrame->vm();
JSArrayBufferConstructor* result =
new (NotNull, allocateCell<JSArrayBufferConstructor>(vm.heap))
JSArrayBufferConstructor(globalObject, structure);
JSArrayBufferConstructor(vm, structure);
result->finishCreation(vm, prototype);
return result;
}
......
......@@ -37,11 +37,11 @@ public:
typedef InternalFunction Base;
protected:
JSArrayBufferConstructor(JSGlobalObject*, Structure*);
JSArrayBufferConstructor(VM&, Structure*);
void finishCreation(VM&, JSArrayBufferPrototype*);
public:
static JSArrayBufferConstructor* create(CallFrame*, JSGlobalObject*, Structure*, JSArrayBufferPrototype*);
static JSArrayBufferConstructor* create(VM&, Structure*, JSArrayBufferPrototype*);
DECLARE_INFO;
......
......@@ -36,13 +36,13 @@ public:
typedef InternalFunction Base;
protected:
JSGenericTypedArrayViewConstructor(JSGlobalObject*, Structure*);
JSGenericTypedArrayViewConstructor(VM&, Structure*);
void finishCreation(VM&, JSObject* prototype, const String& name);
public:
static JSGenericTypedArrayViewConstructor* create(
JSGlobalObject*, Structure*, JSObject* prototype, const String& name);
VM&, Structure*, JSObject* prototype, const String& name);
DECLARE_INFO;
static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
......
......@@ -34,8 +34,8 @@
namespace JSC {
template<typename ViewClass>
JSGenericTypedArrayViewConstructor<ViewClass>::JSGenericTypedArrayViewConstructor(JSGlobalObject* globalObject, Structure* structure)
: Base(globalObject, structure)
JSGenericTypedArrayViewConstructor<ViewClass>::JSGenericTypedArrayViewConstructor(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
......@@ -51,13 +51,12 @@ void JSGenericTypedArrayViewConstructor<ViewClass>::finishCreation(VM& vm, JSObj
template<typename ViewClass>
JSGenericTypedArrayViewConstructor<ViewClass>*
JSGenericTypedArrayViewConstructor<ViewClass>::create(
JSGlobalObject* globalObject, Structure* structure, JSObject* prototype,
VM& vm, Structure* structure, JSObject* prototype,
const String& name)
{
VM& vm = globalObject->vm();
JSGenericTypedArrayViewConstructor* result =
new (NotNull, allocateCell<JSGenericTypedArrayViewConstructor>(vm.heap))
JSGenericTypedArrayViewConstructor(globalObject, structure);
JSGenericTypedArrayViewConstructor(vm, structure);
result->finishCreation(vm, prototype, name);
return result;
}
......
......@@ -228,7 +228,7 @@ void JSGlobalObject::reset(JSValue prototype)
ExecState* exec = JSGlobalObject::globalExec();
VM& vm = exec->vm();
m_functionPrototype.set(vm, this, FunctionPrototype::create(exec, this, FunctionPrototype::createStructure(vm, this, jsNull()))); // The real prototype will be set once ObjectPrototype is created.
m_functionPrototype.set(vm, this, FunctionPrototype::create(vm, FunctionPrototype::createStructure(vm, this, jsNull()))); // The real prototype will be set once ObjectPrototype is created.
m_functionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get()));
m_boundFunctionStructure.set(vm, this, JSBoundFunction::createStructure(vm, this, m_functionPrototype.get()));
m_namedFunctionStructure.set(vm, this, Structure::addPropertyTransition(vm, m_functionStructure.get(), vm.propertyNames->name, DontDelete | ReadOnly | DontEnum, 0, m_functionNameOffset));
......@@ -321,19 +321,19 @@ void JSGlobalObject::reset(JSValue prototype)
// Constructors
JSCell* objectConstructor = ObjectConstructor::create(exec, this, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get());
JSCell* functionConstructor = FunctionConstructor::create(exec, this, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get());
JSCell* arrayConstructor = ArrayConstructor::create(exec, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get());
JSCell* objectConstructor = ObjectConstructor::create(vm, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get());
JSCell* functionConstructor = FunctionConstructor::create(vm, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get());
JSCell* arrayConstructor = ArrayConstructor::create(vm, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get());
#if ENABLE(PROMISES)
JSCell* promiseConstructor = JSPromiseConstructor::create(exec, this, JSPromiseConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promisePrototype.get());
JSCell* promiseResolverConstructor = JSPromiseResolverConstructor::create(exec, this, JSPromiseResolverConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promiseResolverPrototype.get());
JSCell* promiseConstructor = JSPromiseConstructor::create(vm, JSPromiseConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promisePrototype.get());
JSCell* promiseResolverConstructor = JSPromiseResolverConstructor::create(vm, JSPromiseResolverConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promiseResolverPrototype.get());
#endif // ENABLE(PROMISES)
m_regExpConstructor.set(vm, this, RegExpConstructor::create(exec, this, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get()));
m_regExpConstructor.set(vm, this, RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get()));
#define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(exec, this, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get()); \
capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get()); \
m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, DontEnum); \
FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE)
......@@ -391,16 +391,16 @@ void JSGlobalObject::reset(JSValue prototype)
putDirectWithoutTransition(vm, vm.propertyNames->Math, MathObject::create(exec, this, MathObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
FixedArray<InternalFunction*, NUMBER_OF_TYPED_ARRAY_TYPES> typedArrayConstructors;
typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(this, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(this, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(this, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), "Int32Array");
typedArrayConstructors[toIndex(TypeUint8)] = JSUint8ArrayConstructor::create(this, JSUint8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8)].prototype.get(), "Uint8Array");
typedArrayConstructors[toIndex(TypeUint8Clamped)] = JSUint8ClampedArrayConstructor::create(this, JSUint8ClampedArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), "Uint8ClampedArray");
typedArrayConstructors[toIndex(TypeUint16)] = JSUint16ArrayConstructor::create(this, JSUint16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint16)].prototype.get(), "Uint16Array");
typedArrayConstructors[toIndex(TypeUint32)] = JSUint32ArrayConstructor::create(this, JSUint32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint32)].prototype.get(), "Uint32Array");
typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(this, JSFloat32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), "Float32Array");
typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(this, JSFloat64ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), "Float64Array");
typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(this, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), "DataView");
typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(vm, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(vm, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(vm, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), "Int32Array");
typedArrayConstructors[toIndex(TypeUint8)] = JSUint8ArrayConstructor::create(vm, JSUint8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8)].prototype.get(), "Uint8Array");
typedArrayConstructors[toIndex(TypeUint8Clamped)] = JSUint8ClampedArrayConstructor::create(vm, JSUint8ClampedArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), "Uint8ClampedArray");
typedArrayConstructors[toIndex(TypeUint16)] = JSUint16ArrayConstructor::create(vm, JSUint16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint16)].prototype.get(), "Uint16Array");
typedArrayConstructors[toIndex(TypeUint32)] = JSUint32ArrayConstructor::create(vm, JSUint32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint32)].prototype.get(), "Uint32Array");
typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(vm, JSFloat32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), "Float32Array");
typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(vm, JSFloat64ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), "Float64Array");
typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(vm, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), "DataView");
for (unsigned typedArrayIndex = NUMBER_OF_TYPED_ARRAY_TYPES; typedArrayIndex--;) {
m_typedArrays[typedArrayIndex].prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, typedArrayConstructors[typedArrayIndex], DontEnum);
......@@ -423,7 +423,7 @@ void JSGlobalObject::reset(JSValue prototype)
NamePrototype* privateNamePrototype = NamePrototype::create(exec, NamePrototype::createStructure(vm, this, m_objectPrototype.get()));
m_privateNameStructure.set(vm, this, NameInstance::createStructure(vm, this, privateNamePrototype));
JSCell* privateNameConstructor = NameConstructor::create(exec, this, NameConstructor::createStructure(vm, this, m_functionPrototype.get()), privateNamePrototype);
JSCell* privateNameConstructor = NameConstructor::create(vm, NameConstructor::createStructure(vm, this, m_functionPrototype.get()), privateNamePrototype);
privateNamePrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, privateNameConstructor, DontEnum);
putDirectWithoutTransition(vm, Identifier(exec, "Name"), privateNameConstructor, DontEnum);
}
......
......@@ -39,10 +39,10 @@ namespace JSC {
const ClassInfo JSPromiseCallback::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSPromiseCallback) };
JSPromiseCallback* JSPromiseCallback::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromiseResolver* resolver, Algorithm algorithm)
JSPromiseCallback* JSPromiseCallback::create(VM& vm, Structure* structure, JSPromiseResolver* resolver, Algorithm algorithm)