Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 2410893003: [turbofan] Respect ConsString invariant. (Closed)
Patch Set: Typo Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-654723.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-654723.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698