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

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: Rebase, pure ops 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
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/type-hint-analyzer.h » ('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 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode()); 216 DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode());
217 return OpParameter<Type*>(op); 217 return OpParameter<Type*>(op);
218 } 218 }
219 219
220 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) { 220 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) {
221 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || 221 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd ||
222 op->opcode() == IrOpcode::kSpeculativeNumberSubtract); 222 op->opcode() == IrOpcode::kSpeculativeNumberSubtract);
223 return OpParameter<BinaryOperationHints::Hint>(op); 223 return OpParameter<BinaryOperationHints::Hint>(op);
224 } 224 }
225 225
226 CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
227 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberEqual ||
228 op->opcode() == IrOpcode::kSpeculativeNumberLessThan ||
229 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual);
230 return OpParameter<CompareOperationHints::Hint>(op);
231 }
232
226 #define PURE_OP_LIST(V) \ 233 #define PURE_OP_LIST(V) \
227 V(BooleanNot, Operator::kNoProperties, 1) \ 234 V(BooleanNot, Operator::kNoProperties, 1) \
228 V(BooleanToNumber, Operator::kNoProperties, 1) \ 235 V(BooleanToNumber, Operator::kNoProperties, 1) \
229 V(NumberEqual, Operator::kCommutative, 2) \ 236 V(NumberEqual, Operator::kCommutative, 2) \
230 V(NumberLessThan, Operator::kNoProperties, 2) \ 237 V(NumberLessThan, Operator::kNoProperties, 2) \
231 V(NumberLessThanOrEqual, Operator::kNoProperties, 2) \ 238 V(NumberLessThanOrEqual, Operator::kNoProperties, 2) \
232 V(NumberAdd, Operator::kCommutative, 2) \ 239 V(NumberAdd, Operator::kCommutative, 2) \
233 V(NumberSubtract, Operator::kNoProperties, 2) \ 240 V(NumberSubtract, Operator::kNoProperties, 2) \
234 V(NumberMultiply, Operator::kCommutative, 2) \ 241 V(NumberMultiply, Operator::kCommutative, 2) \
235 V(NumberDivide, Operator::kNoProperties, 2) \ 242 V(NumberDivide, Operator::kNoProperties, 2) \
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 2, 1, 1, 1, 1, 1, hint); 497 2, 1, 1, 1, 1, 1, hint);
491 } 498 }
492 499
493 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberSubtract( 500 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberSubtract(
494 BinaryOperationHints::Hint hint) { 501 BinaryOperationHints::Hint hint) {
495 return new (zone()) Operator1<BinaryOperationHints::Hint>( 502 return new (zone()) Operator1<BinaryOperationHints::Hint>(
496 IrOpcode::kSpeculativeNumberSubtract, Operator::kPure, 503 IrOpcode::kSpeculativeNumberSubtract, Operator::kPure,
497 "SpeculativeNumberSubtract", 2, 1, 1, 1, 1, 1, hint); 504 "SpeculativeNumberSubtract", 2, 1, 1, 1, 1, 1, hint);
498 } 505 }
499 506
507 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberEqual(
508 CompareOperationHints::Hint hint) {
509 return new (zone()) Operator1<CompareOperationHints::Hint>(
510 IrOpcode::kSpeculativeNumberEqual, Operator::kPure,
511 "SpeculativeNumberEqual", 2, 1, 1, 1, 1, 1, hint);
512 }
513
514 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThan(
515 CompareOperationHints::Hint hint) {
516 return new (zone()) Operator1<CompareOperationHints::Hint>(
517 IrOpcode::kSpeculativeNumberLessThan, Operator::kPure,
518 "SpeculativeNumberLessThan", 2, 1, 1, 1, 1, 1, hint);
519 }
520
521 const Operator* SimplifiedOperatorBuilder::SpeculativeNumberLessThanOrEqual(
522 CompareOperationHints::Hint hint) {
523 return new (zone()) Operator1<CompareOperationHints::Hint>(
524 IrOpcode::kSpeculativeNumberLessThanOrEqual, Operator::kPure,
525 "SpeculativeNumberLessThanOrEqual", 2, 1, 1, 1, 1, 1, hint);
526 }
527
500 #define ACCESS_OP_LIST(V) \ 528 #define ACCESS_OP_LIST(V) \
501 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \ 529 V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \
502 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \ 530 V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \
503 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \ 531 V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \
504 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) 532 V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0)
505 533
506 534
507 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \ 535 #define ACCESS(Name, Type, properties, value_input_count, control_input_count, \
508 output_count) \ 536 output_count) \
509 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \ 537 const Operator* SimplifiedOperatorBuilder::Name(const Type& access) { \
510 return new (zone()) \ 538 return new (zone()) \
511 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ 539 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
512 #Name, value_input_count, 1, control_input_count, \ 540 #Name, value_input_count, 1, control_input_count, \
513 output_count, 1, 0, access); \ 541 output_count, 1, 0, access); \
514 } 542 }
515 ACCESS_OP_LIST(ACCESS) 543 ACCESS_OP_LIST(ACCESS)
516 #undef ACCESS 544 #undef ACCESS
517 545
518 } // namespace compiler 546 } // namespace compiler
519 } // namespace internal 547 } // namespace internal
520 } // namespace v8 548 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/type-hint-analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698