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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2415343002: Merged: [turbofan] Respect ConsString invariant. (Closed)
Patch Set: 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
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 if (left_type()->IsConstant() &&
86 left_type()->AsConstant()->Value()->IsString()) {
87 Handle<String> left_string =
88 Handle<String>::cast(left_type()->AsConstant()->Value());
89 if (left_string->length() >= ConsString::kMinLength) return true;
90 }
91 if (right_type()->IsConstant() && 85 if (right_type()->IsConstant() &&
92 right_type()->AsConstant()->Value()->IsString()) { 86 right_type()->AsConstant()->Value()->IsString()) {
93 Handle<String> right_string = 87 Handle<String> right_string =
94 Handle<String>::cast(right_type()->AsConstant()->Value()); 88 Handle<String>::cast(right_type()->AsConstant()->Value());
95 if (right_string->length() >= ConsString::kMinLength) return true; 89 if (right_string->length() >= ConsString::kMinLength) return true;
96 } 90 }
91 if (left_type()->IsConstant() &&
92 left_type()->AsConstant()->Value()->IsString()) {
93 Handle<String> left_string =
94 Handle<String>::cast(left_type()->AsConstant()->Value());
95 if (left_string->length() >= ConsString::kMinLength) {
96 // The invariant for ConsString requires the left hand side to be
97 // a sequential or external string if the right hand side is the
98 // empty string. Since we don't know anything about the right hand
99 // side here, we must ensure that the left hand side satisfy the
100 // constraints independent of the right hand side.
101 return left_string->IsSeqString() || left_string->IsExternalString();
102 }
103 }
97 } 104 }
98 return false; 105 return false;
99 } 106 }
100 107
101 void ConvertInputsToNumber() { 108 void ConvertInputsToNumber() {
102 // To convert the inputs to numbers, we have to provide frame states 109 // To convert the inputs to numbers, we have to provide frame states
103 // for lazy bailouts in the ToNumber conversions. 110 // for lazy bailouts in the ToNumber conversions.
104 // We use a little hack here: we take the frame state before the binary 111 // We use a little hack here: we take the frame state before the binary
105 // operation and use it to construct the frame states for the conversion 112 // operation and use it to construct the frame states for the conversion
106 // so that after the deoptimization, the binary operation IC gets 113 // so that after the deoptimization, the binary operation IC gets
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 } 2148 }
2142 2149
2143 2150
2144 CompilationDependencies* JSTypedLowering::dependencies() const { 2151 CompilationDependencies* JSTypedLowering::dependencies() const {
2145 return dependencies_; 2152 return dependencies_;
2146 } 2153 }
2147 2154
2148 } // namespace compiler 2155 } // namespace compiler
2149 } // namespace internal 2156 } // namespace internal
2150 } // namespace v8 2157 } // 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