v8/test/unittests/compiler
Benedikt Meurer d6a60a0ee1 [turbofan] Significantly improve ConsString creation performance.
This change significantly improves the performance of string
concatenation in optimized code for the case where the resulting string
is represented as a ConsString. On the relevant test cases we go from

  serializeNaive: 10762 ms.
  serializeClever: 7813 ms.
  serializeConcat: 10271 ms.

to

  serializeNaive: 10278 ms.
  serializeClever: 5533 ms.
  serializeConcat: 10310 ms.

which represents a 30% improvement on the "clever" benchmark, which
tests specifically the ConsString creation performance.

This was accomplished via a couple of different steps, which are briefly
outlined here:

  1. The empty_string gets its own map, so that we can easily recognize
     and handle it appropriately in the TurboFan type system. This
     allows us to express (and assert) that the inputs to NewConsString
     are non-empty strings, making sure that TurboFan no longer creates
     "crippled ConsStrings" with empty left or right hand sides.
  2. Further split the existing String types in TurboFan to be able to
     distinguish between OneByte and TwoByte strings on the type system
     level. This allows us to avoid having to dynamically lookup the
     resulting ConsString map in case of ConsString creation (i.e. when
     we know that both input strings are OneByte strings or at least
     one of the input strings is TwoByte).
  3. We also introduced more finegrained feedback for the Add bytecode
     in the interpreter, having it collect feedback about ConsStrings,
     specifically ConsOneByteString and ConsTwoByteString. This feedback
     can be used by TurboFan to only inline the relevant code for what
     was seen so far. This allows us to remove the Octane/Splay specific
     magic in JSTypedLowering to detect ConsString creation, and instead
     purely rely on the feedback of what was seen so far (also making it
     possible to change the semantics of NewConsString to be a low-level
     operator, which is only introduced in SimplifiedLowering by looking
     at the input types of StringConcat).
  4. On top of the before mentioned type and interpreter changes we added
     new operators CheckNonEmptyString, CheckNonEmptyOneByteString, and
     CheckNonEmptyTwoByteString, which perform the appropriate (dynamic)
     checks.

There are several more improvements that are possible based on this, but
since the change was already quite big, we decided not to put everything
into the first change, but do some follow up tweaks to the type system,
and builtin optimizations later.

Tbr: mstarzinger@chromium.org
Bug: v8:8834, v8:8931, v8:8939, v8:8951
Change-Id: Ia24e17c6048bf2b04df966d3cd441f0edda05c93
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Doc: https://bit.ly/fast-string-concatenation-in-javascript
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1499497
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60318}
2019-03-19 10:43:00 +00:00
..
arm [compiler] Remove SpeculationFence 2019-03-08 11:11:21 +00:00
arm64 [compiler] Remove SpeculationFence 2019-03-08 11:11:21 +00:00
backend test: Replace _TEST_CASE_ with _TEST_SUITE_. 2019-02-18 21:36:56 +00:00
ia32 [compiler] Remove SpeculationFence 2019-03-08 11:11:21 +00:00
mips [MIPS] Set Yu Yin as owner of MIPS files. 2019-03-06 11:46:22 +00:00
mips64 [MIPS] Set Yu Yin as owner of MIPS files. 2019-03-06 11:46:22 +00:00
ppc owners file cleanup and adding myself to the list 2019-01-14 17:53:55 +00:00
regalloc test: Replace _TEST_CASE_ with _TEST_SUITE_. 2019-02-18 21:36:56 +00:00
s390 owners file cleanup and adding myself to the list 2019-01-14 17:53:55 +00:00
x64 [compiler] Remove SpeculationFence 2019-03-08 11:11:21 +00:00
branch-elimination-unittest.cc Revert "[TurboFan] Diagnostic code to track down bug in representation selection" 2017-11-14 09:26:51 +00:00
bytecode-analysis-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
checkpoint-elimination-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
code-assembler-unittest.cc [builtins] Fix Array.p.join overflow detection 2018-10-18 12:59:48 +00:00
code-assembler-unittest.h [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
common-operator-reducer-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
common-operator-unittest.cc test: Replace _TEST_CASE_ with _TEST_SUITE_. 2019-02-18 21:36:56 +00:00
compiler-test-utils.h [turbofan] Drop V8_TURBOFAN_BACKEND and V8_TURBOFAN_TARGET defines. 2015-08-10 07:17:34 +00:00
constant-folding-reducer-unittest.cc [turbofan] Canonicalize uses of DependOnProtector 2019-02-27 18:56:30 +00:00
control-equivalence-unittest.cc Reland "Introduce StdoutStream which prints to Android log or stdout" 2018-06-14 13:29:01 +00:00
control-flow-optimizer-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
dead-code-elimination-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
diamond-unittest.cc [cleanup] [compiler] Fix (D)CHECK macros 2017-09-25 10:21:34 +00:00
effect-control-linearizer-unittest.cc [TurboFan] Optimize map checks with pointer compression 2019-03-19 09:54:03 +00:00
graph-reducer-unittest.cc [cleanup] Replace 0 and NULL with nullptr for compiler files. 2018-09-14 16:20:29 +00:00
graph-reducer-unittest.h [turbofan] Add AdvancedReducer::ReplaceWithValue() method and convert JSInlining to an AdvancedReducer. 2015-05-12 12:41:36 +00:00
graph-trimmer-unittest.cc [turbofan] Proper dead code elimination as regular reducer. 2015-06-19 12:07:26 +00:00
graph-unittest.cc [cleanup] Don't use virtual inheritance in gtest fixtures 2018-10-30 06:28:42 +00:00
graph-unittest.h [cleanup] Don't use virtual inheritance in gtest fixtures 2018-10-30 06:28:42 +00:00
int64-lowering-unittest.cc [turbofan] Further optimize DataView accesses. 2018-08-14 09:20:47 +00:00
js-call-reducer-unittest.cc [lite] Allocate FeedbackCell arrays for create closures in lite mode 2019-03-12 14:28:29 +00:00
js-create-lowering-unittest.cc [turbofan] Unify code that determines a JSCreate's map 2019-03-18 15:26:26 +00:00
js-intrinsic-lowering-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
js-native-context-specialization-unittest.cc [turbofan] Rename "js_heap_broker" to "broker". 2018-10-15 08:17:17 +00:00
js-operator-unittest.cc test: Replace _TEST_CASE_ with _TEST_SUITE_. 2019-02-18 21:36:56 +00:00
js-typed-lowering-unittest.cc [iwyu] Remove include factory.h -> js-array-buffer.h 2018-12-17 15:34:54 +00:00
linkage-tail-call-unittest.cc Reland "[arm64] Preparation for padding of arguments" 2017-12-20 13:50:36 +00:00
load-elimination-unittest.cc Retire PretenureFlag and use AllocationType everywhere. 2019-03-12 08:10:44 +00:00
loop-peeling-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
machine-operator-reducer-unittest.cc Remove obsolete MSVC 10.0 workaround for std::floor 2019-02-26 08:28:13 +00:00
machine-operator-unittest.cc test: Replace _TEST_CASE_ with _TEST_SUITE_. 2019-02-18 21:36:56 +00:00
node-cache-unittest.cc [cleanup] Replace 0 and NULL with nullptr for compiler files. 2018-09-14 16:20:29 +00:00
node-matchers-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
node-properties-unittest.cc [jumbo] add unittests jumbo support 2017-09-28 22:19:40 +00:00
node-test-utils.cc v8: Fix -Wextra-semi warnings, enable warning. 2019-02-13 14:11:28 +00:00
node-test-utils.h [cleanup] Fix kPointerSize in tests 2019-02-14 15:29:52 +00:00
node-unittest.cc [jumbo] fix another set of unittest compilation errors 2017-10-19 09:15:44 +00:00
opcodes-unittest.cc [ubsan][compiler] Avoid out-of-range casts to IrOpcode::Value 2019-01-25 20:55:25 +00:00
persistent-unittest.cc [ubsan] Fix numerical overflows in the compiler 2019-01-10 11:17:37 +00:00
redundancy-elimination-unittest.cc [turbofan] Significantly improve ConsString creation performance. 2019-03-19 10:43:00 +00:00
schedule-unittest.cc [jumbo] fix android/windows kDummyOperator collision 2017-10-20 12:43:57 +00:00
scheduler-rpo-unittest.cc [cleanup] Refactor compiler to use default members. 2018-09-17 12:12:21 +00:00
scheduler-unittest.cc Reland "Introduce StdoutStream which prints to Android log or stdout" 2018-06-14 13:29:01 +00:00
simplified-lowering-unittest.cc [turbofan] Rename "js_heap_broker" to "broker". 2018-10-15 08:17:17 +00:00
simplified-operator-reducer-unittest.cc [turbofan] Rename "js_heap_broker" to "broker". 2018-10-15 08:17:17 +00:00
simplified-operator-unittest.cc test: Replace _TEST_CASE_ with _TEST_SUITE_. 2019-02-18 21:36:56 +00:00
state-values-utils-unittest.cc Enable clang's -Wunreachable-code warning. 2017-12-04 13:09:25 +00:00
typed-optimization-unittest.cc [turbofan] Canonicalize uses of DependOnProtector 2019-02-27 18:56:30 +00:00
typer-unittest.cc v8: Fix -Wextra-semi warnings, enable warning. 2019-02-13 14:11:28 +00:00
value-numbering-reducer-unittest.cc [jumbo] fix another set of unittest compilation errors 2017-10-19 09:15:44 +00:00
zone-stats-unittest.cc [cleanup] Don't use virtual inheritance in gtest fixtures 2018-10-30 06:28:42 +00:00