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

Pass VM instead of ExecState to simple builtin constructors.

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

Reviewed by Sam Weinig.

None of the simple builtins need the ExecState for anything during
their construction, so reduce the amount of loads by just passing
the VM around instead.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156620 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ffe769be
2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of ExecState to simple builtin constructors.
<https://webkit.org/b/122077>
Reviewed by Sam Weinig.
None of the simple builtins need the ExecState for anything during
their construction, so reduce the amount of loads by just passing
the VM around instead.
2013-09-29 Nadav Rotem <nrotem@apple.com>
Refactor code for finding x86 scratch register.
......@@ -50,8 +50,8 @@ const ClassInfo BooleanPrototype::s_info = { "Boolean", &BooleanObject::s_info,
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanPrototype);
BooleanPrototype::BooleanPrototype(ExecState* exec, Structure* structure)
: BooleanObject(exec->vm(), structure)
BooleanPrototype::BooleanPrototype(VM& vm, Structure* structure)
: BooleanObject(vm, structure)
{
}
......
......@@ -29,10 +29,9 @@ class BooleanPrototype : public BooleanObject {
public:
typedef BooleanObject Base;
static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static BooleanPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
VM& vm = exec->vm();
BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(vm.heap)) BooleanPrototype(exec, structure);
BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(vm.heap)) BooleanPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -49,7 +48,7 @@ protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags;
private:
BooleanPrototype(ExecState*, Structure*);
BooleanPrototype(VM&, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
};
......
......@@ -94,6 +94,7 @@ bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, Prop
// ECMA 15.9.3
JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args)
{
VM& vm = exec->vm();
int numArgs = args.size();
double value;
......@@ -106,7 +107,7 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg
else {
JSValue primitive = args.at(0).toPrimitive(exec);
if (primitive.isString())
value = parseDate(exec->vm(), primitive.getString(exec));
value = parseDate(vm, primitive.getString(exec));
else
value = primitive.toNumber(exec);
}
......@@ -139,11 +140,11 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg
t.setSecond(JSC::toInt32(doubleArguments[5]));
t.setIsDST(-1);
double ms = (numArgs >= 7) ? doubleArguments[6] : 0;
value = gregorianDateTimeToMS(exec->vm(), t, ms, false);
value = gregorianDateTimeToMS(vm, t, ms, false);
}
}
return DateInstance::create(exec, globalObject->dateStructure(), value);
return DateInstance::create(vm, globalObject->dateStructure(), value);
}
static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec)
......
......@@ -34,8 +34,8 @@ namespace JSC {
const ClassInfo DateInstance::s_info = {"Date", &JSWrapperObject::s_info, 0, 0, CREATE_METHOD_TABLE(DateInstance)};
DateInstance::DateInstance(ExecState* exec, Structure* structure)
: JSWrapperObject(exec->vm(), structure)
DateInstance::DateInstance(VM& vm, Structure* structure)
: JSWrapperObject(vm, structure)
{
}
......
......@@ -27,7 +27,7 @@ namespace JSC {
class DateInstance : public JSWrapperObject {
protected:
JS_EXPORT_PRIVATE DateInstance(ExecState*, Structure*);
JS_EXPORT_PRIVATE DateInstance(VM&, Structure*);
void finishCreation(VM&);
JS_EXPORT_PRIVATE void finishCreation(VM&, double);
......@@ -36,17 +36,17 @@ namespace JSC {
public:
typedef JSWrapperObject Base;
static DateInstance* create(ExecState* exec, Structure* structure, double date)
static DateInstance* create(VM& vm, Structure* structure, double date)
{
DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
instance->finishCreation(exec->vm(), date);
DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
instance->finishCreation(vm, date);
return instance;
}
static DateInstance* create(ExecState* exec, Structure* structure)
static DateInstance* create(VM& vm, Structure* structure)
{
DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
instance->finishCreation(exec->vm());
DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
instance->finishCreation(vm);
return instance;
}
......
......@@ -501,8 +501,8 @@ const ClassInfo DatePrototype::s_info = {"Date", &DateInstance::s_info, 0, ExecS
// ECMA 15.9.4
DatePrototype::DatePrototype(ExecState* exec, Structure* structure)
: DateInstance(exec, structure)
DatePrototype::DatePrototype(VM& vm, Structure* structure)
: DateInstance(vm, structure)
{
}
......
......@@ -29,15 +29,14 @@ namespace JSC {
class DatePrototype : public DateInstance {
private:
DatePrototype(ExecState*, Structure*);
DatePrototype(VM&, Structure*);
public:
typedef DateInstance Base;
static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static DatePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
VM& vm = exec->vm();
DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(exec, structure);
DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......
......@@ -49,8 +49,8 @@ const ClassInfo ErrorPrototype::s_info = { "Error", &ErrorInstance::s_info, 0, E
@end
*/
ErrorPrototype::ErrorPrototype(ExecState* exec, Structure* structure)
: ErrorInstance(exec->vm(), structure)
ErrorPrototype::ErrorPrototype(VM& vm, Structure* structure)
: ErrorInstance(vm, structure)
{
}
......
......@@ -31,10 +31,9 @@ namespace JSC {
public:
typedef ErrorInstance Base;
static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static ErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
VM& vm = exec->vm();
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(exec, structure);
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -47,7 +46,7 @@ namespace JSC {
}
protected:
ErrorPrototype(ExecState*, Structure*);
ErrorPrototype(VM&, Structure*);
void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
......
......@@ -78,23 +78,19 @@ JSArrayBufferPrototype::JSArrayBufferPrototype(VM& vm, Structure* structure)
{
}
void JSArrayBufferPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
void JSArrayBufferPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
VM& vm = exec->vm();
Base::finishCreation(vm);
JSC_NATIVE_FUNCTION(vm.propertyNames->slice, arrayBufferProtoFuncSlice, DontEnum, 2);
}
JSArrayBufferPrototype* JSArrayBufferPrototype::create(
ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
JSArrayBufferPrototype* JSArrayBufferPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
VM& vm = exec->vm();
JSArrayBufferPrototype* prototype =
new (NotNull, allocateCell<JSArrayBufferPrototype>(vm.heap))
JSArrayBufferPrototype(vm, structure);
prototype->finishCreation(exec, globalObject);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......
......@@ -36,10 +36,10 @@ public:
protected:
JSArrayBufferPrototype(VM&, Structure*);
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);
public:
static JSArrayBufferPrototype* create(ExecState*, JSGlobalObject*, Structure*);
static JSArrayBufferPrototype* create(VM&, JSGlobalObject*, Structure*);
DECLARE_INFO;
......
......@@ -312,7 +312,7 @@ void JSGlobalObject::reset(JSValue prototype)
#endif // ENABLE(PROMISES)
#define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(exec, this, capitalName##Prototype::createStructure(vm, this, m_objectPrototype.get()))); \
m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_objectPrototype.get()))); \
m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, this, m_ ## lowerName ## Prototype.get()));
FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
......@@ -344,12 +344,12 @@ void JSGlobalObject::reset(JSValue prototype)
Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(vm, this, m_errorPrototype.get());
Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(vm, this, m_functionPrototype.get());
m_evalErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError")));
m_rangeErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("RangeError")));
m_referenceErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("ReferenceError")));
m_syntaxErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("SyntaxError")));
m_typeErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("TypeError")));
m_URIErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("URIError")));
m_evalErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError")));
m_rangeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("RangeError")));
m_referenceErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("ReferenceError")));
m_syntaxErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("SyntaxError")));
m_typeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("TypeError")));
m_URIErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("URIError")));
m_objectPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, objectConstructor, DontEnum);
m_functionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, functionConstructor, DontEnum);
......
......@@ -2201,12 +2201,11 @@ bool JSObject::putDirectIndexBeyondVectorLength(ExecState* exec, unsigned i, JSV
}
}
void JSObject::putDirectNativeFunction(ExecState* exec, JSGlobalObject* globalObject, const PropertyName& propertyName, unsigned functionLength, NativeFunction nativeFunction, Intrinsic intrinsic, unsigned attributes)
void JSObject::putDirectNativeFunction(VM& vm, JSGlobalObject* globalObject, const PropertyName& propertyName, unsigned functionLength, NativeFunction nativeFunction, Intrinsic intrinsic, unsigned attributes)
{
StringImpl* name = propertyName.publicName();
ASSERT(name);
VM& vm = exec->vm();
JSFunction* function = JSFunction::create(vm, globalObject, functionLength, name, nativeFunction, intrinsic);
putDirect(vm, propertyName, function, attributes);
}
......
......@@ -577,7 +577,7 @@ public:
void putDirect(VM& vm, PropertyOffset offset, JSValue value) { locationForOffset(offset)->set(vm, this, value); }
void putDirectUndefined(PropertyOffset offset) { locationForOffset(offset)->setUndefined(); }
void putDirectNativeFunction(ExecState*, JSGlobalObject*, const PropertyName&, unsigned functionLength, NativeFunction, Intrinsic, unsigned attributes);
void putDirectNativeFunction(VM&, JSGlobalObject*, const PropertyName&, unsigned functionLength, NativeFunction, Intrinsic, unsigned attributes);
void putDirectNativeFunctionWithoutTransition(ExecState*, JSGlobalObject*, const PropertyName&, unsigned functionLength, NativeFunction, Intrinsic, unsigned attributes);
JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
......@@ -1498,12 +1498,12 @@ inline int offsetRelativeToBase(PropertyOffset offset)
COMPILE_ASSERT(!(sizeof(JSObject) % sizeof(WriteBarrierBase<Unknown>)), JSObject_inline_storage_has_correct_alignment);
ALWAYS_INLINE Identifier makeIdentifier(ExecState* exec, const char* name)
ALWAYS_INLINE Identifier makeIdentifier(VM& vm, const char* name)
{
return Identifier(exec, name);
return Identifier(&vm, name);
}
ALWAYS_INLINE Identifier makeIdentifier(ExecState*, const Identifier& name)
ALWAYS_INLINE Identifier makeIdentifier(VM&, const Identifier& name)
{
return name;
}
......@@ -1514,7 +1514,7 @@ ALWAYS_INLINE Identifier makeIdentifier(ExecState*, const Identifier& name)
// have the expected meanings.
#define JSC_NATIVE_INTRINSIC_FUNCTION(jsName, cppName, attributes, length, intrinsic) \
putDirectNativeFunction(\
exec, globalObject, makeIdentifier(exec, (jsName)), (length), cppName, \
vm, globalObject, makeIdentifier(vm, (jsName)), (length), cppName, \
(intrinsic), (attributes))
// As above, but this assumes that the function you're defining doesn't have an
......
......@@ -69,8 +69,9 @@ bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject*
{
ASSERT(thisObj->globalObject());
ASSERT(entry->attributes() & Function);
VM& vm = exec->vm();
unsigned attributes;
PropertyOffset offset = thisObj->getDirectOffset(exec->vm(), propertyName, attributes);
PropertyOffset offset = thisObj->getDirectOffset(vm, propertyName, attributes);
if (!isValidOffset(offset)) {
// If a property is ever deleted from an object with a static table, then we reify
......@@ -79,9 +80,9 @@ bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject*
return false;
thisObj->putDirectNativeFunction(
exec, thisObj->globalObject(), propertyName, entry->functionLength(),
vm, thisObj->globalObject(), propertyName, entry->functionLength(),
entry->function(), entry->intrinsic(), entry->attributes());
offset = thisObj->getDirectOffset(exec->vm(), propertyName, attributes);
offset = thisObj->getDirectOffset(vm, propertyName, attributes);
ASSERT(isValidOffset(offset));
}
......
......@@ -48,10 +48,8 @@ static EncodedJSValue JSC_HOST_CALL mapProtoFuncSet(ExecState*);
static EncodedJSValue JSC_HOST_CALL mapProtoFuncSize(ExecState*);
void MapPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
void MapPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
VM& vm = exec->vm();
Base::finishCreation(vm);
ASSERT(inherits(info()));
vm.prototypeMap.addPrototype(this);
......
......@@ -34,10 +34,10 @@ class MapPrototype : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static MapPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static MapPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
MapPrototype* prototype = new (NotNull, allocateCell<MapPrototype>(*exec->heap())) MapPrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
MapPrototype* prototype = new (NotNull, allocateCell<MapPrototype>(vm.heap)) MapPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -49,11 +49,11 @@ public:
}
private:
MapPrototype(ExecState* exec, Structure* structure)
: Base(exec->vm(), structure)
MapPrototype(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);
};
}
......
......@@ -34,10 +34,10 @@ namespace JSC {
public:
typedef InternalFunction Base;
static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
static NativeErrorConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
{
NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(globalObject, structure);
constructor->finishCreation(exec, globalObject, prototypeStructure, name);
NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(vm.heap)) NativeErrorConstructor(globalObject, structure);
constructor->finishCreation(vm, globalObject, prototypeStructure, name);
return constructor;
}
......@@ -51,16 +51,16 @@ namespace JSC {
Structure* errorStructure() { return m_errorStructure.get(); }
protected:
void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const String& name)
void finishCreation(VM& vm, JSGlobalObject* globalObject, Structure* prototypeStructure, const String& name)
{
Base::finishCreation(exec->vm(), name);
Base::finishCreation(vm, name);
ASSERT(inherits(info()));
NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this);
NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, globalObject, prototypeStructure, name, this);
putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
putDirect(exec->vm(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
m_errorStructure.set(exec->vm(), this, ErrorInstance::createStructure(exec->vm(), globalObject, prototype));
putDirect(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
putDirect(vm, vm.propertyNames->prototype, prototype, DontDelete | ReadOnly | DontEnum);
m_errorStructure.set(vm, this, ErrorInstance::createStructure(vm, globalObject, prototype));
ASSERT(m_errorStructure);
ASSERT(m_errorStructure->isObject());
}
......
......@@ -28,8 +28,8 @@
namespace JSC {
NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, Structure* structure)
: ErrorPrototype(exec, structure)
NativeErrorPrototype::NativeErrorPrototype(VM& vm, Structure* structure)
: ErrorPrototype(vm, structure)
{
}
......
......@@ -28,15 +28,14 @@ namespace JSC {
class NativeErrorPrototype : public ErrorPrototype {
private:
NativeErrorPrototype(ExecState*, Structure*);
NativeErrorPrototype(VM&, Structure*);
public:
typedef ErrorPrototype Base;
static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
static NativeErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
{
VM& vm = exec->vm();
NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(exec, structure);
NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(vm, structure);
prototype->finishCreation(vm, globalObject, name, constructor);
return prototype;
}
......
......@@ -70,8 +70,8 @@ const ClassInfo NumberPrototype::s_info = { "Number", &NumberObject::s_info, 0,
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(NumberPrototype);
NumberPrototype::NumberPrototype(ExecState* exec, Structure* structure)
: NumberObject(exec->vm(), structure)
NumberPrototype::NumberPrototype(VM& vm, Structure* structure)
: NumberObject(vm, structure)
{
}
......
......@@ -29,10 +29,9 @@ namespace JSC {
public:
typedef NumberObject Base;
static NumberPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static NumberPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
VM& vm = exec->vm();
NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(vm.heap)) NumberPrototype(exec, structure);
NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(vm.heap)) NumberPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -49,7 +48,7 @@ namespace JSC {
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NumberObject::StructureFlags;
private:
NumberPrototype(ExecState*, Structure*);
NumberPrototype(VM&, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
};
......
......@@ -47,10 +47,8 @@ static EncodedJSValue JSC_HOST_CALL setProtoFuncHas(ExecState*);
static EncodedJSValue JSC_HOST_CALL setProtoFuncSize(ExecState*);
void SetPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
void SetPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
VM& vm = exec->vm();
Base::finishCreation(vm);
ASSERT(inherits(info()));
vm.prototypeMap.addPrototype(this);
......
......@@ -34,10 +34,10 @@ class SetPrototype : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static SetPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static SetPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
SetPrototype* prototype = new (NotNull, allocateCell<SetPrototype>(*exec->heap())) SetPrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
SetPrototype* prototype = new (NotNull, allocateCell<SetPrototype>(vm.heap)) SetPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}
......@@ -49,11 +49,11 @@ public:
}
private:
SetPrototype(ExecState* exec, Structure* structure)
: Base(exec->vm(), structure)
SetPrototype(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);
};
}
......
......@@ -85,15 +85,13 @@ static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0, 0, CREATE_METHOD_TABLE(StringPrototype) };
// ECMA 15.5.4
StringPrototype::StringPrototype(ExecState* exec, Structure* structure)
: StringObject(exec->vm(), structure)
StringPrototype::StringPrototype(VM& vm, Structure* structure)
: StringObject(vm, structure)
{
}
void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, JSString* nameAndMessage)
void StringPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject, JSString* nameAndMessage)
{
VM& vm = exec->vm();
Base::finishCreation(vm, nameAndMessage);
ASSERT(inherits(info()));
......@@ -134,14 +132,14 @@ void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObje
JSC_NATIVE_FUNCTION("trimRight", stringProtoFuncTrimRight, DontEnum, 0);
// The constructor will be added later, after StringConstructor has been built
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
}
StringPrototype* StringPrototype::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
StringPrototype* StringPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
JSString* empty = jsEmptyString(exec);
StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, structure);
prototype->finishCreation(exec, globalObject, empty);
JSString* empty = jsEmptyString(&vm);
StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(vm.heap)) StringPrototype(vm, structure);
prototype->finishCreation(vm, globalObject, empty);
return prototype;
}
......
......@@ -29,12 +29,12 @@ namespace JSC {
class StringPrototype : public StringObject {
private:
StringPrototype(ExecState*, Structure*);
StringPrototype(VM&, Structure*);
public:
typedef StringObject Base;
static StringPrototype* create(ExecState*, JSGlobalObject*, Structure*);
static StringPrototype* create(VM&, JSGlobalObject*, Structure*);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
......@@ -44,7 +44,7 @@ namespace JSC {
DECLARE_INFO;
protected:
void finishCreation(ExecState*, JSGlobalObject*, JSString*);
void finishCreation(VM&, JSGlobalObject*, JSString*);
static const unsigned StructureFlags = StringObject::StructureFlags;
};
......
......@@ -40,19 +40,17 @@ static EncodedJSValue JSC_HOST_CALL protoFuncWeakMapGet(ExecState*);
static EncodedJSValue JSC_HOST_CALL protoFuncWeakMapHas(ExecState*);
static EncodedJSValue JSC_HOST_CALL protoFuncWeakMapSet(ExecState*);
void WeakMapPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
void WeakMapPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
VM& vm = exec->vm();
Base::finishCreation(vm);
ASSERT(inherits(info()));
vm.prototypeMap.addPrototype(this);
JSC_NATIVE_FUNCTION(exec->propertyNames().clear, protoFuncWeakMapClear, DontEnum, 0);
JSC_NATIVE_FUNCTION(exec->propertyNames().deleteKeyword, protoFuncWeakMapDelete, DontEnum, 1);
JSC_NATIVE_FUNCTION(exec->propertyNames().get, protoFuncWeakMapGet, DontEnum, 1);
JSC_NATIVE_FUNCTION(exec->propertyNames().has, protoFuncWeakMapHas, DontEnum, 1);
JSC_NATIVE_FUNCTION(exec->propertyNames().set, protoFuncWeakMapSet, DontEnum, 2);
JSC_NATIVE_FUNCTION(vm.propertyNames->clear, protoFuncWeakMapClear, DontEnum, 0);
JSC_NATIVE_FUNCTION(vm.propertyNames->deleteKeyword, protoFuncWeakMapDelete, DontEnum, 1);
JSC_NATIVE_FUNCTION(vm.propertyNames->get, protoFuncWeakMapGet, DontEnum, 1);
JSC_NATIVE_FUNCTION(vm.propertyNames->has, protoFuncWeakMapHas, DontEnum, 1);
JSC_NATIVE_FUNCTION(vm.propertyNames->set, protoFuncWeakMapSet, DontEnum, 2);
}
static WeakMapData* getWeakMapData(CallFrame* callFrame, JSValue value)
......
......@@ -34,10 +34,10 @@ class WeakMapPrototype : public JSNonFinalObject {
public:
typedef JSNonFinalObject Base;
static WeakMapPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
static WeakMapPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
WeakMapPrototype* prototype = new (NotNull, allocateCell<WeakMapPrototype>(*exec->heap())) WeakMapPrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
WeakMapPrototype*