Commit 941d5f96 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[turbofan] Remove optimization for Cons strings

We used to have an optimized version for nodes that are concatenating
two strings which was allocating an object on the heap, therefore
preventing this code from being executed on the compiler thread.
Octane benchmark results show insignificant increase in performance
(< 0.5%) without this optimization - see
https://docs.google.com/spreadsheets/d/1MC5NrMoMSsqxZqw0ojoZvomBb7q2EOt1S0sFoJ8ld2c/edit?usp=sharing
which leads to the conclusion we can safely remove the optimization for now.

Bug: v8:7790
Change-Id: I6492c6a76118cac568d28805995d55c5360bb123
Reviewed-on: https://chromium-review.googlesource.com/1138246Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54467}
parent 58578584
......@@ -528,32 +528,6 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
NodeProperties::ReplaceValueInput(node, reduction.replacement(), 0);
}
}
// We might be able to constant-fold the String concatenation now.
if (r.BothInputsAre(Type::String())) {
HeapObjectBinopMatcher m(node);
if (m.IsFoldable()) {
StringRef left(m.left().Value());
StringRef right(m.right().Value());
if (left.length() + right.length() > String::kMaxLength) {
// No point in trying to optimize this, as it will just throw.
return NoChange();
}
// TODO(mslekova): get rid of these allows by doing either one of:
// 1. remove the optimization and check if it ruins the performance
// 2. leave a placeholder and do the actual allocations once back on the
// MT
AllowHandleDereference allow_handle_dereference;
AllowHandleAllocation allow_handle_allocation;
AllowHeapAllocation allow_heap_allocation;
ObjectRef cons(
factory()
->NewConsString(left.object<String>(), right.object<String>())
.ToHandleChecked());
Node* value = jsgraph()->Constant(js_heap_broker(), cons);
ReplaceWithValue(node, value);
return Replace(value);
}
}
// We might know for sure that we're creating a ConsString here.
if (r.ShouldCreateConsString()) {
return ReduceCreateConsString(node);
......
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