Reviewed by Geoff.
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jan 2008 19:35:37 +0000 (19:35 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jan 2008 19:35:37 +0000 (19:35 +0000)
commitcb7048ca0152ac7c104faa46c9f5dfe99c54f7e1
tree65dec701d64495a9b3bdc8da8ad9ea76daa0d72e
parenta1a55b9e4b83540c6f12a889f3fb53eb28256405
    Reviewed by Geoff.

        - http://bugs.webkit.org/show_bug.cgi?id=16685
          eliminate List::empty() to cut down on PIC branches

        Also included one other speed-up -- remove the call to reserveCapacity from
        FunctionBodyNode::processDeclarations in all but the most unusual cases.

        Together these make SunSpider 1.016x as fast.

        * JavaScriptCore.exp: Updated.
        * kjs/ExecState.cpp:
        (KJS::globalEmptyList): Added. Called only when creating global ExecState
        instances.
        (KJS::ExecState::ExecState): Broke constructor up into three separate functions,
        for the three separate node types. Also went through each of the three and
        streamlined as much as possible, removing dead code. This prevents us from having
        to access the global in the function body version of the constructor.

        * kjs/ExecState.h: Added emptyList(). Replaced the constructor with a set of
        three that are specific to the different node types that can create new execution
        state objects.

        * kjs/array_object.cpp:
        (KJS::ArrayProtoFuncToLocaleString::callAsFunction): Use exec->emptyList() instead
        of List::empty().
        (KJS::ArrayProtoFuncConcat::callAsFunction): Ditto.
        (KJS::ArrayProtoFuncSlice::callAsFunction): Ditto.
        (KJS::ArrayProtoFuncSplice::callAsFunction): Ditto.
        (KJS::ArrayProtoFuncFilter::callAsFunction): Ditto.
        * kjs/function.cpp:
        (KJS::FunctionImp::callAsFunction): Updated to call new ExecState constructor.
        (KJS::GlobalFuncImp::callAsFunction): Ditto (for eval).
        * kjs/function_object.cpp:
        (FunctionObjectImp::construct): Use exec->emptyList() instead of List::empty().

        * kjs/list.cpp: Removed List::empty.
        * kjs/list.h: Ditto.

        * kjs/nodes.cpp:
        (KJS::ElementNode::evaluate): Use exec->emptyList() instead of List::empty().
        (KJS::ArrayNode::evaluate): Ditto.
        (KJS::ObjectLiteralNode::evaluate): Ditto.
        (KJS::PropertyListNode::evaluate): Ditto.
        (KJS::FunctionBodyNode::processDeclarations): Another speed-up. Check the capacity
        before calling reserveCapacity, because it doesn't get inlined the local storage
        vector is almost always big enough -- saving the function call overhead is a big
        deal.
        (KJS::FuncDeclNode::makeFunction): Use exec->emptyList() instead of List::empty().
        (KJS::FuncExprNode::evaluate): Ditto.
        * kjs/object.cpp:
        (KJS::tryGetAndCallProperty): Ditto.
        * kjs/property_slot.cpp:
        (KJS::PropertySlot::functionGetter): Ditto.
        * kjs/string_object.cpp:
        (KJS::StringProtoFuncSplit::callAsFunction): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/kjs/ExecState.cpp
JavaScriptCore/kjs/ExecState.h
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/function_object.cpp
JavaScriptCore/kjs/list.cpp
JavaScriptCore/kjs/list.h
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kjs/property_slot.cpp
JavaScriptCore/kjs/string_object.cpp