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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-654723.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 6
7 #include "src/builtins/builtins-utils.h" 7 #include "src/builtins/builtins-utils.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 // Check if a string addition will definitely result in creating a ConsString, 77 // Check if a string addition will definitely result in creating a ConsString,
78 // i.e. if the combined length of the resulting string exceeds the ConsString 78 // i.e. if the combined length of the resulting string exceeds the ConsString
79 // minimum length. 79 // minimum length.
80 bool ShouldCreateConsString() { 80 bool ShouldCreateConsString() {
81 DCHECK_EQ(IrOpcode::kJSAdd, node_->opcode()); 81 DCHECK_EQ(IrOpcode::kJSAdd, node_->opcode());
82 if (BothInputsAre(Type::String()) || 82 if (BothInputsAre(Type::String()) ||
83 ((lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) && 83 ((lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) &&
84 BinaryOperationHintOf(node_->op()) == BinaryOperationHint::kString)) { 84 BinaryOperationHintOf(node_->op()) == BinaryOperationHint::kString)) {
85 HeapObjectBinopMatcher m(node_); 85 HeapObjectBinopMatcher m(node_);
86 if (m.left().HasValue() && m.left().Value()->IsString()) {
87 Handle<String> left_string = Handle<String>::cast(m.left().Value());
88 if (left_string->length() >= ConsString::kMinLength) return true;
89 }
90 if (m.right().HasValue() && m.right().Value()->IsString()) { 86 if (m.right().HasValue() && m.right().Value()->IsString()) {
91 Handle<String> right_string = Handle<String>::cast(m.right().Value()); 87 Handle<String> right_string = Handle<String>::cast(m.right().Value());
92 if (right_string->length() >= ConsString::kMinLength) return true; 88 if (right_string->length() >= ConsString::kMinLength) return true;
93 } 89 }
90 if (m.left().HasValue() && m.left().Value()->IsString()) {
91 Handle<String> left_string = Handle<String>::cast(m.left().Value());
92 if (left_string->length() >= ConsString::kMinLength) {
93 // The invariant for ConsString requires the left hand side to be
94 // a sequential or external string if the right hand side is the
95 // empty string. Since we don't know anything about the right hand
96 // side here, we must ensure that the left hand side satisfy the
97 // constraints independent of the right hand side.
98 return left_string->IsSeqString() || left_string->IsExternalString();
99 }
100 }
94 } 101 }
95 return false; 102 return false;
96 } 103 }
97 104
98 void ConvertInputsToNumber() { 105 void ConvertInputsToNumber() {
99 // To convert the inputs to numbers, we have to provide frame states 106 // To convert the inputs to numbers, we have to provide frame states
100 // for lazy bailouts in the ToNumber conversions. 107 // for lazy bailouts in the ToNumber conversions.
101 // We use a little hack here: we take the frame state before the binary 108 // We use a little hack here: we take the frame state before the binary
102 // operation and use it to construct the frame states for the conversion 109 // operation and use it to construct the frame states for the conversion
103 // so that after the deoptimization, the binary operation IC gets 110 // so that after the deoptimization, the binary operation IC gets
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 } 2179 }
2173 2180
2174 2181
2175 CompilationDependencies* JSTypedLowering::dependencies() const { 2182 CompilationDependencies* JSTypedLowering::dependencies() const {
2176 return dependencies_; 2183 return dependencies_;
2177 } 2184 }
2178 2185
2179 } // namespace compiler 2186 } // namespace compiler
2180 } // namespace internal 2187 } // namespace internal
2181 } // namespace v8 2188 } // namespace v8
OLDNEW
« 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