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

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

Issue 2082993002: [turbofan] Address the useless overflow bit materialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/int64-lowering.cc ('k') | src/compiler/opcodes.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 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/machine-operator.h" 5 #include "src/compiler/machine-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 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 81 V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
82 V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 82 V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
83 V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 83 V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
84 V(Word64Shl, Operator::kNoProperties, 2, 0, 1) \ 84 V(Word64Shl, Operator::kNoProperties, 2, 0, 1) \
85 V(Word64Shr, Operator::kNoProperties, 2, 0, 1) \ 85 V(Word64Shr, Operator::kNoProperties, 2, 0, 1) \
86 V(Word64Sar, Operator::kNoProperties, 2, 0, 1) \ 86 V(Word64Sar, Operator::kNoProperties, 2, 0, 1) \
87 V(Word64Ror, Operator::kNoProperties, 2, 0, 1) \ 87 V(Word64Ror, Operator::kNoProperties, 2, 0, 1) \
88 V(Word64Clz, Operator::kNoProperties, 1, 0, 1) \ 88 V(Word64Clz, Operator::kNoProperties, 1, 0, 1) \
89 V(Word64Equal, Operator::kCommutative, 2, 0, 1) \ 89 V(Word64Equal, Operator::kCommutative, 2, 0, 1) \
90 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 90 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
91 V(Int32AddWithOverflow, Operator::kAssociative | Operator::kCommutative, 2, \
92 0, 2) \
93 V(Int32Sub, Operator::kNoProperties, 2, 0, 1) \ 91 V(Int32Sub, Operator::kNoProperties, 2, 0, 1) \
94 V(Int32SubWithOverflow, Operator::kNoProperties, 2, 0, 2) \
95 V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 92 V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
96 V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 93 V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
97 V(Int32Div, Operator::kNoProperties, 2, 1, 1) \ 94 V(Int32Div, Operator::kNoProperties, 2, 1, 1) \
98 V(Int32Mod, Operator::kNoProperties, 2, 1, 1) \ 95 V(Int32Mod, Operator::kNoProperties, 2, 1, 1) \
99 V(Int32LessThan, Operator::kNoProperties, 2, 0, 1) \ 96 V(Int32LessThan, Operator::kNoProperties, 2, 0, 1) \
100 V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 97 V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
101 V(Uint32Div, Operator::kNoProperties, 2, 1, 1) \ 98 V(Uint32Div, Operator::kNoProperties, 2, 1, 1) \
102 V(Uint32LessThan, Operator::kNoProperties, 2, 0, 1) \ 99 V(Uint32LessThan, Operator::kNoProperties, 2, 0, 1) \
103 V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 100 V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
104 V(Uint32Mod, Operator::kNoProperties, 2, 1, 1) \ 101 V(Uint32Mod, Operator::kNoProperties, 2, 1, 1) \
105 V(Uint32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 102 V(Uint32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
106 V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 103 V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
107 V(Int64AddWithOverflow, Operator::kAssociative | Operator::kCommutative, 2, \
108 0, 2) \
109 V(Int64Sub, Operator::kNoProperties, 2, 0, 1) \ 104 V(Int64Sub, Operator::kNoProperties, 2, 0, 1) \
110 V(Int64SubWithOverflow, Operator::kNoProperties, 2, 0, 2) \
111 V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 105 V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
112 V(Int64Div, Operator::kNoProperties, 2, 1, 1) \ 106 V(Int64Div, Operator::kNoProperties, 2, 1, 1) \
113 V(Int64Mod, Operator::kNoProperties, 2, 1, 1) \ 107 V(Int64Mod, Operator::kNoProperties, 2, 1, 1) \
114 V(Int64LessThan, Operator::kNoProperties, 2, 0, 1) \ 108 V(Int64LessThan, Operator::kNoProperties, 2, 0, 1) \
115 V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 109 V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
116 V(Uint64Div, Operator::kNoProperties, 2, 1, 1) \ 110 V(Uint64Div, Operator::kNoProperties, 2, 1, 1) \
117 V(Uint64Mod, Operator::kNoProperties, 2, 1, 1) \ 111 V(Uint64Mod, Operator::kNoProperties, 2, 1, 1) \
118 V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \ 112 V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \
119 V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \ 113 V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) \
120 V(BitcastWordToTagged, Operator::kNoProperties, 1, 0, 1) \ 114 V(BitcastWordToTagged, Operator::kNoProperties, 1, 0, 1) \
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 V(Float32RoundUp, Operator::kNoProperties, 1, 0, 1) \ 377 V(Float32RoundUp, Operator::kNoProperties, 1, 0, 1) \
384 V(Float64RoundUp, Operator::kNoProperties, 1, 0, 1) \ 378 V(Float64RoundUp, Operator::kNoProperties, 1, 0, 1) \
385 V(Float32RoundTruncate, Operator::kNoProperties, 1, 0, 1) \ 379 V(Float32RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
386 V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \ 380 V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
387 V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \ 381 V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \
388 V(Float32RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \ 382 V(Float32RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \
389 V(Float64RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \ 383 V(Float64RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \
390 V(Float32Neg, Operator::kNoProperties, 1, 0, 1) \ 384 V(Float32Neg, Operator::kNoProperties, 1, 0, 1) \
391 V(Float64Neg, Operator::kNoProperties, 1, 0, 1) 385 V(Float64Neg, Operator::kNoProperties, 1, 0, 1)
392 386
387 #define OVERFLOW_OP_LIST(V) \
388 V(Int32AddWithOverflow, Operator::kAssociative | Operator::kCommutative) \
389 V(Int32SubWithOverflow, Operator::kNoProperties) \
390 V(Int64AddWithOverflow, Operator::kAssociative | Operator::kCommutative) \
391 V(Int64SubWithOverflow, Operator::kNoProperties)
392
393 #define MACHINE_TYPE_LIST(V) \ 393 #define MACHINE_TYPE_LIST(V) \
394 V(Float32) \ 394 V(Float32) \
395 V(Float64) \ 395 V(Float64) \
396 V(Simd128) \ 396 V(Simd128) \
397 V(Int8) \ 397 V(Int8) \
398 V(Uint8) \ 398 V(Uint8) \
399 V(Int16) \ 399 V(Int16) \
400 V(Uint16) \ 400 V(Uint16) \
401 V(Int32) \ 401 V(Int32) \
402 V(Uint32) \ 402 V(Uint32) \
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 Name##Operator() \ 435 Name##Operator() \
436 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \ 436 : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name, \
437 value_input_count, 0, control_input_count, output_count, 0, \ 437 value_input_count, 0, control_input_count, output_count, 0, \
438 0) {} \ 438 0) {} \
439 }; \ 439 }; \
440 Name##Operator k##Name; 440 Name##Operator k##Name;
441 PURE_OP_LIST(PURE) 441 PURE_OP_LIST(PURE)
442 PURE_OPTIONAL_OP_LIST(PURE) 442 PURE_OPTIONAL_OP_LIST(PURE)
443 #undef PURE 443 #undef PURE
444 444
445 #define OVERFLOW_OP(Name, properties) \
446 struct Name##Operator final : public Operator { \
447 Name##Operator() \
448 : Operator(IrOpcode::k##Name, \
449 Operator::kEliminatable | Operator::kNoRead | properties, \
450 #Name, 2, 0, 1, 2, 0, 0) {} \
451 }; \
452 Name##Operator k##Name;
453 OVERFLOW_OP_LIST(OVERFLOW_OP)
454 #undef OVERFLOW_OP
455
445 #define LOAD(Type) \ 456 #define LOAD(Type) \
446 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \ 457 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \
447 Load##Type##Operator() \ 458 Load##Type##Operator() \
448 : Operator1<LoadRepresentation>( \ 459 : Operator1<LoadRepresentation>( \
449 IrOpcode::kLoad, \ 460 IrOpcode::kLoad, \
450 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ 461 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \
451 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 462 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
452 }; \ 463 }; \
453 struct CheckedLoad##Type##Operator final \ 464 struct CheckedLoad##Type##Operator final \
454 : public Operator1<CheckedLoadRepresentation> { \ 465 : public Operator1<CheckedLoadRepresentation> { \
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 #undef PURE 598 #undef PURE
588 599
589 #define PURE(Name, properties, value_input_count, control_input_count, \ 600 #define PURE(Name, properties, value_input_count, control_input_count, \
590 output_count) \ 601 output_count) \
591 const OptionalOperator MachineOperatorBuilder::Name() { \ 602 const OptionalOperator MachineOperatorBuilder::Name() { \
592 return OptionalOperator(flags_ & k##Name ? &cache_.k##Name : nullptr); \ 603 return OptionalOperator(flags_ & k##Name ? &cache_.k##Name : nullptr); \
593 } 604 }
594 PURE_OPTIONAL_OP_LIST(PURE) 605 PURE_OPTIONAL_OP_LIST(PURE)
595 #undef PURE 606 #undef PURE
596 607
608 #define OVERFLOW_OP(Name, properties) \
609 const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; }
610 OVERFLOW_OP_LIST(OVERFLOW_OP)
611 #undef OVERFLOW_OP
597 612
598 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) { 613 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
599 #define LOAD(Type) \ 614 #define LOAD(Type) \
600 if (rep == MachineType::Type()) { \ 615 if (rep == MachineType::Type()) { \
601 return &cache_.kLoad##Type; \ 616 return &cache_.kLoad##Type; \
602 } 617 }
603 MACHINE_TYPE_LIST(LOAD) 618 MACHINE_TYPE_LIST(LOAD)
604 #undef LOAD 619 #undef LOAD
605 UNREACHABLE(); 620 UNREACHABLE();
606 return nullptr; 621 return nullptr;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 } 726 }
712 ATOMIC_REPRESENTATION_LIST(STORE) 727 ATOMIC_REPRESENTATION_LIST(STORE)
713 #undef STORE 728 #undef STORE
714 UNREACHABLE(); 729 UNREACHABLE();
715 return nullptr; 730 return nullptr;
716 } 731 }
717 732
718 } // namespace compiler 733 } // namespace compiler
719 } // namespace internal 734 } // namespace internal
720 } // namespace v8 735 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/int64-lowering.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698