Commit 1a4cbada authored by akling@apple.com's avatar akling@apple.com

Pass VM instead of JSGlobalObject to ArrayPrototype constructor.

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

Reviewed by Geoffrey Garen.

ArrayPrototype doesn't need the global object for anything during
construction, so reduce the amount of loads by just passing the VM.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b34659a8
2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of JSGlobalObject to ArrayPrototype constructor.
<https://webkit.org/b/122079>
Reviewed by Geoffrey Garen.
ArrayPrototype doesn't need the global object for anything during
construction, so reduce the amount of loads by just passing the VM.
2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of ExecState to simple builtin constructors.
......@@ -115,22 +115,21 @@ const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecStat
@end
*/
ArrayPrototype* ArrayPrototype::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
ArrayPrototype* ArrayPrototype::create(VM& vm, Structure* structure)
{
ArrayPrototype* prototype = new (NotNull, allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure);
prototype->finishCreation(globalObject);
ArrayPrototype* prototype = new (NotNull, allocateCell<ArrayPrototype>(vm.heap)) ArrayPrototype(vm, structure);
prototype->finishCreation(vm);
return prototype;
}
// ECMA 15.4.4
ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, Structure* structure)
: JSArray(globalObject->vm(), structure, 0)
ArrayPrototype::ArrayPrototype(VM& vm, Structure* structure)
: JSArray(vm, structure, 0)
{
}
void ArrayPrototype::finishCreation(JSGlobalObject* globalObject)
void ArrayPrototype::finishCreation(VM& vm)
{
VM& vm = globalObject->vm();
Base::finishCreation(vm);
ASSERT(inherits(info()));
vm.prototypeMap.addPrototype(this);
......
......@@ -28,12 +28,12 @@ namespace JSC {
class ArrayPrototype : public JSArray {
private:
ArrayPrototype(JSGlobalObject*, Structure*);
ArrayPrototype(VM&, Structure*);
public:
typedef JSArray Base;
static ArrayPrototype* create(ExecState*, JSGlobalObject*, Structure*);
static ArrayPrototype* create(VM&, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
......@@ -45,7 +45,7 @@ public:
}
protected:
void finishCreation(JSGlobalObject*);
void finishCreation(VM&);
};
} // namespace JSC
......
......@@ -283,7 +283,7 @@ void JSGlobalObject::reset(JSValue prototype)
m_objcWrapperObjectStructure.set(vm, this, JSCallbackObject<JSAPIWrapperObject>::createStructure(vm, this, m_objectPrototype.get()));
#endif
m_arrayPrototype.set(vm, this, ArrayPrototype::create(exec, this, ArrayPrototype::createStructure(vm, this, m_objectPrototype.get())));
m_arrayPrototype.set(vm, this, ArrayPrototype::create(vm, ArrayPrototype::createStructure(vm, this, m_objectPrototype.get())));
m_originalArrayStructureForIndexingShape[UndecidedShape >> IndexingShapeShift].set(vm, this, JSArray::createStructure(vm, this, m_arrayPrototype.get(), ArrayWithUndecided));
m_originalArrayStructureForIndexingShape[Int32Shape >> IndexingShapeShift].set(vm, this, JSArray::createStructure(vm, this, m_arrayPrototype.get(), ArrayWithInt32));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment