| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 599     AtomicExchange##Type##Operator()                                      \ | 604     AtomicExchange##Type##Operator()                                      \ | 
| 600         : Operator1<MachineType>(IrOpcode::kAtomicExchange,               \ | 605         : Operator1<MachineType>(IrOpcode::kAtomicExchange,               \ | 
| 601                                  Operator::kNoDeopt | Operator::kNoThrow, \ | 606                                  Operator::kNoDeopt | Operator::kNoThrow, \ | 
| 602                                  "AtomicExchange", 3, 1, 1, 1, 1, 0,      \ | 607                                  "AtomicExchange", 3, 1, 1, 1, 1, 0,      \ | 
| 603                                  MachineType::Type()) {}                  \ | 608                                  MachineType::Type()) {}                  \ | 
| 604   };                                                                      \ | 609   };                                                                      \ | 
| 605   AtomicExchange##Type##Operator kAtomicExchange##Type; | 610   AtomicExchange##Type##Operator kAtomicExchange##Type; | 
| 606   ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) | 611   ATOMIC_TYPE_LIST(ATOMIC_EXCHANGE) | 
| 607 #undef ATOMIC_EXCHANGE | 612 #undef ATOMIC_EXCHANGE | 
| 608 | 613 | 
|  | 614 #define ATOMIC_COMPARE_EXCHANGE(Type)                                       \ | 
|  | 615   struct AtomicCompareExchange##Type##Operator                              \ | 
|  | 616       : public Operator1<MachineType> {                                     \ | 
|  | 617     AtomicCompareExchange##Type##Operator()                                 \ | 
|  | 618         : Operator1<MachineType>(IrOpcode::kAtomicCompareExchange,          \ | 
|  | 619                                  Operator::kNoDeopt | Operator::kNoThrow,   \ | 
|  | 620                                  "AtomicCompareExchange", 4, 1, 1, 1, 1, 0, \ | 
|  | 621                                  MachineType::Type()) {}                    \ | 
|  | 622   };                                                                        \ | 
|  | 623   AtomicCompareExchange##Type##Operator kAtomicCompareExchange##Type; | 
|  | 624   ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE) | 
|  | 625 #undef ATOMIC_COMPARE_EXCHANGE | 
|  | 626 | 
| 609   // The {BitcastWordToTagged} operator must not be marked as pure (especially | 627   // The {BitcastWordToTagged} operator must not be marked as pure (especially | 
| 610   // not idempotent), because otherwise the splitting logic in the Scheduler | 628   // not idempotent), because otherwise the splitting logic in the Scheduler | 
| 611   // might decide to split these operators, thus potentially creating live | 629   // might decide to split these operators, thus potentially creating live | 
| 612   // ranges of allocation top across calls or other things that might allocate. | 630   // ranges of allocation top across calls or other things that might allocate. | 
| 613   // See https://bugs.chromium.org/p/v8/issues/detail?id=6059 for more details. | 631   // See https://bugs.chromium.org/p/v8/issues/detail?id=6059 for more details. | 
| 614   struct BitcastWordToTaggedOperator : public Operator { | 632   struct BitcastWordToTaggedOperator : public Operator { | 
| 615     BitcastWordToTaggedOperator() | 633     BitcastWordToTaggedOperator() | 
| 616         : Operator(IrOpcode::kBitcastWordToTagged, | 634         : Operator(IrOpcode::kBitcastWordToTagged, | 
| 617                    Operator::kEliminatable | Operator::kNoWrite, | 635                    Operator::kEliminatable | Operator::kNoWrite, | 
| 618                    "BitcastWordToTagged", 1, 0, 0, 1, 0, 0) {} | 636                    "BitcastWordToTagged", 1, 0, 0, 1, 0, 0) {} | 
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 866 #define EXCHANGE(kRep)                    \ | 884 #define EXCHANGE(kRep)                    \ | 
| 867   if (rep == MachineType::kRep()) {       \ | 885   if (rep == MachineType::kRep()) {       \ | 
| 868     return &cache_.kAtomicExchange##kRep; \ | 886     return &cache_.kAtomicExchange##kRep; \ | 
| 869   } | 887   } | 
| 870   ATOMIC_TYPE_LIST(EXCHANGE) | 888   ATOMIC_TYPE_LIST(EXCHANGE) | 
| 871 #undef EXCHANGE | 889 #undef EXCHANGE | 
| 872   UNREACHABLE(); | 890   UNREACHABLE(); | 
| 873   return nullptr; | 891   return nullptr; | 
| 874 } | 892 } | 
| 875 | 893 | 
|  | 894 const Operator* MachineOperatorBuilder::AtomicCompareExchange(MachineType rep) { | 
|  | 895 #define COMPARE_EXCHANGE(kRep)                   \ | 
|  | 896   if (rep == MachineType::kRep()) {              \ | 
|  | 897     return &cache_.kAtomicCompareExchange##kRep; \ | 
|  | 898   } | 
|  | 899   ATOMIC_TYPE_LIST(COMPARE_EXCHANGE) | 
|  | 900 #undef COMPARE_EXCHANGE | 
|  | 901   UNREACHABLE(); | 
|  | 902   return nullptr; | 
|  | 903 } | 
|  | 904 | 
| 876 #define SIMD_LANE_OPS(Type, lane_count)                                     \ | 905 #define SIMD_LANE_OPS(Type, lane_count)                                     \ | 
| 877   const Operator* MachineOperatorBuilder::Type##ExtractLane(                \ | 906   const Operator* MachineOperatorBuilder::Type##ExtractLane(                \ | 
| 878       int32_t lane_index) {                                                 \ | 907       int32_t lane_index) {                                                 \ | 
| 879     DCHECK(0 <= lane_index && lane_index < lane_count);                     \ | 908     DCHECK(0 <= lane_index && lane_index < lane_count);                     \ | 
| 880     return new (zone_)                                                      \ | 909     return new (zone_)                                                      \ | 
| 881         Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \ | 910         Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \ | 
| 882                            "Extract lane", 1, 0, 0, 1, 0, 0, lane_index);   \ | 911                            "Extract lane", 1, 0, 0, 1, 0, 0, lane_index);   \ | 
| 883   }                                                                         \ | 912   }                                                                         \ | 
| 884   const Operator* MachineOperatorBuilder::Type##ReplaceLane(                \ | 913   const Operator* MachineOperatorBuilder::Type##ReplaceLane(                \ | 
| 885       int32_t lane_index) {                                                 \ | 914       int32_t lane_index) {                                                 \ | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 923     return new (zone_)                                                         \ | 952     return new (zone_)                                                         \ | 
| 924         Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \ | 953         Operator1<uint32_t>(IrOpcode::kSimd##format##Swizzle, Operator::kPure, \ | 
| 925                             "Swizzle", 2, 0, 0, 1, 0, 0, swizzle);             \ | 954                             "Swizzle", 2, 0, 0, 1, 0, 0, swizzle);             \ | 
| 926   } | 955   } | 
| 927 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS) | 956 SIMD_FORMAT_LIST(SIMD_PERMUTE_OPS) | 
| 928 #undef SIMD_PERMUTE_OPS | 957 #undef SIMD_PERMUTE_OPS | 
| 929 | 958 | 
| 930 }  // namespace compiler | 959 }  // namespace compiler | 
| 931 }  // namespace internal | 960 }  // namespace internal | 
| 932 }  // namespace v8 | 961 }  // namespace v8 | 
| OLD | NEW | 
|---|