Skip to content
Permalink
Browse files
Pass VM instead of ExecState to ObjectPrototype constructor.
<https://webkit.org/b/122116>

Reviewed by Geoffrey Garen.

The ObjectPrototype constructor was only using the ExecState to get
to the VM.


Canonical link: https://commits.webkit.org/140177@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Andreas Kling committed Sep 30, 2013
1 parent 4832cc4 commit 6acd17367207d8d586027b4f05414381a470dd11
Showing 4 changed files with 20 additions and 12 deletions.
@@ -1,3 +1,13 @@
2013-09-30 Andreas Kling <akling@apple.com>

Pass VM instead of ExecState to ObjectPrototype constructor.
<https://webkit.org/b/122116>

Reviewed by Geoffrey Garen.

The ObjectPrototype constructor was only using the ExecState to get
to the VM.

2013-09-30 Andreas Kling <akling@apple.com>

Pass VM instead of JSGlobalObject to MathObject constructor.
@@ -238,7 +238,7 @@ void JSGlobalObject::reset(JSValue prototype)
m_functionPrototype->addFunctionProperties(exec, this, &callFunction, &applyFunction);
m_callFunction.set(vm, this, callFunction);
m_applyFunction.set(vm, this, applyFunction);
m_objectPrototype.set(vm, this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(vm, this, jsNull())));
m_objectPrototype.set(vm, this, ObjectPrototype::create(vm, this, ObjectPrototype::createStructure(vm, this, jsNull())));
GetterSetter* protoAccessor = GetterSetter::create(vm);
protoAccessor->setGetter(vm, JSFunction::create(vm, this, 0, String(), globalFuncProtoGetter));
protoAccessor->setSetter(vm, JSFunction::create(vm, this, 0, String(), globalFuncProtoSetter));
@@ -45,15 +45,13 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ObjectPrototype);

const ClassInfo ObjectPrototype::s_info = { "Object", &JSNonFinalObject::s_info, 0, 0, CREATE_METHOD_TABLE(ObjectPrototype) };

ObjectPrototype::ObjectPrototype(ExecState* exec, Structure* stucture)
: JSNonFinalObject(exec->vm(), stucture)
ObjectPrototype::ObjectPrototype(VM& vm, Structure* stucture)
: JSNonFinalObject(vm, stucture)
{
}

void ObjectPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
void ObjectPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
VM& vm = exec->vm();

Base::finishCreation(vm);
ASSERT(inherits(info()));
vm.prototypeMap.addPrototype(this);
@@ -70,10 +68,10 @@ void ObjectPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObje
JSC_NATIVE_FUNCTION(vm.propertyNames->__lookupSetter__, objectProtoFuncLookupSetter, DontEnum, 1);
}

ObjectPrototype* ObjectPrototype::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
ObjectPrototype* ObjectPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
{
ObjectPrototype* prototype = new (NotNull, allocateCell<ObjectPrototype>(*exec->heap())) ObjectPrototype(exec, structure);
prototype->finishCreation(exec, globalObject);
ObjectPrototype* prototype = new (NotNull, allocateCell<ObjectPrototype>(vm.heap)) ObjectPrototype(vm, structure);
prototype->finishCreation(vm, globalObject);
return prototype;
}

@@ -29,7 +29,7 @@ namespace JSC {
public:
typedef JSNonFinalObject Base;

static ObjectPrototype* create(ExecState*, JSGlobalObject*, Structure*);
static ObjectPrototype* create(VM&, JSGlobalObject*, Structure*);

DECLARE_INFO;

@@ -39,10 +39,10 @@ namespace JSC {
}

protected:
void finishCreation(ExecState*, JSGlobalObject*);
void finishCreation(VM&, JSGlobalObject*);

private:
ObjectPrototype(ExecState*, Structure*);
ObjectPrototype(VM&, Structure*);
};

JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState*);

0 comments on commit 6acd173

Please sign in to comment.