| 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 int StackSlotSizeOf(Operator const* op) { | 73 int StackSlotSizeOf(Operator const* op) { |
| 74 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); | 74 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode()); |
| 75 return OpParameter<int>(op); | 75 return OpParameter<int>(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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 AtomicStore##Type##Operator() \ | 632 AtomicStore##Type##Operator() \ |
| 628 : Operator1<MachineRepresentation>( \ | 633 : Operator1<MachineRepresentation>( \ |
| 629 IrOpcode::kAtomicStore, \ | 634 IrOpcode::kAtomicStore, \ |
| 630 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ | 635 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ |
| 631 "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \ | 636 "AtomicStore", 3, 1, 1, 0, 1, 0, MachineRepresentation::Type) {} \ |
| 632 }; \ | 637 }; \ |
| 633 AtomicStore##Type##Operator kAtomicStore##Type; | 638 AtomicStore##Type##Operator kAtomicStore##Type; |
| 634 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE) | 639 ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE) |
| 635 #undef STORE | 640 #undef STORE |
| 636 | 641 |
| 642 #define ATOMIC_EXCHANGE(Type) \ |
| 643 struct AtomicExchange##Type##Operator : public Operator1<MachineType> { \ |
| 644 AtomicExchange##Type##Operator() \ |
| 645 : Operator1<MachineType>(IrOpcode::kAtomicExchange, \ |
| 646 Operator::kNoDeopt | Operator::kNoThrow, \ |
| 647 "AtomicExchange", 3, 1, 1, 1, 1, 0, \ |
| 648 MachineType::Type()) {} \ |
| 649 }; \ |
| 650 AtomicExchange##Type##Operator kAtomicExchange##Type; |
| 651 ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) |
| 652 #undef ATOMIC_EXCHANGE |
| 653 |
| 637 struct DebugBreakOperator : public Operator { | 654 struct DebugBreakOperator : public Operator { |
| 638 DebugBreakOperator() | 655 DebugBreakOperator() |
| 639 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, | 656 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, |
| 640 0, 0, 0, 0, 0) {} | 657 0, 0, 0, 0, 0) {} |
| 641 }; | 658 }; |
| 642 DebugBreakOperator kDebugBreak; | 659 DebugBreakOperator kDebugBreak; |
| 643 | 660 |
| 644 struct UnsafePointerAddOperator final : public Operator { | 661 struct UnsafePointerAddOperator final : public Operator { |
| 645 UnsafePointerAddOperator() | 662 UnsafePointerAddOperator() |
| 646 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, | 663 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 #define STORE(kRep) \ | 871 #define STORE(kRep) \ |
| 855 if (rep == MachineRepresentation::kRep) { \ | 872 if (rep == MachineRepresentation::kRep) { \ |
| 856 return &cache_.kAtomicStore##kRep; \ | 873 return &cache_.kAtomicStore##kRep; \ |
| 857 } | 874 } |
| 858 ATOMIC_REPRESENTATION_LIST(STORE) | 875 ATOMIC_REPRESENTATION_LIST(STORE) |
| 859 #undef STORE | 876 #undef STORE |
| 860 UNREACHABLE(); | 877 UNREACHABLE(); |
| 861 return nullptr; | 878 return nullptr; |
| 862 } | 879 } |
| 863 | 880 |
| 881 const Operator* MachineOperatorBuilder::AtomicExchange(MachineType rep) { |
| 882 #define EXCHANGE(kRep) \ |
| 883 if (rep == MachineType::kRep()) { \ |
| 884 return &cache_.kAtomicExchange##kRep; \ |
| 885 } |
| 886 ATOMIC_TYPE_LIST(EXCHANGE) |
| 887 #undef EXCHANGE |
| 888 UNREACHABLE(); |
| 889 return nullptr; |
| 890 } |
| 891 |
| 864 } // namespace compiler | 892 } // namespace compiler |
| 865 } // namespace internal | 893 } // namespace internal |
| 866 } // namespace v8 | 894 } // namespace v8 |
| OLD | NEW |