| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { | 83 MachineType AtomicExchangeRepresentationOf(Operator const* op) { |
| 84 DCHECK_EQ(IrOpcode::kAtomicExchange, op->opcode()); | 84 DCHECK_EQ(IrOpcode::kAtomicExchange, op->opcode()); |
| 85 return OpParameter<MachineType>(op); | 85 return OpParameter<MachineType>(op); |
| 86 } | 86 } |
| 87 | 87 |
| 88 MachineType AtomicCompareExchangeRepresentationOf(Operator const* op) { |
| 89 DCHECK_EQ(IrOpcode::kAtomicCompareExchange, op->opcode()); |
| 90 return OpParameter<MachineType>(op); |
| 91 } |
| 92 |
| 88 #define PURE_BINARY_OP_LIST_32(V) \ | 93 #define PURE_BINARY_OP_LIST_32(V) \ |
| 89 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 94 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 90 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 95 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 91 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 96 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| 92 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ | 97 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ |
| 93 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ | 98 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ |
| 94 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ | 99 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ |
| 95 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ | 100 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ |
| 96 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ | 101 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ |
| 97 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ | 102 V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 AtomicExchange##Type##Operator() \ | 617 AtomicExchange##Type##Operator() \ |
| 613 : Operator1<MachineType>(IrOpcode::kAtomicExchange, \ | 618 : Operator1<MachineType>(IrOpcode::kAtomicExchange, \ |
| 614 Operator::kNoDeopt | Operator::kNoThrow, \ | 619 Operator::kNoDeopt | Operator::kNoThrow, \ |
| 615 "AtomicExchange", 3, 1, 1, 1, 1, 0, \ | 620 "AtomicExchange", 3, 1, 1, 1, 1, 0, \ |
| 616 MachineType::Type()) {} \ | 621 MachineType::Type()) {} \ |
| 617 }; \ | 622 }; \ |
| 618 AtomicExchange##Type##Operator kAtomicExchange##Type; | 623 AtomicExchange##Type##Operator kAtomicExchange##Type; |
| 619 ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) | 624 ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) |
| 620 #undef ATOMIC_EXCHANGE | 625 #undef ATOMIC_EXCHANGE |
| 621 | 626 |
| 627 #define ATOMIC_COMPARE_EXCHANGE(Type) \ |
| 628 struct AtomicCompareExchange##Type##Operator \ |
| 629 : public Operator1<MachineType> { \ |
| 630 AtomicCompareExchange##Type##Operator() \ |
| 631 : Operator1<MachineType>(IrOpcode::kAtomicCompareExchange, \ |
| 632 Operator::kNoDeopt | Operator::kNoThrow, \ |
| 633 "AtomicCompareExchange", 4, 1, 1, 1, 1, 0, \ |
| 634 MachineType::Type()) {} \ |
| 635 }; \ |
| 636 AtomicCompareExchange##Type##Operator kAtomicCompareExchange##Type; |
| 637 ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE) |
| 638 #undef ATOMIC_COMPARE_EXCHANGE |
| 639 |
| 622 struct DebugBreakOperator : public Operator { | 640 struct DebugBreakOperator : public Operator { |
| 623 DebugBreakOperator() | 641 DebugBreakOperator() |
| 624 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, | 642 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, |
| 625 0, 0, 0, 0, 0) {} | 643 0, 0, 0, 0, 0) {} |
| 626 }; | 644 }; |
| 627 DebugBreakOperator kDebugBreak; | 645 DebugBreakOperator kDebugBreak; |
| 628 | 646 |
| 629 struct UnsafePointerAddOperator final : public Operator { | 647 struct UnsafePointerAddOperator final : public Operator { |
| 630 UnsafePointerAddOperator() | 648 UnsafePointerAddOperator() |
| 631 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, | 649 : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 #define EXCHANGE(kRep) \ | 880 #define EXCHANGE(kRep) \ |
| 863 if (rep == MachineType::kRep()) { \ | 881 if (rep == MachineType::kRep()) { \ |
| 864 return &cache_.kAtomicExchange##kRep; \ | 882 return &cache_.kAtomicExchange##kRep; \ |
| 865 } | 883 } |
| 866 ATOMIC_TYPE_LIST(EXCHANGE) | 884 ATOMIC_TYPE_LIST(EXCHANGE) |
| 867 #undef EXCHANGE | 885 #undef EXCHANGE |
| 868 UNREACHABLE(); | 886 UNREACHABLE(); |
| 869 return nullptr; | 887 return nullptr; |
| 870 } | 888 } |
| 871 | 889 |
| 890 const Operator* MachineOperatorBuilder::AtomicCompareExchange(MachineType rep) { |
| 891 #define COMPARE_EXCHANGE(kRep) \ |
| 892 if (rep == MachineType::kRep()) { \ |
| 893 return &cache_.kAtomicCompareExchange##kRep; \ |
| 894 } |
| 895 ATOMIC_TYPE_LIST(COMPARE_EXCHANGE) |
| 896 #undef COMPARE_EXCHANGE |
| 897 UNREACHABLE(); |
| 898 return nullptr; |
| 899 } |
| 900 |
| 872 #define SIMD_LANE_OPS(Type, lane_count) \ | 901 #define SIMD_LANE_OPS(Type, lane_count) \ |
| 873 const Operator* MachineOperatorBuilder::Type##ExtractLane( \ | 902 const Operator* MachineOperatorBuilder::Type##ExtractLane( \ |
| 874 int32_t lane_index) { \ | 903 int32_t lane_index) { \ |
| 875 DCHECK(0 <= lane_index && lane_index < lane_count); \ | 904 DCHECK(0 <= lane_index && lane_index < lane_count); \ |
| 876 return new (zone_) \ | 905 return new (zone_) \ |
| 877 Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \ | 906 Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \ |
| 878 "Extract lane", 1, 0, 0, 1, 0, 0, lane_index); \ | 907 "Extract lane", 1, 0, 0, 1, 0, 0, lane_index); \ |
| 879 } \ | 908 } \ |
| 880 const Operator* MachineOperatorBuilder::Type##ReplaceLane( \ | 909 const Operator* MachineOperatorBuilder::Type##ReplaceLane( \ |
| 881 int32_t lane_index) { \ | 910 int32_t lane_index) { \ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 return new (zone_) \ | 948 return new (zone_) \ |
| 920 Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \ | 949 Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \ |
| 921 "Swizzle", 2, 0, 0, 1, 0, 0, swizzle); \ | 950 "Swizzle", 2, 0, 0, 1, 0, 0, swizzle); \ |
| 922 } | 951 } |
| 923 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS) | 952 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS) |
| 924 #undef SIMD_PERMUTE_OPS | 953 #undef SIMD_PERMUTE_OPS |
| 925 | 954 |
| 926 } // namespace compiler | 955 } // namespace compiler |
| 927 } // namespace internal | 956 } // namespace internal |
| 928 } // namespace v8 | 957 } // namespace v8 |
| OLD | NEW |