2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
authorcwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Sep 2008 00:26:08 +0000 (00:26 +0000)
committercwzwarich@webkit.org <cwzwarich@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Sep 2008 00:26:08 +0000 (00:26 +0000)
commit6ba892cb82ce2a410b26b14afce7c9a1e8b0e01f
tree7e7f4a16b532b903cb4df3900f6c603377c1b1c7
parentce1c48a534a72d46e3f162d147b41d116ca615fc
2008-09-14  Cameron Zwarich  <cwzwarich@uwaterloo.ca>

        Reviewed by Maciej Stachowiak.

        Bug 20827: the 'typeof' operator is slow
        <https://bugs.webkit.org/show_bug.cgi?id=20827>

        Optimize the 'typeof' operator when its result is compared to a constant
        string.

        This is a 5.5% speedup on the V8 Earley-Boyer test.

        JavaScriptCore:

        * VM/CTI.cpp:
        (JSC::CTI::privateCompileMainPass):
        * VM/CodeBlock.cpp:
        (JSC::CodeBlock::dump):
        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::emitEqualityOp):
        * VM/CodeGenerator.h:
        * VM/Machine.cpp:
        (JSC::jsIsObjectType):
        (JSC::jsIsFunctionType):
        (JSC::Machine::privateExecute):
        (JSC::Machine::cti_op_is_undefined):
        (JSC::Machine::cti_op_is_boolean):
        (JSC::Machine::cti_op_is_number):
        (JSC::Machine::cti_op_is_string):
        (JSC::Machine::cti_op_is_object):
        (JSC::Machine::cti_op_is_function):
        * VM/Machine.h:
        * VM/Opcode.h:
        * kjs/nodes.cpp:
        (JSC::BinaryOpNode::emitCode):
        (JSC::EqualNode::emitCode):
        (JSC::StrictEqualNode::emitCode):
        * kjs/nodes.h:

        LayoutTests:

        * fast/js/resources/typeof-codegen-crash.js: Added.
        * fast/js/typeof-codegen-crash-expected.txt: Added.
        * fast/js/typeof-codegen-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@36412 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/VM/CTI.cpp
JavaScriptCore/VM/CodeBlock.cpp
JavaScriptCore/VM/CodeGenerator.cpp
JavaScriptCore/VM/CodeGenerator.h
JavaScriptCore/VM/Machine.cpp
JavaScriptCore/VM/Machine.h
JavaScriptCore/VM/Opcode.h
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/nodes.h
LayoutTests/ChangeLog
LayoutTests/fast/js/resources/typeof-codegen-crash.js [new file with mode: 0644]
LayoutTests/fast/js/typeof-codegen-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/typeof-codegen-crash.html [new file with mode: 0644]