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

Pass VM instead of ExecState to many finishCreation() functions.

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

Reviewed by Sam Weinig.

Reduce unnecessary loads by passing the VM to object creation
functions that don't need the ExecState.

There are tons of opportunities in this area, I'm just scratching
the surface.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c68e9807
2013-09-26 Andreas Kling <akling@apple.com>
Pass VM instead of ExecState to many finishCreation() functions.
<https://webkit.org/b/121975>
Reviewed by Sam Weinig.
Reduce unnecessary loads by passing the VM to object creation
functions that don't need the ExecState.
There are tons of opportunities in this area, I'm just scratching
the surface.
2013-09-26 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r156464 and r156480.
......@@ -59,11 +59,11 @@ ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* stru
{
}
void ArrayConstructor::finishCreation(ExecState* exec, ArrayPrototype* arrayPrototype)
void ArrayConstructor::finishCreation(VM& vm, ArrayPrototype* arrayPrototype)
{
Base::finishCreation(exec->vm(), arrayPrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
Base::finishCreation(vm, arrayPrototype->classInfo()->className);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
}
bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
......
......@@ -35,8 +35,9 @@ public:
static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype)
{
ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(*exec->heap())) ArrayConstructor(globalObject, structure);
constructor->finishCreation(exec, arrayPrototype);
VM& vm = exec->vm();
ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(globalObject, structure);
constructor->finishCreation(vm, arrayPrototype);
return constructor;
}
......@@ -48,7 +49,7 @@ public:
}
protected:
void finishCreation(ExecState*, ArrayPrototype*);
void finishCreation(VM&, ArrayPrototype*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private:
......
......@@ -36,13 +36,13 @@ BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure*
{
}
void BooleanConstructor::finishCreation(ExecState* exec, BooleanPrototype* booleanPrototype)
void BooleanConstructor::finishCreation(VM& vm, BooleanPrototype* booleanPrototype)
{
Base::finishCreation(exec->vm(), booleanPrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
Base::finishCreation(vm, booleanPrototype->classInfo()->className);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
// no. of arguments for constructor
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
}
// ECMA 15.6.2
......
......@@ -33,8 +33,9 @@ public:
static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype)
{
BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(*exec->heap())) BooleanConstructor(globalObject, structure);
constructor->finishCreation(exec, booleanPrototype);
VM& vm = exec->vm();
BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(globalObject, structure);
constructor->finishCreation(vm, booleanPrototype);
return constructor;
}
......@@ -46,7 +47,7 @@ public:
}
protected:
void finishCreation(ExecState*, BooleanPrototype*);
void finishCreation(VM&, BooleanPrototype*);
private:
BooleanConstructor(JSGlobalObject*, Structure*);
......
......@@ -55,10 +55,10 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, Structure* structure)
{
}
void BooleanPrototype::finishCreation(ExecState* exec, JSGlobalObject*)
void BooleanPrototype::finishCreation(VM& vm, JSGlobalObject*)
{
Base::finishCreation(exec->vm());
setInternalValue(exec->vm(), jsBoolean(false));
Base::finishCreation(vm);
setInternalValue(vm, jsBoolean(false));
ASSERT(inherits(info()));
}
......
......@@ -31,8 +31,9 @@ public:
static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{
BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(*exec->heap())) BooleanPrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
VM& vm = exec->vm();
BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(vm.heap)) BooleanPrototype(exec, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -44,7 +45,7 @@ public:
}
protected:
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags;
private:
......
......@@ -79,11 +79,11 @@ DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* struct
{
}
void DateConstructor::finishCreation(ExecState* exec, DatePrototype* datePrototype)
void DateConstructor::finishCreation(VM& vm, DatePrototype* datePrototype)
{
Base::finishCreation(exec->vm(), datePrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
Base::finishCreation(vm, datePrototype->classInfo()->className);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
}
bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
......
......@@ -34,7 +34,7 @@ namespace JSC {
static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype)
{
DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure);
constructor->finishCreation(exec, datePrototype);
constructor->finishCreation(exec->vm(), datePrototype);
return constructor;
}
......@@ -46,7 +46,7 @@ namespace JSC {
}
protected:
void finishCreation(ExecState*, DatePrototype*);
void finishCreation(VM&, DatePrototype*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private:
......
......@@ -506,9 +506,9 @@ DatePrototype::DatePrototype(ExecState* exec, Structure* structure)
{
}
void DatePrototype::finishCreation(ExecState* exec, JSGlobalObject*)
void DatePrototype::finishCreation(VM& vm, JSGlobalObject*)
{
Base::finishCreation(exec->vm());
Base::finishCreation(vm);
ASSERT(inherits(info()));
// The constructor will be added later, after DateConstructor has been built.
......
......@@ -36,8 +36,9 @@ namespace JSC {
static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{
DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(*exec->heap())) DatePrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
VM& vm = exec->vm();
DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(exec, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
......@@ -50,7 +51,7 @@ namespace JSC {
}
protected:
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
};
......
......@@ -38,12 +38,12 @@ ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* stru
{
}
void ErrorConstructor::finishCreation(ExecState* exec, ErrorPrototype* errorPrototype)
void ErrorConstructor::finishCreation(VM& vm, ErrorPrototype* errorPrototype)
{
Base::finishCreation(exec->vm(), errorPrototype->classInfo()->className);
Base::finishCreation(vm, errorPrototype->classInfo()->className);
// ECMA 15.11.3.1 Error.prototype
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
}
// ECMA 15.9.3
......
......@@ -34,8 +34,9 @@ namespace JSC {
static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype)
{
ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(*exec->heap())) ErrorConstructor(globalObject, structure);
constructor->finishCreation(exec, errorPrototype);
VM& vm = exec->vm();
ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(globalObject, structure);
constructor->finishCreation(vm, errorPrototype);
return constructor;
}
......@@ -47,7 +48,7 @@ namespace JSC {
}
protected:
void finishCreation(ExecState*, ErrorPrototype*);
void finishCreation(VM&, ErrorPrototype*);
private:
ErrorConstructor(JSGlobalObject*, Structure*);
......
......@@ -54,11 +54,11 @@ ErrorPrototype::ErrorPrototype(ExecState* exec, Structure* structure)
{
}
void ErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject*)
void ErrorPrototype::finishCreation(VM& vm, JSGlobalObject*)
{
Base::finishCreation(exec->vm(), "");
Base::finishCreation(vm, "");
ASSERT(inherits(info()));
putDirect(exec->vm(), exec->propertyNames().name, jsNontrivialString(exec, String(ASCIILiteral("Error"))), DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Error"))), DontEnum);
}
bool ErrorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
......
......@@ -33,8 +33,9 @@ namespace JSC {
static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
VM& vm = exec->vm();
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(exec, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -47,7 +48,7 @@ namespace JSC {
protected:
ErrorPrototype(ExecState*, Structure*);
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
......
......@@ -44,13 +44,13 @@ FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure
{
}
void FunctionConstructor::finishCreation(ExecState* exec, FunctionPrototype* functionPrototype)
void FunctionConstructor::finishCreation(VM& vm, FunctionPrototype* functionPrototype)
{
Base::finishCreation(exec->vm(), functionPrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
Base::finishCreation(vm, functionPrototype->classInfo()->className);
putDirectWithoutTransition(vm, vm.propertyNames->prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
// Number of arguments for constructor
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
}
static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec)
......
......@@ -37,8 +37,9 @@ namespace JSC {
static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype)
{
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(*exec->heap())) FunctionConstructor(globalObject, structure);
constructor->finishCreation(exec, functionPrototype);
VM& vm = exec->vm();
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(globalObject, structure);
constructor->finishCreation(vm, functionPrototype);
return constructor;
}
......@@ -51,7 +52,7 @@ namespace JSC {
private:
FunctionConstructor(JSGlobalObject*, Structure*);
void finishCreation(ExecState*, FunctionPrototype*);
void finishCreation(VM&, FunctionPrototype*);
static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&);
};
......
......@@ -47,10 +47,10 @@ FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* st
{
}
void FunctionPrototype::finishCreation(ExecState* exec, const String& name)
void FunctionPrototype::finishCreation(VM& vm, const String& name)
{
Base::finishCreation(exec->vm(), name);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
Base::finishCreation(vm, name);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
}
void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, JSFunction** callFunction, JSFunction** applyFunction)
......
......@@ -31,8 +31,9 @@ namespace JSC {
static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{
FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure);
prototype->finishCreation(exec, String());
VM& vm = exec->vm();
FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(globalObject, structure);
prototype->finishCreation(vm, String());
return prototype;
}
......@@ -46,7 +47,7 @@ namespace JSC {
DECLARE_INFO;
protected:
void finishCreation(ExecState*, const String& name);
void finishCreation(VM&, const String& name);
private:
FunctionPrototype(JSGlobalObject*, Structure*);
......
......@@ -46,16 +46,17 @@ namespace JSC {
static JSAPIValueWrapper* create(ExecState* exec, JSValue value)
{
JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec);
wrapper->finishCreation(exec, value);
VM& vm = exec->vm();
JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(vm.heap)) JSAPIValueWrapper(exec);
wrapper->finishCreation(vm, value);
return wrapper;
}
protected:
void finishCreation(ExecState* exec, JSValue value)
void finishCreation(VM& vm, JSValue value)
{
Base::finishCreation(exec->vm());
m_value.set(exec->vm(), this, value);
Base::finishCreation(vm);
m_value.set(vm, this, value);
ASSERT(!value.isCell());
}
......
......@@ -76,11 +76,12 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec)
JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
{
VM& vm = exec->vm();
ConstructData constructData;
ConstructType constructType = JSC::getConstructData(targetFunction, constructData);
bool canConstruct = constructType != ConstructTypeNone;
NativeExecutable* executable = exec->vm().getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor);
JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(*exec->heap())) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
NativeExecutable* executable = vm.getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor);
JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
function->finishCreation(exec, executable, length, name);
return function;
......@@ -106,11 +107,12 @@ JSBoundFunction::JSBoundFunction(ExecState* exec, JSGlobalObject* globalObject,
void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name)
{
Base::finishCreation(exec, executable, length, name);
VM& vm = exec->vm();
Base::finishCreation(vm, executable, length, name);
ASSERT(inherits(info()));
putDirectAccessor(exec, exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
putDirectAccessor(exec, exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
putDirectAccessor(exec, vm.propertyNames->arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
}
void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
......
......@@ -63,20 +63,22 @@ bool JSFunction::isHostFunctionNonInline() const
JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
{
VM& vm = exec->vm();
NativeExecutable* executable;
#if !ENABLE(JIT)
UNUSED_PARAM(intrinsic);
#else
if (intrinsic != NoIntrinsic && exec->vm().canUseJIT()) {
ASSERT(nativeConstructor == callHostFunctionAsConstructor);
executable = exec->vm().getHostFunction(nativeFunction, intrinsic);
executable = vm.getHostFunction(nativeFunction, intrinsic);
} else
#endif
executable = exec->vm().getHostFunction(nativeFunction, nativeConstructor);
executable = vm.getHostFunction(nativeFunction, nativeConstructor);
JSFunction* function = new (NotNull, allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, globalObject->functionStructure());
JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(exec, globalObject, globalObject->functionStructure());
// Can't do this during initialization because getHostFunction might do a GC allocation.
function->finishCreation(exec, executable, length, name);
function->finishCreation(vm, executable, length, name);
return function;
}
......@@ -102,13 +104,13 @@ JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure*
{
}
void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name)
void JSFunction::finishCreation(VM& vm, NativeExecutable* executable, int length, const String& name)
{
Base::finishCreation(exec->vm());
Base::finishCreation(vm);
ASSERT(inherits(info()));
m_executable.set(exec->vm(), this, executable);
putDirect(exec->vm(), exec->vm().propertyNames->name, jsString(exec, name), DontDelete | ReadOnly | DontEnum);
putDirect(exec->vm(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
m_executable.set(vm, this, executable);
putDirect(vm, vm.propertyNames->name, jsString(&vm, name), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(length), DontDelete | ReadOnly | DontEnum);
}
ObjectAllocationProfile* JSFunction::createAllocationProfile(ExecState* exec, size_t inlineCapacity)
......
......@@ -165,7 +165,7 @@ namespace JSC {
JS_EXPORT_PRIVATE JSFunction(ExecState*, JSGlobalObject*, Structure*);
JSFunction(VM&, FunctionExecutable*, JSScope*);
void finishCreation(ExecState*, NativeExecutable*, int length, const String& name);
void finishCreation(VM&, NativeExecutable*, int length, const String& name);
using Base::finishCreation;
ObjectAllocationProfile* createAllocationProfile(ExecState*, size_t inlineCapacity);
......
......@@ -38,15 +38,17 @@ public:
static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
{
JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(*exec->heap())) JSNameScope(exec, exec->scope());
scopeObject->finishCreation(exec, identifier, value, attributes);
VM& vm = exec->vm();
JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(exec, exec->scope());
scopeObject->finishCreation(vm, identifier, value, attributes);
return scopeObject;
}
static JSNameScope* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes, JSScope* next)
{
JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(*exec->heap())) JSNameScope(exec, next);
scopeObject->finishCreation(exec, identifier, value, attributes);
VM& vm = exec->vm();
JSNameScope* scopeObject = new (NotNull, allocateCell<JSNameScope>(vm.heap)) JSNameScope(exec, next);
scopeObject->finishCreation(vm, identifier, value, attributes);
return scopeObject;
}
......@@ -60,10 +62,10 @@ public:
DECLARE_INFO;
protected:
void finishCreation(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
void finishCreation(VM& vm, const Identifier& identifier, JSValue value, unsigned attributes)
{
Base::finishCreation(exec->vm());
m_registerStore.set(exec->vm(), this, value);
Base::finishCreation(vm);
m_registerStore.set(vm, this, value);
symbolTable()->add(identifier.impl(), SymbolTableEntry(-1, attributes));
}
......
......@@ -67,8 +67,9 @@ const ClassInfo JSPromiseConstructor::s_info = { "Function", &InternalFunction::
JSPromiseConstructor* JSPromiseConstructor::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromisePrototype* promisePrototype)
{
JSPromiseConstructor* constructor = new (NotNull, allocateCell<JSPromiseConstructor>(*exec->heap())) JSPromiseConstructor(globalObject, structure);
constructor->finishCreation(exec, promisePrototype);
VM& vm = exec->vm();
JSPromiseConstructor* constructor = new (NotNull, allocateCell<JSPromiseConstructor>(vm.heap)) JSPromiseConstructor(globalObject, structure);
constructor->finishCreation(vm, promisePrototype);
return constructor;
}
......@@ -82,11 +83,11 @@ JSPromiseConstructor::JSPromiseConstructor(JSGlobalObject* globalObject, Structu
{
}
void JSPromiseConstructor::finishCreation(ExecState* exec, JSPromisePrototype* promisePrototype)
void JSPromiseConstructor::finishCreation(VM& vm, JSPromisePrototype* promisePrototype)
{
Base::finishCreation(exec->vm(), "Promise");
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, promisePrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
Base::finishCreation(vm, "Promise");
putDirectWithoutTransition(vm, vm.propertyNames->prototype, promisePrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
}
static EncodedJSValue JSC_HOST_CALL constructPromise(ExecState* exec)
......
......@@ -44,7 +44,7 @@ public:
DECLARE_INFO;
protected:
void finishCreation(ExecState*, JSPromisePrototype*);
void finishCreation(VM&, JSPromisePrototype*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private:
......
......@@ -63,8 +63,9 @@ const ClassInfo JSPromisePrototype::s_info = { "PromisePrototype", &JSNonFinalOb
JSPromisePrototype* JSPromisePrototype::create(ExecState* exec, JSGlobalObject*, Structure* structure)
{
JSPromisePrototype* object = new (NotNull, allocateCell<JSPromisePrototype>(*exec->heap())) JSPromisePrototype(exec, structure);
object->finishCreation(exec, structure);
VM& vm = exec->vm();
JSPromisePrototype* object = new (NotNull, allocateCell<JSPromisePrototype>(vm.heap)) JSPromisePrototype(exec, structure);
object->finishCreation(vm, structure);
return object;
}
......@@ -78,9 +79,9 @@ JSPromisePrototype::JSPromisePrototype(ExecState* exec, Structure* structure)
{
}
void JSPromisePrototype::finishCreation(ExecState* exec, Structure*)
void JSPromisePrototype::finishCreation(VM& vm, Structure*)
{
Base::finishCreation(exec->vm());
Base::finishCreation(vm);
}
bool JSPromisePrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
......
......@@ -42,7 +42,7 @@ public:
DECLARE_INFO;
protected:
void finishCreation(ExecState*, Structure*);
void finishCreation(VM&, Structure*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
private:
......
......@@ -42,8 +42,9 @@ const ClassInfo JSPromiseResolverConstructor::s_info = { "Function", &Base::s_in
JSPromiseResolverConstructor* JSPromiseResolverConstructor::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromiseResolverPrototype* promisePrototype)
{
JSPromiseResolverConstructor* constructor = new (NotNull, allocateCell<JSPromiseResolverConstructor>(*exec->heap())) JSPromiseResolverConstructor(globalObject, structure);
constructor->finishCreation(exec, promisePrototype);
VM& vm = exec->vm();
JSPromiseResolverConstructor* constructor = new (NotNull, allocateCell<JSPromiseResolverConstructor>(vm.heap)) JSPromiseResolverConstructor(globalObject, structure);
constructor->finishCreation(vm, promisePrototype);
return constructor;
}
......@@ -57,10 +58,10 @@ JSPromiseResolverConstructor::JSPromiseResolverConstructor(JSGlobalObject* globa
{
}
void JSPromiseResolverConstructor::finishCreation(ExecState* exec, JSPromiseResolverPrototype* promiseResolverPrototype)
void JSPromiseResolverConstructor::finishCreation(VM& vm, JSPromiseResolverPrototype* promiseResolverPrototype)
{
Base::finishCreation(exec->vm(), "PromiseResolver");
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, promiseResolverPrototype, DontEnum | DontDelete | ReadOnly);
Base::finishCreation(vm, "PromiseResolver");
putDirectWithoutTransition(vm, vm.propertyNames->prototype, promiseResolverPrototype, DontEnum | DontDelete | ReadOnly);
}
ConstructType JSPromiseResolverConstructor::getConstructData(JSCell*, ConstructData&)
......
......@@ -44,7 +44,7 @@ public:
DECLARE_INFO;
protected:
void finishCreation(ExecState*, JSPromiseResolverPrototype*);
void finishCreation(VM&, JSPromiseResolverPrototype*);