JavaScriptCore:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 7 Aug 2005 06:17:49 +0000 (06:17 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 7 Aug 2005 06:17:49 +0000 (06:17 +0000)
commit215b5bc171f288d62eacb57c55aa7fff5fa350cb
treeca851b9708d3004394d16d6ec889a7afc1d70865
parent89cb95617d534d7688d52bf5a496934de4a2e59b
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
74 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/bindings/objc/objc_runtime.h
JavaScriptCore/bindings/objc/objc_runtime.mm
JavaScriptCore/bindings/runtime_array.cpp
JavaScriptCore/bindings/runtime_array.h
JavaScriptCore/bindings/runtime_method.cpp
JavaScriptCore/bindings/runtime_method.h
JavaScriptCore/bindings/runtime_object.cpp
JavaScriptCore/bindings/runtime_object.h
JavaScriptCore/bindings/runtime_root.h
JavaScriptCore/kjs/array_instance.h
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/array_object.h
JavaScriptCore/kjs/date_object.cpp
JavaScriptCore/kjs/date_object.h
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/function.h
JavaScriptCore/kjs/internal.cpp
JavaScriptCore/kjs/internal.h
JavaScriptCore/kjs/interpreter.cpp
JavaScriptCore/kjs/interpreter.h
JavaScriptCore/kjs/lookup.h
JavaScriptCore/kjs/math_object.cpp
JavaScriptCore/kjs/math_object.h
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/number_object.cpp
JavaScriptCore/kjs/number_object.h
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kjs/object.h
JavaScriptCore/kjs/object_wrapper.h [new file with mode: 0644]
JavaScriptCore/kjs/property_map.cpp
JavaScriptCore/kjs/property_map.h
JavaScriptCore/kjs/property_slot.cpp [new file with mode: 0644]
JavaScriptCore/kjs/property_slot.h [new file with mode: 0644]
JavaScriptCore/kjs/protect.h
JavaScriptCore/kjs/protected_object.h [new file with mode: 0644]
JavaScriptCore/kjs/reference.h
JavaScriptCore/kjs/reference_list.cpp
JavaScriptCore/kjs/regexp_object.cpp
JavaScriptCore/kjs/regexp_object.h
JavaScriptCore/kjs/string_object.cpp
JavaScriptCore/kjs/string_object.h
LayoutTests/fast/js/string-index-overflow-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/string-index-overflow.html [new file with mode: 0644]
SVGSupport/kdom/Document.h
SVGSupport/kdom/Node.h
SVGSupport/kdom/ecma/DOMLookup.h
SVGSupport/kdom/ecma/GlobalObject.cpp
SVGSupport/kdom/events/EventTarget.h
WebCore/ChangeLog-2005-08-23
WebCore/ForwardingHeaders/kjs/protected_object.h [new file with mode: 0644]
WebCore/khtml/ecma/kjs_binding.cpp
WebCore/khtml/ecma/kjs_binding.h
WebCore/khtml/ecma/kjs_css.cpp
WebCore/khtml/ecma/kjs_css.h
WebCore/khtml/ecma/kjs_dom.cpp
WebCore/khtml/ecma/kjs_dom.h
WebCore/khtml/ecma/kjs_events.cpp
WebCore/khtml/ecma/kjs_events.h
WebCore/khtml/ecma/kjs_html.cpp
WebCore/khtml/ecma/kjs_html.h
WebCore/khtml/ecma/kjs_navigator.cpp
WebCore/khtml/ecma/kjs_navigator.h
WebCore/khtml/ecma/kjs_range.cpp
WebCore/khtml/ecma/kjs_range.h
WebCore/khtml/ecma/kjs_traversal.cpp
WebCore/khtml/ecma/kjs_traversal.h
WebCore/khtml/ecma/kjs_views.cpp
WebCore/khtml/ecma/kjs_views.h
WebCore/khtml/ecma/kjs_window.cpp
WebCore/khtml/ecma/kjs_window.h
WebCore/khtml/ecma/xmlhttprequest.cpp
WebCore/khtml/ecma/xmlhttprequest.h