Ignore:
Timestamp:
Aug 6, 2005, 11:17:49 PM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.

Change over to the new PropertySlot mechanism for property
lookup. This allows the elimination of hasOwnProperty
methods. Also did some of the performance tuning enabled by this
(but not yet all the possible improvements for function calls,
assignment, ++, and so forth). And also much code cleanup.

Net result is about a 2% speedup on the JS iBench.

Also redid Geoff's fix for the chrashing applet by avoiding a NULL
prototype in the bindings code and using the default of Null()
instead.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bindings/objc/objc_runtime.h:
  • bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::ObjcFallbackObjectImp): (ObjcFallbackObjectImp::getOwnPropertySlot):
  • bindings/runtime_array.cpp: (RuntimeArrayImp::lengthGetter): (RuntimeArrayImp::indexGetter): (RuntimeArrayImp::getOwnPropertySlot):
  • bindings/runtime_array.h:
  • bindings/runtime_method.cpp: (RuntimeMethodImp::lengthGetter): (RuntimeMethodImp::getOwnPropertySlot):
  • bindings/runtime_method.h:
  • bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::fallbackObjectGetter): (RuntimeObjectImp::fieldGetter): (RuntimeObjectImp::methodGetter): (RuntimeObjectImp::getOwnPropertySlot):
  • bindings/runtime_object.h:
  • bindings/runtime_root.h:
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstanceImp::lengthGetter): (ArrayInstanceImp::getOwnPropertySlot): (ArrayPrototypeImp::getOwnPropertySlot):
  • kjs/array_object.h:
  • kjs/date_object.cpp: (DatePrototypeImp::getOwnPropertySlot):
  • kjs/date_object.h:
  • kjs/function.cpp: (KJS::FunctionImp::argumentsGetter): (KJS::FunctionImp::lengthGetter): (KJS::FunctionImp::getOwnPropertySlot): (KJS::FunctionImp::put): (KJS::FunctionImp::deleteProperty): (KJS::ArgumentsImp::mappedIndexGetter): (KJS::ArgumentsImp::getOwnPropertySlot): (KJS::ActivationImp::argumentsGetter): (KJS::ActivationImp::getArgumentsGetter): (KJS::ActivationImp::getOwnPropertySlot): (KJS::ActivationImp::deleteProperty):
  • kjs/function.h:
  • kjs/internal.cpp: (InterpreterImp::InterpreterImp): (InterpreterImp::initGlobalObject): (InterpreterImp::~InterpreterImp): (InterpreterImp::evaluate):
  • kjs/internal.h: (KJS::InterpreterImp::globalExec):
  • kjs/interpreter.cpp: (Interpreter::Interpreter): (Interpreter::createLanguageInstanceForValue):
  • kjs/interpreter.h: (KJS::Interpreter::argumentsIdentifier): (KJS::Interpreter::specialPrototypeIdentifier):
  • kjs/lookup.h: (KJS::staticFunctionGetter): (KJS::staticValueGetter): (KJS::getStaticPropertySlot): (KJS::getStaticFunctionSlot): (KJS::getStaticValueSlot):
  • kjs/math_object.cpp: (MathObjectImp::getOwnPropertySlot):
  • kjs/math_object.h:
  • kjs/nodes.cpp: (ResolveNode::evaluate): (ResolveNode::evaluateReference): (AccessorNode1::evaluate): (AccessorNode2::evaluate):
  • kjs/number_object.cpp: (NumberObjectImp::getOwnPropertySlot):
  • kjs/number_object.h:
  • kjs/object.cpp: (KJS::ObjectImp::get): (KJS::ObjectImp::getProperty): (KJS::ObjectImp::getPropertySlot): (KJS::ObjectImp::getOwnPropertySlot): (KJS::ObjectImp::put): (KJS::ObjectImp::hasProperty): (KJS::ObjectImp::hasOwnProperty):
  • kjs/object.h: (KJS::ObjectImp::getDirectLocation): (KJS::ObjectImp::getPropertySlot): (KJS::ObjectImp::getOwnPropertySlot):
  • kjs/object_wrapper.h: Added. (KJS::): (KJS::Object::Object): (KJS::Object::operator ObjectImp *):
  • kjs/property_map.cpp: (KJS::PropertyMap::getLocation):
  • kjs/property_map.h:
  • kjs/property_slot.cpp: Added. (KJS::PropertySlot::undefinedGetter):
  • kjs/property_slot.h: Added. (KJS::PropertySlot::isSet): (KJS::PropertySlot::getValue): (KJS::PropertySlot::setValueSlot): (KJS::PropertySlot::setStaticEntry): (KJS::PropertySlot::setCustom): (KJS::PropertySlot::setCustomIndex): (KJS::PropertySlot::setUndefined): (KJS::PropertySlot::slotBase): (KJS::PropertySlot::staticEntry): (KJS::PropertySlot::index): (KJS::PropertySlot::):
  • kjs/protect.h:
  • kjs/protected_object.h: Added. (KJS::ProtectedObject::ProtectedObject): (KJS::ProtectedObject::~ProtectedObject): (KJS::ProtectedObject::operator=): (KJS::ProtectedReference::ProtectedReference): (KJS::ProtectedReference::~ProtectedReference): (KJS::ProtectedReference::operator=):
  • kjs/reference.h:
  • kjs/reference_list.cpp:
  • kjs/regexp_object.cpp: (RegExpObjectImp::backrefGetter): (RegExpObjectImp::getOwnPropertySlot):
  • kjs/regexp_object.h:
  • kjs/string_object.cpp: (StringInstanceImp::lengthGetter): (StringInstanceImp::indexGetter): (StringInstanceImp::getOwnPropertySlot): (StringPrototypeImp::getOwnPropertySlot):
  • kjs/string_object.h:

WebCore:

Reviewed by Darin.

Change over to the new PropertySlot mechanism for property
lookup. This allows the elimination of hasOwnProperty methods. I
also did a bunch of code cleanup and regularization of the various
property lookup methods.

Test cases added: Added a test case for a bug I found along the way.

  • layout-tests/fast/js/string-index-overflow.html:
  • layout-tests/fast/js/string-index-overflow-expected.txt:
  • khtml/ecma/kjs_binding.cpp: (KJS::ScriptInterpreter::createLanguageInstanceForValue):
  • khtml/ecma/kjs_binding.h:
  • khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::indexGetter): (KJS::DOMCSSStyleDeclaration::cssPropertyGetter): (KJS::DOMCSSStyleDeclaration::getOwnPropertySlot): (KJS::DOMCSSStyleDeclaration::getValueProperty): (KJS::DOMStyleSheet::getOwnPropertySlot): (KJS::DOMStyleSheetList::getValueProperty): (KJS::DOMStyleSheetList::indexGetter): (KJS::DOMStyleSheetList::nameGetter): (KJS::DOMStyleSheetList::getOwnPropertySlot): (KJS::DOMMediaList::getValueProperty): (KJS::DOMMediaList::indexGetter): (KJS::DOMMediaList::getOwnPropertySlot): (KJS::DOMCSSStyleSheet::getValueProperty): (KJS::DOMCSSStyleSheet::getOwnPropertySlot): (KJS::DOMCSSRuleList::getValueProperty): (KJS::DOMCSSRuleList::indexGetter): (KJS::DOMCSSRuleList::getOwnPropertySlot): (KJS::DOMCSSRule::getOwnPropertySlot): (KJS::CSSRuleConstructor::getOwnPropertySlot): (KJS::DOMCSSValue::getValueProperty): (KJS::DOMCSSValue::getOwnPropertySlot): (KJS::CSSValueConstructor::getOwnPropertySlot): (KJS::DOMCSSPrimitiveValue::getValueProperty): (KJS::DOMCSSPrimitiveValue::getOwnPropertySlot): (KJS::CSSPrimitiveValueConstructor::getOwnPropertySlot): (KJS::DOMCSSValueList::getValueProperty): (KJS::DOMCSSValueList::indexGetter): (KJS::DOMCSSValueList::getOwnPropertySlot): (KJS::DOMRGBColor::getOwnPropertySlot): (KJS::DOMRect::getOwnPropertySlot): (KJS::DOMCounter::getOwnPropertySlot):
  • khtml/ecma/kjs_css.h: (KJS::DOMCSSStyleDeclaration::): (KJS::DOMCSSStyleSheet::): (KJS::DOMCSSRule::): (KJS::DOMCSSValueList::):
  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getOwnPropertySlot): (KJS::): (KJS::DOMNodeList::getValueProperty): (KJS::DOMNodeList::indexGetter): (KJS::DOMNodeList::nameGetter): (KJS::DOMNodeList::getOwnPropertySlot): (KJS::DOMNodeList::call): (KJS::DOMAttr::getOwnPropertySlot): (KJS::DOMDocument::getOwnPropertySlot): (KJS::DOMElement::getValueProperty): (KJS::DOMElement::attributeGetter): (KJS::DOMElement::getOwnPropertySlot): (KJS::DOMDocumentType::getOwnPropertySlot): (KJS::DOMNamedNodeMap::lengthGetter): (KJS::DOMNamedNodeMap::indexGetter): (KJS::DOMNamedNodeMap::getOwnPropertySlot): (KJS::DOMProcessingInstruction::getOwnPropertySlot): (KJS::DOMNotation::getOwnPropertySlot): (KJS::DOMEntity::getOwnPropertySlot): (KJS::NodeConstructor::getOwnPropertySlot): (KJS::DOMExceptionConstructor::getOwnPropertySlot): (KJS::DOMNamedNodesCollection::lengthGetter): (KJS::DOMNamedNodesCollection::indexGetter): (KJS::DOMNamedNodesCollection::getOwnPropertySlot): (KJS::DOMCharacterData::getOwnPropertySlot):
  • khtml/ecma/kjs_dom.h:
  • khtml/ecma/kjs_events.cpp: (KJS::EventConstructor::getOwnPropertySlot): (KJS::DOMEvent::getOwnPropertySlot): (KJS::EventExceptionConstructor::getOwnPropertySlot): (KJS::DOMUIEvent::getOwnPropertySlot): (KJS::DOMMouseEvent::getOwnPropertySlot): (KJS::DOMKeyboardEvent::getOwnPropertySlot): (KJS::MutationEventConstructor::getOwnPropertySlot): (KJS::DOMMutationEvent::getOwnPropertySlot): (KJS::DOMWheelEvent::getOwnPropertySlot): (KJS::Clipboard::getOwnPropertySlot):
  • khtml/ecma/kjs_events.h:
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::namedItemGetter): (KJS::HTMLDocument::getValueProperty): (KJS::HTMLDocument::getOwnPropertySlot): (KJS::HTMLElement::formIndexGetter): (KJS::HTMLElement::formNameGetter): (KJS::HTMLElement::selectIndexGetter): (KJS::HTMLElement::framesetNameGetter): (KJS::HTMLElement::frameWindowPropertyGetter): (KJS::HTMLElement::runtimeObjectGetter): (KJS::HTMLElement::runtimeObjectPropertyGetter): (KJS::HTMLElement::getOwnPropertySlot): (KJS::HTMLCollection::lengthGetter): (KJS::HTMLCollection::indexGetter): (KJS::HTMLCollection::nameGetter): (KJS::HTMLCollection::getOwnPropertySlot): (KJS::HTMLSelectCollection::selectedIndexGetter): (KJS::HTMLSelectCollection::getOwnPropertySlot): (KJS::Image::getOwnPropertySlot): (KJS::Context2D::getOwnPropertySlot): (KJS::Gradient::getOwnPropertySlot): (KJS::ImagePattern::getOwnPropertySlot):
  • khtml/ecma/kjs_html.h: (KJS::HTMLCollection::toBoolean):
  • khtml/ecma/kjs_navigator.cpp: (KJS::Plugins::): (KJS::MimeTypes::): (KJS::Plugin::): (KJS::MimeType::): (KJS::): (KJS::Navigator::getOwnPropertySlot): (KJS::Plugins::getValueProperty): (KJS::Plugins::indexGetter): (KJS::Plugins::nameGetter): (KJS::Plugins::getOwnPropertySlot): (KJS::MimeTypes::getValueProperty): (KJS::MimeTypes::indexGetter): (KJS::MimeTypes::nameGetter): (KJS::MimeTypes::getOwnPropertySlot): (KJS::Plugin::getValueProperty): (KJS::Plugin::indexGetter): (KJS::Plugin::nameGetter): (KJS::Plugin::getOwnPropertySlot): (KJS::MimeType::getValueProperty): (KJS::MimeType::getOwnPropertySlot):
  • khtml/ecma/kjs_navigator.h:
  • khtml/ecma/kjs_range.cpp: (KJS::DOMRange::getOwnPropertySlot): (KJS::RangeConstructor::getOwnPropertySlot):
  • khtml/ecma/kjs_range.h:
  • khtml/ecma/kjs_traversal.cpp: (KJS::DOMNodeIterator::getOwnPropertySlot): (KJS::NodeFilterConstructor::getOwnPropertySlot): (KJS::DOMTreeWalker::getOwnPropertySlot):
  • khtml/ecma/kjs_traversal.h:
  • khtml/ecma/kjs_views.cpp: (KJS::DOMAbstractView::~DOMAbstractView): (KJS::DOMAbstractView::getValueProperty): (KJS::DOMAbstractView::getOwnPropertySlot):
  • khtml/ecma/kjs_views.h:
  • khtml/ecma/kjs_window.cpp: (KJS::FrameArray::): (KJS::FrameArray::classInfo): (KJS::Screen::getOwnPropertySlot): (KJS::Window::getValueProperty): (KJS::Window::childFrameGetter): (KJS::Window::namedFrameGetter): (KJS::Window::indexGetter): (KJS::Window::namedItemGetter): (KJS::Window::getOwnPropertySlot): (KJS::): (KJS::FrameArray::getValueProperty): (KJS::FrameArray::indexGetter): (KJS::FrameArray::nameGetter): (KJS::FrameArray::getOwnPropertySlot): (KJS::Location::getValueProperty): (KJS::Location::getOwnPropertySlot): (KJS::Selection::getValueProperty): (KJS::Selection::getOwnPropertySlot): (KJS::BarInfo::getValueProperty): (KJS::BarInfo::getOwnPropertySlot): (KJS::History::getOwnPropertySlot):
  • khtml/ecma/kjs_window.h:
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getOwnPropertySlot):
  • khtml/ecma/xmlhttprequest.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/interpreter.h

    r9929 r10076  
    2626#define _KJS_INTERPRETER_H_
    2727
     28#include "object_wrapper.h"
    2829#include "value.h"
    29 #include "object.h"
    3030#include "types.h"
    31 #include "protect.h"
    32 
    33 #if APPLE_CHANGES
    34 
    35 #include "runtime.h"
    36 
    37 #endif
    3831
    3932namespace KJS {
     
    4134  class ContextImp;
    4235  class InterpreterImp;
     36  class RuntimeMethodImp;
     37
     38  namespace Bindings {
     39    class RootObject;
     40  }
    4341
    4442  /**
     
    402400    virtual bool isSafeScript (const Interpreter *target) { return true; }
    403401   
    404     virtual void *createLanguageInstanceForValue (ExecState *exec, Bindings::Instance::BindingLanguage language, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
     402    virtual void *createLanguageInstanceForValue (ExecState *exec, int language, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
    405403#endif
     404
     405    // This is a workaround to avoid accessing the global variables for these identifiers in
     406    // important property lookup functions, to avoid taking PIC branches in Mach-O binaries
     407    const Identifier& argumentsIdentifier() { return *m_argumentsPropertyName; }
     408    const Identifier& specialPrototypeIdentifier() { return *m_specialPrototypePropertyName; }
    406409   
    407410  private:
    408411    InterpreterImp *rep;
    409412
     413    const Identifier *m_argumentsPropertyName;
     414    const Identifier *m_specialPrototypePropertyName;
     415
    410416    /**
    411417     * This constructor is not implemented, in order to prevent
     
    421427     */
    422428    Interpreter operator=(const Interpreter&);
     429
    423430  protected:
    424431    virtual void virtual_hook( int id, void* data );
     
    474481    Interpreter *_interpreter;
    475482    ContextImp *_context;
    476     ProtectedValue _exception;
     483    Value _exception;
    477484  };
    478485
Note: See TracChangeset for help on using the changeset viewer.