Commit 8370dec1 authored by akling@apple.com's avatar akling@apple.com

GetterSetter construction should take a VM instead of ExecState.

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

Reviewed by Sam Weinig.

Pass VM& instead of ExecState* to GetterSetter. Updated surrounding
code at touched sites to cache VM in a local for fewer loads.

JSC release binary size -= 4120 bytes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 723c7a43
2013-09-26 Andreas Kling <akling@apple.com>
GetterSetter construction should take a VM instead of ExecState.
<https://webkit.org/b/121993>
Reviewed by Sam Weinig.
Pass VM& instead of ExecState* to GetterSetter. Updated surrounding
code at touched sites to cache VM in a local for fewer loads.
JSC release binary size -= 4120 bytes.
2013-09-26 Oliver Hunt <oliver@apple.com>
Make GCC happy
......@@ -2112,7 +2112,8 @@ DEFINE_STUB_FUNCTION(void, op_put_getter_setter)
ASSERT(stackFrame.args[0].jsValue().isObject());
JSObject* baseObj = asObject(stackFrame.args[0].jsValue());
GetterSetter* accessor = GetterSetter::create(callFrame);
VM& vm = callFrame->vm();
GetterSetter* accessor = GetterSetter::create(vm);
JSValue getter = stackFrame.args[2].jsValue();
JSValue setter = stackFrame.args[3].jsValue();
......@@ -2121,9 +2122,9 @@ DEFINE_STUB_FUNCTION(void, op_put_getter_setter)
ASSERT(getter.isObject() || setter.isObject());
if (!getter.isUndefined())
accessor->setGetter(callFrame->vm(), asObject(getter));
accessor->setGetter(vm, asObject(getter));
if (!setter.isUndefined())
accessor->setSetter(callFrame->vm(), asObject(setter));
accessor->setSetter(vm, asObject(setter));
baseObj->putDirectAccessor(callFrame, stackFrame.args[1].identifier(), accessor, Accessor);
}
......
......@@ -787,7 +787,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_getter_setter)
ASSERT(LLINT_OP(1).jsValue().isObject());
JSObject* baseObj = asObject(LLINT_OP(1).jsValue());
GetterSetter* accessor = GetterSetter::create(exec);
GetterSetter* accessor = GetterSetter::create(vm);
LLINT_CHECK_EXCEPTION();
JSValue getter = LLINT_OP(3).jsValue();
......
......@@ -38,18 +38,18 @@ namespace JSC {
friend class JIT;
private:
GetterSetter(ExecState* exec)
: JSCell(exec->vm(), exec->vm().getterSetterStructure.get())
GetterSetter(VM& vm)
: JSCell(vm, vm.getterSetterStructure.get())
{
}
public:
typedef JSCell Base;
static GetterSetter* create(ExecState* exec)
static GetterSetter* create(VM& vm)
{
GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec);
getterSetter->finishCreation(exec->vm());
GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(vm.heap)) GetterSetter(vm);
getterSetter->finishCreation(vm);
return getterSetter;
}
......
......@@ -1632,11 +1632,13 @@ NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue g
void JSObject::putIndexedDescriptor(ExecState* exec, SparseArrayEntry* entryInMap, const PropertyDescriptor& descriptor, PropertyDescriptor& oldDescriptor)
{
VM& vm = exec->vm();
if (descriptor.isDataDescriptor()) {
if (descriptor.value())
entryInMap->set(exec->vm(), this, descriptor.value());
entryInMap->set(vm, this, descriptor.value());
else if (oldDescriptor.isAccessorDescriptor())
entryInMap->set(exec->vm(), this, jsUndefined());
entryInMap->set(vm, this, jsUndefined());
entryInMap->attributes = descriptor.attributesOverridingCurrent(oldDescriptor) & ~Accessor;
return;
}
......@@ -1653,13 +1655,13 @@ void JSObject::putIndexedDescriptor(ExecState* exec, SparseArrayEntry* entryInMa
else if (oldDescriptor.isAccessorDescriptor())
setter = oldDescriptor.setterObject();
GetterSetter* accessor = GetterSetter::create(exec);
GetterSetter* accessor = GetterSetter::create(vm);
if (getter)
accessor->setGetter(exec->vm(), getter);
accessor->setGetter(vm, getter);
if (setter)
accessor->setSetter(exec->vm(), setter);
accessor->setSetter(vm, setter);
entryInMap->set(exec->vm(), this, accessor);
entryInMap->set(vm, this, accessor);
entryInMap->attributes = descriptor.attributesOverridingCurrent(oldDescriptor) & ~ReadOnly;
return;
}
......@@ -2396,13 +2398,14 @@ bool JSObject::getOwnPropertyDescriptor(ExecState* exec, PropertyName propertyNa
static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName propertyName, const PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor)
{
VM& vm = exec->vm();
if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) {
if (descriptor.isGenericDescriptor() && oldDescriptor.isAccessorDescriptor()) {
GetterSetter* accessor = GetterSetter::create(exec);
GetterSetter* accessor = GetterSetter::create(vm);
if (oldDescriptor.getterPresent())
accessor->setGetter(exec->vm(), oldDescriptor.getterObject());
accessor->setGetter(vm, oldDescriptor.getterObject());
if (oldDescriptor.setterPresent())
accessor->setSetter(exec->vm(), oldDescriptor.setterObject());
accessor->setSetter(vm, oldDescriptor.setterObject());
target->putDirectAccessor(exec, propertyName, accessor, attributes | Accessor);
return true;
}
......@@ -2411,22 +2414,22 @@ static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName proper
newValue = descriptor.value();
else if (oldDescriptor.value())
newValue = oldDescriptor.value();
target->putDirect(exec->vm(), propertyName, newValue, attributes & ~Accessor);
target->putDirect(vm, propertyName, newValue, attributes & ~Accessor);
if (attributes & ReadOnly)
target->structure()->setContainsReadOnlyProperties();
return true;
}
attributes &= ~ReadOnly;
GetterSetter* accessor = GetterSetter::create(exec);
GetterSetter* accessor = GetterSetter::create(vm);
if (descriptor.getterPresent())
accessor->setGetter(exec->vm(), descriptor.getterObject());
accessor->setGetter(vm, descriptor.getterObject());
else if (oldDescriptor.getterPresent())
accessor->setGetter(exec->vm(), oldDescriptor.getterObject());
accessor->setGetter(vm, oldDescriptor.getterObject());
if (descriptor.setterPresent())
accessor->setSetter(exec->vm(), descriptor.setterObject());
accessor->setSetter(vm, descriptor.setterObject());
else if (oldDescriptor.setterPresent())
accessor->setSetter(exec->vm(), oldDescriptor.setterObject());
accessor->setSetter(vm, oldDescriptor.setterObject());
target->putDirectAccessor(exec, propertyName, accessor, attributes | Accessor);
return true;
......
......@@ -63,9 +63,9 @@ void MapPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
JSC_NATIVE_FUNCTION(vm.propertyNames->has, mapProtoFuncHas, DontEnum, 1);
JSC_NATIVE_FUNCTION(vm.propertyNames->set, mapProtoFuncSet, DontEnum, 2);
GetterSetter* accessor = GetterSetter::create(exec);
GetterSetter* accessor = GetterSetter::create(vm);
JSFunction* function = JSFunction::create(exec, globalObject, 0, vm.propertyNames->size.string(), mapProtoFuncSize);
accessor->setGetter(exec->vm(), function);
accessor->setGetter(vm, function);
putDirectAccessor(exec, vm.propertyNames->size, accessor, DontEnum | Accessor);
}
......
......@@ -61,9 +61,9 @@ void SetPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
JSC_NATIVE_FUNCTION(vm.propertyNames->forEach, setProtoFuncForEach, DontEnum, 1);
JSC_NATIVE_FUNCTION(vm.propertyNames->has, setProtoFuncHas, DontEnum, 1);
GetterSetter* accessor = GetterSetter::create(exec);
GetterSetter* accessor = GetterSetter::create(vm);
JSFunction* function = JSFunction::create(exec, globalObject, 0, vm.propertyNames->size.string(), setProtoFuncSize);
accessor->setGetter(exec->vm(), function);
accessor->setGetter(vm, function);
putDirectAccessor(exec, vm.propertyNames->size, accessor, DontEnum | Accessor);
}
......
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