[turbofan] Mark fast StringAdd as not causing side effects.
When StringAdd builtin is used to concatenate two primitive values, we know that the operation might throw, but cannot trigger any other observable side effect, so it shouldn't flush the LoadElimination state. R=jarin@chromium.org BUG=v8:5267 Review-Url: https://codereview.chromium.org/2645523002 Cr-Commit-Position: refs/heads/master@{#42489}
This commit is contained in:
parent
140d4df795
commit
975430161e
@ -572,13 +572,20 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
|
||||
} else if (!r.RightInputIs(Type::String())) {
|
||||
flags = STRING_ADD_CONVERT_RIGHT;
|
||||
}
|
||||
Operator::Properties properties = node->op()->properties();
|
||||
if (r.NeitherInputCanBe(Type::Receiver())) {
|
||||
// Both sides are already strings, so we know that the
|
||||
// string addition will not cause any observable side
|
||||
// effects; it can still throw obviously.
|
||||
properties = Operator::kNoWrite | Operator::kNoDeopt;
|
||||
}
|
||||
// JSAdd(x:string, y) => CallStub[StringAdd](x, y)
|
||||
// JSAdd(x, y:string) => CallStub[StringAdd](x, y)
|
||||
Callable const callable =
|
||||
CodeFactory::StringAdd(isolate(), flags, NOT_TENURED);
|
||||
CallDescriptor const* const desc = Linkage::GetStubCallDescriptor(
|
||||
isolate(), graph()->zone(), callable.descriptor(), 0,
|
||||
CallDescriptor::kNeedsFrameState, node->op()->properties());
|
||||
CallDescriptor::kNeedsFrameState, properties);
|
||||
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
|
||||
node->InsertInput(graph()->zone(), 0,
|
||||
jsgraph()->HeapConstant(callable.code()));
|
||||
|
Loading…
Reference in New Issue
Block a user