Ignore:
Timestamp:
Jul 25, 2005, 3:17:20 PM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.

  • 10% speedup on JavaScript iBench
  • 5% speedup on 24fun BenchJS benchmark

Changed all get methods to getOwnProperty - they are no longer
responsible for prototype lookup, and determine if the property
was found as a side efect.

get() is now a nonvirtual ObjectImp method which calls the virtual
getOwnProperty and walks the prototype chain. A few selected
methods were inlined.

Changed ResolveNode::evaluate plus some other places to use
getProperty which does get() and hasProperty() in one lookup.

Also miscellaneous code cleanup.

  • bindings/objc/objc_runtime.h:
  • bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::ObjcFallbackObjectImp): (ObjcFallbackObjectImp::getOwnProperty):
  • bindings/runtime_array.cpp: (RuntimeArrayImp::RuntimeArrayImp): (RuntimeArrayImp::getOwnProperty):
  • bindings/runtime_array.h:
  • bindings/runtime_method.cpp: (RuntimeMethodImp::getOwnProperty):
  • bindings/runtime_method.h:
  • bindings/runtime_object.cpp: (RuntimeObjectImp::getOwnProperty):
  • bindings/runtime_object.h:
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstanceImp::getOwnProperty): (ArrayPrototypeImp::getOwnProperty): (ArrayProtoFuncImp::call):
  • kjs/array_object.h:
  • kjs/date_object.cpp: (DatePrototypeImp::getOwnProperty):
  • kjs/date_object.h:
  • kjs/function.cpp: (KJS::FunctionImp::getOwnProperty): (KJS::ArgumentsImp::getOwnProperty): (KJS::ActivationImp::getOwnProperty):
  • kjs/function.h:
  • kjs/lookup.h: (KJS::lookupGetOwnProperty): (KJS::lookupGetOwnFunction): (KJS::lookupGetOwnValue):
  • kjs/math_object.cpp: (MathObjectImp::getOwnProperty): (MathObjectImp::getValueProperty):
  • kjs/math_object.h:
  • kjs/nodes.cpp: (ResolveNode::evaluate):
  • kjs/number_object.cpp: (NumberObjectImp::getOwnProperty):
  • kjs/number_object.h:
  • kjs/object.cpp: (KJS::ObjectImp::get): (KJS::ObjectImp::getOwnProperty): (KJS::ObjectImp::getProperty):
  • kjs/object.h: (KJS::ObjectImp::getProperty): (KJS::ObjectImp::getOwnProperty):
  • kjs/object_object.cpp: (ObjectProtoFuncImp::call):
  • kjs/regexp_object.cpp: (RegExpObjectImp::getOwnProperty):
  • kjs/regexp_object.h:
  • kjs/string_object.cpp: (StringInstanceImp::getOwnProperty): (StringPrototypeImp::getOwnProperty):
  • kjs/string_object.h:

WebCore:

Reviewed by Darin.

  • 10% speedup on JavaScript iBench
  • 5% speedup on 24fun BenchJS benchmark

Changed all get methods to getOwnProperty - they are no longer responsible for
prototype lookup, and determine if the property was found as a side efect.

Also miscellaneous code cleanup.

  • khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::getOwnProperty): (KJS::DOMStyleSheet::getOwnProperty): (KJS::DOMStyleSheetList::getOwnProperty): (KJS::DOMMediaList::getOwnProperty): (KJS::DOMCSSStyleSheet::getOwnProperty): (KJS::DOMCSSRuleList::getOwnProperty): (KJS::DOMCSSRule::getOwnProperty): (KJS::DOMCSSRule::getValueProperty): (KJS::CSSRuleConstructor::getOwnProperty): (KJS::DOMCSSValue::getOwnProperty): (KJS::CSSValueConstructor::getOwnProperty): (KJS::DOMCSSPrimitiveValue::getOwnProperty): (KJS::CSSPrimitiveValueConstructor::getOwnProperty): (KJS::DOMCSSValueList::getOwnProperty): (KJS::DOMRGBColor::getOwnProperty): (KJS::DOMRect::getOwnProperty): (KJS::DOMCounter::getOwnProperty):
  • khtml/ecma/kjs_css.h:
  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getOwnProperty): (KJS::DOMNodeList::getOwnProperty): (KJS::DOMAttr::getOwnProperty): (KJS::DOMDocument::getOwnProperty): (KJS::DOMElement::getOwnProperty): (KJS::DOMDocumentType::getOwnProperty): (KJS::DOMNamedNodeMap::getOwnProperty): (KJS::DOMProcessingInstruction::getOwnProperty): (KJS::DOMNotation::getOwnProperty): (KJS::DOMEntity::getOwnProperty): (KJS::NodeConstructor::getOwnProperty): (KJS::DOMExceptionConstructor::getOwnProperty): (KJS::DOMNamedNodesCollection::getOwnProperty): (KJS::DOMCharacterData::getOwnProperty):
  • khtml/ecma/kjs_dom.h:
  • khtml/ecma/kjs_events.cpp: (KJS::EventConstructor::getOwnProperty): (KJS::DOMEvent::getOwnProperty): (KJS::EventExceptionConstructor::getOwnProperty): (KJS::DOMUIEvent::getOwnProperty): (KJS::DOMMouseEvent::getOwnProperty): (KJS::DOMKeyboardEvent::getOwnProperty): (KJS::MutationEventConstructor::getOwnProperty): (KJS::DOMMutationEvent::getOwnProperty): (KJS::DOMWheelEvent::getOwnProperty): (KJS::Clipboard::getOwnProperty):
  • khtml/ecma/kjs_events.h:
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::getOwnProperty): (KJS::KJS::HTMLElement::getOwnProperty): (KJS::KJS::HTMLCollection::getOwnProperty): (KJS::KJS::HTMLSelectCollection::getOwnProperty): (KJS::Image::getOwnProperty): (KJS::Context2D::getOwnProperty): (KJS::Gradient::getOwnProperty): (KJS::ImagePattern::getOwnProperty):
  • khtml/ecma/kjs_html.h:
  • khtml/ecma/kjs_navigator.cpp: (KJS::Plugin::Plugin): (KJS::Navigator::getOwnProperty): (KJS::Plugins::getOwnProperty): (KJS::MimeTypes::getOwnProperty): (KJS::Plugin::getOwnProperty): (KJS::MimeType::getOwnProperty):
  • khtml/ecma/kjs_navigator.h:
  • khtml/ecma/kjs_range.cpp: (KJS::DOMRange::getOwnProperty): (KJS::RangeConstructor::getOwnProperty):
  • khtml/ecma/kjs_range.h:
  • khtml/ecma/kjs_traversal.cpp: (KJS::DOMNodeIterator::getOwnProperty): (KJS::NodeFilterConstructor::getOwnProperty): (KJS::DOMTreeWalker::getOwnProperty):
  • khtml/ecma/kjs_traversal.h:
  • khtml/ecma/kjs_views.cpp: (KJS::DOMAbstractView::getOwnProperty):
  • khtml/ecma/kjs_views.h:
  • khtml/ecma/kjs_window.cpp: (KJS::Screen::getOwnProperty): (KJS::Window::~Window): (KJS::Window::getOwnProperty): (KJS::Window::put): (KJS::FrameArray::getOwnProperty): (KJS::Location::Location): (KJS::Location::getOwnProperty): (KJS::Location::put): (KJS::Selection::Selection): (KJS::Selection::getOwnProperty): (KJS::BarInfo::getOwnProperty): (KJS::History::getOwnProperty):
  • khtml/ecma/kjs_window.h:
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getOwnProperty):
  • khtml/ecma/xmlhttprequest.h:
File:
1 edited

Legend:

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

    r9582 r9889  
    3232const ClassInfo RuntimeArrayImp::info = {"RuntimeArray", &ArrayInstanceImp::info, 0, 0};
    3333
    34 RuntimeArrayImp::RuntimeArrayImp(ExecState *exec, Bindings::Array *a) : ArrayInstanceImp (exec->lexicalInterpreter()->builtinArrayPrototype().imp(), a->getLength())
     34RuntimeArrayImp::RuntimeArrayImp(ExecState *exec, Bindings::Array *a)
     35    : ArrayInstanceImp (exec->lexicalInterpreter()->builtinArrayPrototype().imp(), a->getLength())
    3536{
    3637    // Always takes ownership of concrete array.
     
    4344}
    4445
    45 
    46 Value RuntimeArrayImp::get(ExecState *exec, const Identifier &propertyName) const
     46bool RuntimeArrayImp::getOwnProperty(ExecState *exec, const Identifier &propertyName, Value& result) const
    4747{
    48     if (propertyName == lengthPropertyName)
    49         return Number(getLength());
     48    if (propertyName == lengthPropertyName) {
     49        result = Number(getLength());
     50        return true;
     51    }
    5052   
    5153    bool ok;
     
    5355    if (ok) {
    5456        if (index >= getLength())
    55             return Undefined();
    56         return getConcreteArray()->valueAt(exec, index);
     57            result =  Undefined();
     58        else
     59            result = getConcreteArray()->valueAt(exec, index);
     60        return true;
    5761    }
    5862   
    59     return ObjectImp::get(exec, propertyName);
     63    return ArrayInstanceImp::getOwnProperty(exec, propertyName, result);
    6064}
    6165
    62 Value RuntimeArrayImp::get(ExecState *exec, unsigned index) const
     66bool RuntimeArrayImp::getOwnProperty(ExecState *exec, unsigned index, Value& result) const
    6367{
    6468    if (index >= getLength())
    65         return Undefined();
    66     return getConcreteArray()->valueAt(exec, index);
     69        result = Undefined();
     70    else
     71        result = getConcreteArray()->valueAt(exec, index);
     72   
     73    return true;
    6774}
    6875
Note: See TracChangeset for help on using the changeset viewer.