v8/src
Mihir Shah 9711289d06 A jump-table implementation for constant case switch statements
The change is made since for switch statements with lots of cases,
where each case is a constant integer, the emitted bytecode is still
a series of jumps, when we can instead use a jump table.

If there are 6 or more cases (similar to GCC) of Smi literals, and
if the max Smi case minus the min Smi case is not more than 3 times
the number of cases, we use a jump table up front to handle Smi's,
and then use traditional if-else logic for the rest of the cases.

We then use the jump table in interpreter/bytecode-jump-table to
do the optimization.

This tries to go off issue 9738 in v8's issue tracker. It is not
exactly the same, since that recommends doing the work at JIT-time,
but has similar ideas. It also partially goes off issue 10764.

Bug: v8:9738
Change-Id: Ic805682ee3abf9ce464bb733b427fa0c83a6e10c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2904926
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75323}
2021-06-23 09:26:23 +00:00
..
api [isolate][cleanup] Remove pointer to WasmEngine 2021-06-21 09:09:25 +00:00
asmjs [isolate][cleanup] Remove pointer to WasmEngine 2021-06-21 09:09:25 +00:00
ast [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
base Upstream Cobalt changes in cpu 2021-06-23 05:33:34 +00:00
baseline A jump-table implementation for constant case switch statements 2021-06-23 09:26:23 +00:00
bigint [bigint] Burnikel-Ziegler division 2021-06-22 17:58:21 +00:00
builtins [compiler] Fix serialization for Function#bind 2021-06-22 12:42:19 +00:00
codegen A jump-table implementation for constant case switch statements 2021-06-23 09:26:23 +00:00
common [cleanup] Remove remaining redundant NOLINTs 2021-06-22 11:34:11 +00:00
compiler [compiler] Skip MapRef descriptor array's serialize methods 2021-06-22 16:39:33 +00:00
compiler-dispatcher [build] Move RuntimeCallStatsTimerScope into its own header 2021-06-09 16:50:48 +00:00
d8 [cleanup] Remove remaining redundant NOLINTs 2021-06-22 11:34:11 +00:00
date [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
debug [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
deoptimizer [ext-code-space] Migrate CodeDataContainer::next_code_link to CodeT 2021-06-21 12:43:27 +00:00
diagnostics Fix mips build after adding base/strings.h 2021-06-23 01:38:59 +00:00
execution Fix mips build after adding base/strings.h 2021-06-23 01:38:59 +00:00
extensions [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
flags A jump-table implementation for constant case switch statements 2021-06-23 09:26:23 +00:00
handles [cleanup] Remove remaining redundant NOLINTs 2021-06-22 11:34:11 +00:00
heap [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
ic Revert "Improve error messages for property access on null/undefined" 2021-06-21 23:06:41 +00:00
init [compiler] Fix serialization for Function#bind 2021-06-22 12:42:19 +00:00
inspector Create objects in the correct context 2021-06-21 12:59:07 +00:00
interpreter A jump-table implementation for constant case switch statements 2021-06-23 09:26:23 +00:00
json [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
libplatform Replace strdup with base::Strdup 2021-06-16 08:14:06 +00:00
libsampler [cleanup] Remove remaining redundant NOLINTs 2021-06-22 11:34:11 +00:00
logging [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
numbers [utils] Move SimpleStringBuilder out of utils 2021-06-22 13:10:21 +00:00
objects Instrument JSObject::GetHeaderSize to track down Chrome crashes 2021-06-22 17:23:13 +00:00
parsing [parser] Ignore parenthesized identifiers when setting function name 2021-06-23 08:23:03 +00:00
profiler [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
protobuf
regexp [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
roots [cleanup] Remove remaining redundant NOLINTs 2021-06-22 11:34:11 +00:00
runtime Reland "[sparkplug] Trigger compilation when a FBV exists" 2021-06-23 07:42:33 +00:00
sanitizer Reland "[elements] Avoid racy data reads/writes" 2021-05-06 10:46:52 +00:00
snapshot [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
strings [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
tasks Remove ulan@ from OWNERS 2021-06-08 13:10:21 +00:00
third_party
torque [torque] Emit an error if a macro recursively calls itself 2021-06-16 14:37:07 +00:00
tracing [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
trap-handler AIX: Use __thread keyword to avoid link error during compilation 2021-05-18 15:22:27 +00:00
utils [base] Create base/strings.h 2021-06-22 16:55:32 +00:00
wasm Upstream Cobalt changes in cpu 2021-06-23 05:33:34 +00:00
web-snapshot [base] Move utils/vector.h to base/vector.h 2021-06-18 13:33:13 +00:00
zone Fix some -Wdeprecated-copy warnings. 2021-06-18 18:08:15 +00:00
DEPS [d8] Fix job execution on the predictable platform 2021-06-08 07:44:37 +00:00
DIR_METADATA
OWNERS