| OLD | NEW |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 MachineRepresentation StackSlotRepresentationOf(Operator const* op) { | 73 MachineRepresentation StackSlotRepresentationOf(Operator const* op) { |
| 74 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); | 74 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); |
| 75 return OpParameter<MachineRepresentation>(op); | 75 return OpParameter<MachineRepresentation>(op); |
| 76 } | 76 } |
| 77 | 77 |
| 78 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) { | 78 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) { |
| 79 DCHECK_EQ(IrOpcode::kAtomicStore, op->opcode()); | 79 DCHECK_EQ(IrOpcode::kAtomicStore, op->opcode()); |
| 80 return OpParameter<MachineRepresentation>(op); | 80 return OpParameter<MachineRepresentation>(op); |
| 81 } | 81 } |
| 82 | 82 |
| 83 MachineType AtomicExchangeRepresentationOf(Operator const* op) { |
| 84 DCHECK_EQ(IrOpcode::kAtomicExchange, op->opcode()); |
| 85 return OpParameter<MachineType>(op); |
| 86 } |
| 87 |
| 83 #define PURE_BINARY_OP_LIST_32(V) \ | 88 #define PURE_BINARY_OP_LIST_32(V) \ |
| 84 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 89 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 85 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 90 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 86 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 91 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 87 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ | 92 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ |
| 88 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ | 93 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ |
| 89 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ | 94 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ |
| 90 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ | 95 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ |
| 91 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ | 96 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ |
| 92 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 97 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 AtomicStore##Type##Operator() \ | 628 AtomicStore##Type##Operator() \ |
| 624 : Operator1<MachineRepresentation>( \ | 629 : Operator1<MachineRepresentation>( \ |
| 625 IrOpcode::kAtomicStore, \ | 630 IrOpcode::kAtomicStore, \ |
| 626 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ | 631 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ |
| 627 "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \ | 632 "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \ |
| 628 }; \ | 633 }; \ |
| 629 AtomicStore##Type##Operator kAtomicStore##Type; | 634 AtomicStore##Type##Operator kAtomicStore##Type; |
| 630 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE) | 635 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE) |
| 631 #undef STORE | 636 #undef STORE |
| 632 | 637 |
| 638 #define ATOMIC_EXCHANGE(Type) \ |
| 639 struct AtomicExchange##Type##Operator : public Operator1<MachineType> { \ |
| 640 AtomicExchange##Type##Operator() \ |
| 641 : Operator1<MachineType>(IrOpcode::kAtomicExchange, \ |
| 642 Operator::kNoDeopt | Operator::kNoThrow, \ |
| 643 "AtomicExchange", 3, 1, 1, 1, 1, 0, \ |
| 644 MachineType::Type()) {} \ |
| 645 }; \ |
| 646 AtomicExchange##Type##Operator kAtomicExchange##Type; |
| 647 ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) |
| 648 #undef ATOMIC_EXCHANGE |
| 649 |
| 633 struct DebugBreakOperator : public Operator { | 650 struct DebugBreakOperator : public Operator { |
| 634 DebugBreakOperator() | 651 DebugBreakOperator() |
| 635 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, | 652 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, |
| 636 0, 0, 0, 0, 0) {} | 653 0, 0, 0, 0, 0) {} |
| 637 }; | 654 }; |
| 638 DebugBreakOperator kDebugBreak; | 655 DebugBreakOperator kDebugBreak; |
| 639 | 656 |
| 640 struct UnsafePointerAddOperator final : public Operator { | 657 struct UnsafePointerAddOperator final : public Operator { |
| 641 UnsafePointerAddOperator() | 658 UnsafePointerAddOperator() |
| 642 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, | 659 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 #define STORE(kRep) \ | 861 #define STORE(kRep) \ |
| 845 if (rep == MachineRepresentation::kRep) { \ | 862 if (rep == MachineRepresentation::kRep) { \ |
| 846 return &cache_.kAtomicStore##kRep; \ | 863 return &cache_.kAtomicStore##kRep; \ |
| 847 } | 864 } |
| 848 ATOMIC_REPRESENTATION_LIST(STORE) | 865 ATOMIC_REPRESENTATION_LIST(STORE) |
| 849 #undef STORE | 866 #undef STORE |
| 850 UNREACHABLE(); | 867 UNREACHABLE(); |
| 851 return nullptr; | 868 return nullptr; |
| 852 } | 869 } |
| 853 | 870 |
| 871 const Operator* MachineOperatorBuilder::AtomicExchange(MachineType rep) { |
| 872 #define EXCHANGE(kRep) \ |
| 873 if (rep == MachineType::kRep()) { \ |
| 874 return &cache_.kAtomicExchange##kRep; \ |
| 875 } |
| 876 ATOMIC_TYPE_LIST(EXCHANGE) |
| 877 #undef EXCHANGE |
| 878 UNREACHABLE(); |
| 879 return nullptr; |
| 880 } |
| 881 |
| 854 } // namespace compiler | 882 } // namespace compiler |
| 855 } // namespace internal | 883 } // namespace internal |
| 856 } // namespace v8 | 884 } // namespace v8 |
| OLD | NEW |