| Index: src/compiler/js-typed-lowering.cc
|
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
|
| index 5dfc97285c7195d9c523a18185230624c98ff355..7abbbd5190a9c8f28bef38dd6caa38fc0db7af61 100644
|
| --- a/src/compiler/js-typed-lowering.cc
|
| +++ b/src/compiler/js-typed-lowering.cc
|
| @@ -83,14 +83,21 @@ class JSBinopReduction final {
|
| ((lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) &&
|
| BinaryOperationHintOf(node_->op()) == BinaryOperationHint::kString)) {
|
| HeapObjectBinopMatcher m(node_);
|
| - if (m.left().HasValue() && m.left().Value()->IsString()) {
|
| - Handle<String> left_string = Handle<String>::cast(m.left().Value());
|
| - if (left_string->length() >= ConsString::kMinLength) return true;
|
| - }
|
| if (m.right().HasValue() && m.right().Value()->IsString()) {
|
| Handle<String> right_string = Handle<String>::cast(m.right().Value());
|
| if (right_string->length() >= ConsString::kMinLength) return true;
|
| }
|
| + if (m.left().HasValue() && m.left().Value()->IsString()) {
|
| + Handle<String> left_string = Handle<String>::cast(m.left().Value());
|
| + if (left_string->length() >= ConsString::kMinLength) {
|
| + // The invariant for ConsString requires the left hand side to be
|
| + // a sequential or external string if the right hand side is the
|
| + // empty string. Since we don't know anything about the right hand
|
| + // side here, we must ensure that the left hand side satisfy the
|
| + // constraints independent of the right hand side.
|
| + return left_string->IsSeqString() || left_string->IsExternalString();
|
| + }
|
| + }
|
| }
|
| return false;
|
| }
|
|
|