Ignore:
Timestamp:
Jan 26, 2005, 1:38:10 PM (20 years ago)
Author:
rjw
Message:

JavaScriptCore:

Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test

I added a member variable to ObjectImp. This changed it's size and consequently
hampered the optimizations built into the garbage collector. Objects no longer
fit within the allocators cell size, and thus allocation fell back to a slower
allocator.

As a result of this fix I also dramatically cleaned up how runtime objects are
accessed. The path mostly *removes* code.

Reviewed by Chris.

  • bindings/runtime_method.cpp: (RuntimeMethodImp::call):
  • bindings/runtime_object.cpp: (RuntimeObjectImp::get): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::hasProperty): (RuntimeObjectImp::defaultValue):
  • bindings/runtime_object.h:
  • kjs/object.cpp: (KJS::ObjectImp::ObjectImp):
  • kjs/object.h:

WebCore:

Fixed <rdar://problem/3972522> (179-180) 40% slowdown on iBench JavaScript test

I added a member variable to ObjectImp. This changed it's size and consequently
hampered the optimizations built into the garbage collector. Objects no longer
fit within the allocators cell size, and thus allocation fell back to a slower
allocator.

As a result of this fix I also dramatically cleaned up how runtime objects are
accessed. The path mostly *removes* code.

Reviewed by Chris.

  • khtml/ecma/kjs_dom.cpp: (DOMDocumentProtoFunc::tryCall): (DOMElementProtoFunc::tryCall): (KJS::getRuntimeObject):
  • khtml/ecma/kjs_dom.h:
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::tryGet): (KJS::HTMLElement::tryGet): (KJS::HTMLElement::implementsCall): (KJS::HTMLElement::call): (KJS::HTMLElement::tryPut): (KJS::HTMLCollection::tryGet): (KJS::HTMLCollection::getNamedItems):
  • khtml/ecma/kjs_html.h:
  • khtml/ecma/kjs_window.cpp: (Window::get):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bindings/runtime_object.cpp

    r8400 r8453  
    6161}
    6262
    63 RuntimeObjectImp::RuntimeObjectImp(Bindings::Instance *i, const Value &fb, bool oi) : ObjectImp ((ObjectImp *)0)
    64 {
    65     ownsInstance = oi;
    66     instance = i;
    67     fallback = fb;
    68 }
    69 
    7063Value RuntimeObjectImp::get(ExecState *exec, const Identifier &propertyName) const
    7164{
     
    9083                result = Object (new RuntimeMethodImp(exec, propertyName, methodList));
    9184            }
    92             else if (!fallback.isNull() && fallback.type() == ObjectType){
    93                 ObjectImp *imp = static_cast<ObjectImp*>(fallback.imp());
    94                 imp->setForwardingScriptMessage(true);
    95                 result = imp->get (exec, propertyName);
    96                 imp->setForwardingScriptMessage(false);
    97             }
    9885        }
    9986       
     
    121108    }
    122109    else {
    123         bool domHasProperty = false;
    124         if (!fallback.isNull() && fallback.type() == ObjectType){
    125             ObjectImp *imp = static_cast<ObjectImp*>(fallback.imp());
    126             imp->setForwardingScriptMessage(true);
    127             domHasProperty = imp->hasProperty(exec, propertyName);
    128             imp->setForwardingScriptMessage(false);
    129         }
    130        
    131         // If the DOM has the property, give it a crack first (even if it read-only).
    132         if (domHasProperty || !getInternalInstance()->supportsSetValueOfUndefinedField()) {
    133             ObjectImp *imp = static_cast<ObjectImp*>(fallback.imp());
    134             imp->setForwardingScriptMessage(true);
    135             imp->put(exec, propertyName, value, attr);
    136             imp->setForwardingScriptMessage(false);
    137         }
    138         // Now let the runtime object attempt to handle the undefined field.
    139         else if (getInternalInstance()->supportsSetValueOfUndefinedField()){
     110        if (getInternalInstance()->supportsSetValueOfUndefinedField()){
    140111            getInternalInstance()->setValueOfUndefinedField(exec, propertyName, value);
    141112        }
     
    158129        return true;
    159130   
    160     if (!fallback.isNull() && fallback.type() == ObjectType) {
    161         ObjectImp *imp = static_cast<ObjectImp*>(fallback.imp());
    162         imp->setForwardingScriptMessage(true);
    163         result = imp->canPut (exec, propertyName);
    164         imp->setForwardingScriptMessage(false);
    165     }
    166        
    167131    return result;
    168132}
     
    188152        return true;
    189153
    190     if (!fallback.isNull() && fallback.type() == ObjectType) {
    191         ObjectImp *imp = static_cast<ObjectImp*>(fallback.imp());
    192         imp->setForwardingScriptMessage(true);
    193         result = imp->hasProperty (exec, propertyName);
    194         imp->setForwardingScriptMessage(false);
    195     }
    196        
    197154    return result;
    198155}
     
    211168    instance->begin();
    212169
    213     if (!fallback.isNull() && fallback.type() == ObjectType) {
    214         ObjectImp *imp = static_cast<ObjectImp*>(fallback.imp());
    215         imp->setForwardingScriptMessage(true);
    216         result = imp->defaultValue (exec, hint);
    217         imp->setForwardingScriptMessage(false);
    218     }
    219     else {
    220         result = getInternalInstance()->defaultValue(hint);
    221     }
     170    result = getInternalInstance()->defaultValue(hint);
    222171   
    223172    instance->end();
Note: See TracChangeset for help on using the changeset viewer.