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

Side by Side Diff: src/compiler/simplified-operator.cc

Issue 2035383003: [turbofan] Type feedback for numeric comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 4 years, 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/types.h" 10 #include "src/types.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode()); 176 DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode());
177 return OpParameter<Type*>(op); 177 return OpParameter<Type*>(op);
178 } 178 }
179 179
180 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) { 180 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) {
181 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || 181 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd ||
182 op->opcode() == IrOpcode::kSpeculativeNumberSubtract); 182 op->opcode() == IrOpcode::kSpeculativeNumberSubtract);
183 return OpParameter<BinaryOperationHints::Hint>(op); 183 return OpParameter<BinaryOperationHints::Hint>(op);
184 } 184 }
185 185
186 CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
187 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberEqual ||
188 op->opcode() == IrOpcode::kSpeculativeNumberLessThan ||
189 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual);
190 return OpParameter<CompareOperationHints::Hint>(op);
191 }
192
186 #define PURE_OP_LIST(V) \ 193 #define PURE_OP_LIST(V) \
187 V(BooleanNot, Operator::kNoProperties, 1) \ 194 V(BooleanNot, Operator::kNoProperties, 1) \
188 V(BooleanToNumber, Operator::kNoProperties, 1) \ 195 V(BooleanToNumber, Operator::kNoProperties, 1) \
189 V(NumberEqual, Operator::kCommutative, 2) \ 196 V(NumberEqual, Operator::kCommutative, 2) \
190 V(NumberLessThan, Operator::kNoProperties, 2) \ 197 V(NumberLessThan, Operator::kNoProperties, 2) \
191 V(NumberLessThanOrEqual, Operator::kNoProperties, 2) \ 198 V(NumberLessThanOrEqual, Operator::kNoProperties, 2) \
192 V(NumberAdd, Operator::kCommutative, 2) \ 199 V(NumberAdd, Operator::kCommutative, 2) \
193 V(NumberSubtract, Operator::kNoProperties, 2) \ 200 V(NumberSubtract, Operator::kNoProperties, 2) \
194 V(NumberMultiply, Operator::kCommutative, 2) \ 201 V(NumberMultiply, Operator::kCommutative, 2) \
195 V(NumberDivide, Operator::kNoProperties, 2) \ 202 V(NumberDivide, Operator::kNoProperties, 2) \
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 "SpeculativeNumberAdd", 2, 1, 1, 1, 1, 1, hint); 383 "SpeculativeNumberAdd", 2, 1, 1, 1, 1, 1, hint);
377 } 384 }
378 385
379 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberSubtract( 386 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberSubtract(
380 BinaryOperationHints::Hint hint) { 387 BinaryOperationHints::Hint hint) {
381 return new (zone()) Operator1<BinaryOperationHints::Hint>( 388 return new (zone()) Operator1<BinaryOperationHints::Hint>(
382 IrOpcode::kSpeculativeNumberSubtract, Operator::kNoThrow, 389 IrOpcode::kSpeculativeNumberSubtract, Operator::kNoThrow,
383 "SpeculativeNumberSubtract", 2, 1, 1, 1, 1, 1, hint); 390 "SpeculativeNumberSubtract", 2, 1, 1, 1, 1, 1, hint);
384 } 391 }
385 392
393 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberEqual(
394 CompareOperationHints::Hint hint) {
395 return new (zone()) Operator1<CompareOperationHints::Hint>(
396 IrOpcode::kSpeculativeNumberEqual, Operator::kNoThrow,
397 "SpeculativeNumberEqual", 2, 1, 1, 1, 1, 1, hint);
398 }
399
400 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThan(
401 CompareOperationHints::Hint hint) {
402 return new (zone()) Operator1<CompareOperationHints::Hint>(
403 IrOpcode::kSpeculativeNumberLessThan, Operator::kNoThrow,
404 "SpeculativeNumberLessThan", 2, 1, 1, 1, 1, 1, hint);
405 }
406
407 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThanOrEqual(
408 CompareOperationHints::Hint hint) {
409 return new (zone()) Operator1<CompareOperationHints::Hint>(
410 IrOpcode::kSpeculativeNumberLessThanOrEqual, Operator::kNoThrow,
411 "SpeculativeNumberLessThanOrEqual", 2, 1, 1, 1, 1, 1, hint);
412 }
413
386 #define ACCESS_OP_LIST(V) \ 414 #define ACCESS_OP_LIST(V) \
387 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \ 415 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \
388 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \ 416 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \
389 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ 417 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \
390 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) 418 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0)
391 419
392 420
393 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \ 421 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \
394 output_count) \ 422 output_count) \
395 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ 423 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \
396 return new (zone()) \ 424 return new (zone()) \
397 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ 425 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
398 #Name, value_input_count, 1, control_input_count, \ 426 #Name, value_input_count, 1, control_input_count, \
399 output_count, 1, 0, access); \ 427 output_count, 1, 0, access); \
400 } 428 }
401 ACCESS_OP_LIST(ACCESS) 429 ACCESS_OP_LIST(ACCESS)
402 #undef ACCESS 430 #undef ACCESS
403 431
404 } // namespace compiler 432 } // namespace compiler
405 } // namespace internal 433 } // namespace internal
406 } // namespace v8 434 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698