Ignore:
Timestamp:
Sep 26, 2013, 5:39:00 PM (12 years ago)
Author:
[email protected]
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r155143 r156521  
    16331633void JSObject::putIndexedDescriptor(ExecState* exec, SparseArrayEntry* entryInMap, const PropertyDescriptor& descriptor, PropertyDescriptor& oldDescriptor)
    16341634{
     1635    VM& vm = exec->vm();
     1636
    16351637    if (descriptor.isDataDescriptor()) {
    16361638        if (descriptor.value())
    1637             entryInMap->set(exec->vm(), this, descriptor.value());
     1639            entryInMap->set(vm, this, descriptor.value());
    16381640        else if (oldDescriptor.isAccessorDescriptor())
    1639             entryInMap->set(exec->vm(), this, jsUndefined());
     1641            entryInMap->set(vm, this, jsUndefined());
    16401642        entryInMap->attributes = descriptor.attributesOverridingCurrent(oldDescriptor) & ~Accessor;
    16411643        return;
     
    16541656            setter = oldDescriptor.setterObject();
    16551657
    1656         GetterSetter* accessor = GetterSetter::create(exec);
     1658        GetterSetter* accessor = GetterSetter::create(vm);
    16571659        if (getter)
    1658             accessor->setGetter(exec->vm(), getter);
     1660            accessor->setGetter(vm, getter);
    16591661        if (setter)
    1660             accessor->setSetter(exec->vm(), setter);
    1661 
    1662         entryInMap->set(exec->vm(), this, accessor);
     1662            accessor->setSetter(vm, setter);
     1663
     1664        entryInMap->set(vm, this, accessor);
    16631665        entryInMap->attributes = descriptor.attributesOverridingCurrent(oldDescriptor) & ~ReadOnly;
    16641666        return;
     
    23972399static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName propertyName, const PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor)
    23982400{
     2401    VM& vm = exec->vm();
    23992402    if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) {
    24002403        if (descriptor.isGenericDescriptor() && oldDescriptor.isAccessorDescriptor()) {
    2401             GetterSetter* accessor = GetterSetter::create(exec);
     2404            GetterSetter* accessor = GetterSetter::create(vm);
    24022405            if (oldDescriptor.getterPresent())
    2403                 accessor->setGetter(exec->vm(), oldDescriptor.getterObject());
     2406                accessor->setGetter(vm, oldDescriptor.getterObject());
    24042407            if (oldDescriptor.setterPresent())
    2405                 accessor->setSetter(exec->vm(), oldDescriptor.setterObject());
     2408                accessor->setSetter(vm, oldDescriptor.setterObject());
    24062409            target->putDirectAccessor(exec, propertyName, accessor, attributes | Accessor);
    24072410            return true;
     
    24122415        else if (oldDescriptor.value())
    24132416            newValue = oldDescriptor.value();
    2414         target->putDirect(exec->vm(), propertyName, newValue, attributes & ~Accessor);
     2417        target->putDirect(vm, propertyName, newValue, attributes & ~Accessor);
    24152418        if (attributes & ReadOnly)
    24162419            target->structure()->setContainsReadOnlyProperties();
     
    24182421    }
    24192422    attributes &= ~ReadOnly;
    2420     GetterSetter* accessor = GetterSetter::create(exec);
     2423    GetterSetter* accessor = GetterSetter::create(vm);
    24212424
    24222425    if (descriptor.getterPresent())
    2423         accessor->setGetter(exec->vm(), descriptor.getterObject());
     2426        accessor->setGetter(vm, descriptor.getterObject());
    24242427    else if (oldDescriptor.getterPresent())
    2425         accessor->setGetter(exec->vm(), oldDescriptor.getterObject());
     2428        accessor->setGetter(vm, oldDescriptor.getterObject());
    24262429    if (descriptor.setterPresent())
    2427         accessor->setSetter(exec->vm(), descriptor.setterObject());
     2430        accessor->setSetter(vm, descriptor.setterObject());
    24282431    else if (oldDescriptor.setterPresent())
    2429         accessor->setSetter(exec->vm(), oldDescriptor.setterObject());
     2432        accessor->setSetter(vm, oldDescriptor.setterObject());
    24302433
    24312434    target->putDirectAccessor(exec, propertyName, accessor, attributes | Accessor);
Note: See TracChangeset for help on using the changeset viewer.