Improve switch performance.
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jul 2008 00:49:46 +0000 (00:49 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jul 2008 00:49:46 +0000 (00:49 +0000)
commit155aeb8802cd58f3e087f4d7e23ad39bb6430481
tree894f19d2d3b2e84048aab88d2b48ec0df3875751
parentfd3a04eaee33e83b63fe08d78722ab2a1b39c3cc
Improve switch performance.

Reviewed by Geoff Garen and Sam Weinig.

Improve switch performance by converting to a hashmap based jump
table to avoid the sequence of dispatches that would otherwise be
needed.  This results in a 9-19x performance win for string switches
based on ad hoc testing, and a 6x improvement for integer switch
statements.  SunSpider reports a 1.2% progression.

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