Commit 33825750 authored by jgruber's avatar jgruber Committed by Commit bot

[string] Optimize ToDirectStringAssembler for sequential strings

ToDirectStringAssembler is used in StringCharCodeAt and SubString
(which uses StringCharCodeAt internally). SubString is used all over the
place (e.g. RegExp result construction), and is critical for benchmark
performance.

The CL introducing ToDirectStringAssembler caused a couple of
regressions which this is intended to fix by adding a fast path for
sequential strings.

BUG=chromium:702246

Review-Url: https://codereview.chromium.org/2754933003
Cr-Commit-Position: refs/heads/master@{#43897}
parent 50e1019d
......@@ -3367,7 +3367,8 @@ Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) {
Label if_isthin(this);
Label out(this);
Goto(&dispatch);
Branch(IsSequentialStringInstanceType(var_instance_type_.value()), &out,
&dispatch);
// Dispatch based on string representation.
Bind(&dispatch);
......@@ -3444,7 +3445,7 @@ Node* ToDirectStringAssembler::TryToSequential(StringPointerKind ptr_kind,
CHECK(ptr_kind == PTR_TO_DATA || ptr_kind == PTR_TO_STRING);
Variable var_result(this, MachineType::PointerRepresentation());
Label out(this), if_issequential(this), if_isexternal(this);
Label out(this), if_issequential(this), if_isexternal(this, Label::kDeferred);
Branch(is_external(), &if_isexternal, &if_issequential);
Bind(&if_issequential);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment