Home | History | Annotate | Download | only in compiler
      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
      3 // found in the LICENSE file.
      4 
      5 #include "src/compiler/machine-operator.h"
      6 
      7 #include "src/base/lazy-instance.h"
      8 #include "src/compiler/opcodes.h"
      9 #include "src/compiler/operator.h"
     10 
     11 namespace v8 {
     12 namespace internal {
     13 namespace compiler {
     14 
     15 bool operator==(StoreRepresentation lhs, StoreRepresentation rhs) {
     16   return lhs.representation() == rhs.representation() &&
     17          lhs.write_barrier_kind() == rhs.write_barrier_kind();
     18 }
     19 
     20 
     21 bool operator!=(StoreRepresentation lhs, StoreRepresentation rhs) {
     22   return !(lhs == rhs);
     23 }
     24 
     25 
     26 size_t hash_value(StoreRepresentation rep) {
     27   return base::hash_combine(rep.representation(), rep.write_barrier_kind());
     28 }
     29 
     30 
     31 std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) {
     32   return os << "(" << rep.representation() << " : " << rep.write_barrier_kind()
     33             << ")";
     34 }
     35 
     36 
     37 LoadRepresentation LoadRepresentationOf(Operator const* op) {
     38   DCHECK(IrOpcode::kLoad == op->opcode() ||
     39          IrOpcode::kProtectedLoad == op->opcode() ||
     40          IrOpcode::kWord32AtomicLoad == op->opcode() ||
     41          IrOpcode::kWord64AtomicLoad == op->opcode() ||
     42          IrOpcode::kWord32AtomicPairLoad == op->opcode() ||
     43          IrOpcode::kPoisonedLoad == op->opcode() ||
     44          IrOpcode::kUnalignedLoad == op->opcode());
     45   return OpParameter<LoadRepresentation>(op);
     46 }
     47 
     48 
     49 StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
     50   DCHECK(IrOpcode::kStore == op->opcode() ||
     51          IrOpcode::kProtectedStore == op->opcode());
     52   return OpParameter<StoreRepresentation>(op);
     53 }
     54 
     55 UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
     56     Operator const* op) {
     57   DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode());
     58   return OpParameter<UnalignedStoreRepresentation>(op);
     59 }
     60 
     61 bool operator==(StackSlotRepresentation lhs, StackSlotRepresentation rhs) {
     62   return lhs.size() == rhs.size() && lhs.alignment() == rhs.alignment();
     63 }
     64 
     65 bool operator!=(StackSlotRepresentation lhs, StackSlotRepresentation rhs) {
     66   return !(lhs == rhs);
     67 }
     68 
     69 size_t hash_value(StackSlotRepresentation rep) {
     70   return base::hash_combine(rep.size(), rep.alignment());
     71 }
     72 
     73 std::ostream& operator<<(std::ostream& os, StackSlotRepresentation rep) {
     74   return os << "(" << rep.size() << " : " << rep.alignment() << ")";
     75 }
     76 
     77 StackSlotRepresentation const& StackSlotRepresentationOf(Operator const* op) {
     78   DCHECK_EQ(IrOpcode::kStackSlot, op->opcode());
     79   return OpParameter<StackSlotRepresentation>(op);
     80 }
     81 
     82 MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) {
     83   DCHECK(IrOpcode::kWord32AtomicStore == op->opcode() ||
     84          IrOpcode::kWord64AtomicStore == op->opcode() ||
     85          IrOpcode::kWord32AtomicPairStore == op->opcode());
     86   return OpParameter<MachineRepresentation>(op);
     87 }
     88 
     89 MachineType AtomicOpType(Operator const* op) {
     90   return OpParameter<MachineType>(op);
     91 }
     92 
     93 #define PURE_BINARY_OP_LIST_32(V)                                           \
     94   V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)    \
     95   V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)     \
     96   V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)    \
     97   V(Word32Shl, Operator::kNoProperties, 2, 0, 1)                            \
     98   V(Word32Shr, Operator::kNoProperties, 2, 0, 1)                            \
     99   V(Word32Sar, Operator::kNoProperties, 2, 0, 1)                            \
    100   V(Word32Ror, Operator::kNoProperties, 2, 0, 1)                            \
    101   V(Word32Equal, Operator::kCommutative, 2, 0, 1)                           \
    102   V(Int32Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)     \
    103   V(Int32Sub, Operator::kNoProperties, 2, 0, 1)                             \
    104   V(Int32Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)     \
    105   V(Int32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    106   V(Int32Div, Operator::kNoProperties, 2, 1, 1)                             \
    107   V(Int32Mod, Operator::kNoProperties, 2, 1, 1)                             \
    108   V(Int32LessThan, Operator::kNoProperties, 2, 0, 1)                        \
    109   V(Int32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)                 \
    110   V(Uint32Div, Operator::kNoProperties, 2, 1, 1)                            \
    111   V(Uint32LessThan, Operator::kNoProperties, 2, 0, 1)                       \
    112   V(Uint32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)                \
    113   V(Uint32Mod, Operator::kNoProperties, 2, 1, 1)                            \
    114   V(Uint32MulHigh, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)
    115 
    116 #define PURE_BINARY_OP_LIST_64(V)                                        \
    117   V(Word64And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    118   V(Word64Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)  \
    119   V(Word64Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    120   V(Word64Shl, Operator::kNoProperties, 2, 0, 1)                         \
    121   V(Word64Shr, Operator::kNoProperties, 2, 0, 1)                         \
    122   V(Word64Sar, Operator::kNoProperties, 2, 0, 1)                         \
    123   V(Word64Ror, Operator::kNoProperties, 2, 0, 1)                         \
    124   V(Word64Equal, Operator::kCommutative, 2, 0, 1)                        \
    125   V(Int64Add, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)  \
    126   V(Int64Sub, Operator::kNoProperties, 2, 0, 1)                          \
    127   V(Int64Mul, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)  \
    128   V(Int64Div, Operator::kNoProperties, 2, 1, 1)                          \
    129   V(Int64Mod, Operator::kNoProperties, 2, 1, 1)                          \
    130   V(Int64LessThan, Operator::kNoProperties, 2, 0, 1)                     \
    131   V(Int64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)              \
    132   V(Uint64Div, Operator::kNoProperties, 2, 1, 1)                         \
    133   V(Uint64Mod, Operator::kNoProperties, 2, 1, 1)                         \
    134   V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1)                    \
    135   V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)
    136 
    137 #define MACHINE_PURE_OP_LIST(V)                                           \
    138   PURE_BINARY_OP_LIST_32(V)                                               \
    139   PURE_BINARY_OP_LIST_64(V)                                               \
    140   V(Word32Clz, Operator::kNoProperties, 1, 0, 1)                          \
    141   V(Word64Clz, Operator::kNoProperties, 1, 0, 1)                          \
    142   V(Word32ReverseBytes, Operator::kNoProperties, 1, 0, 1)                 \
    143   V(Word64ReverseBytes, Operator::kNoProperties, 1, 0, 1)                 \
    144   V(BitcastWordToTaggedSigned, Operator::kNoProperties, 1, 0, 1)          \
    145   V(TruncateFloat64ToWord32, Operator::kNoProperties, 1, 0, 1)            \
    146   V(ChangeFloat32ToFloat64, Operator::kNoProperties, 1, 0, 1)             \
    147   V(ChangeFloat64ToInt32, Operator::kNoProperties, 1, 0, 1)               \
    148   V(ChangeFloat64ToUint32, Operator::kNoProperties, 1, 0, 1)              \
    149   V(ChangeFloat64ToUint64, Operator::kNoProperties, 1, 0, 1)              \
    150   V(TruncateFloat64ToUint32, Operator::kNoProperties, 1, 0, 1)            \
    151   V(TruncateFloat32ToInt32, Operator::kNoProperties, 1, 0, 1)             \
    152   V(TruncateFloat32ToUint32, Operator::kNoProperties, 1, 0, 1)            \
    153   V(TryTruncateFloat32ToInt64, Operator::kNoProperties, 1, 0, 2)          \
    154   V(TryTruncateFloat64ToInt64, Operator::kNoProperties, 1, 0, 2)          \
    155   V(TryTruncateFloat32ToUint64, Operator::kNoProperties, 1, 0, 2)         \
    156   V(TryTruncateFloat64ToUint64, Operator::kNoProperties, 1, 0, 2)         \
    157   V(ChangeInt32ToFloat64, Operator::kNoProperties, 1, 0, 1)               \
    158   V(Float64SilenceNaN, Operator::kNoProperties, 1, 0, 1)                  \
    159   V(RoundFloat64ToInt32, Operator::kNoProperties, 1, 0, 1)                \
    160   V(RoundInt32ToFloat32, Operator::kNoProperties, 1, 0, 1)                \
    161   V(RoundInt64ToFloat32, Operator::kNoProperties, 1, 0, 1)                \
    162   V(RoundInt64ToFloat64, Operator::kNoProperties, 1, 0, 1)                \
    163   V(RoundUint32ToFloat32, Operator::kNoProperties, 1, 0, 1)               \
    164   V(RoundUint64ToFloat32, Operator::kNoProperties, 1, 0, 1)               \
    165   V(RoundUint64ToFloat64, Operator::kNoProperties, 1, 0, 1)               \
    166   V(ChangeInt32ToInt64, Operator::kNoProperties, 1, 0, 1)                 \
    167   V(ChangeUint32ToFloat64, Operator::kNoProperties, 1, 0, 1)              \
    168   V(ChangeUint32ToUint64, Operator::kNoProperties, 1, 0, 1)               \
    169   V(TruncateFloat64ToFloat32, Operator::kNoProperties, 1, 0, 1)           \
    170   V(TruncateInt64ToInt32, Operator::kNoProperties, 1, 0, 1)               \
    171   V(BitcastFloat32ToInt32, Operator::kNoProperties, 1, 0, 1)              \
    172   V(BitcastFloat64ToInt64, Operator::kNoProperties, 1, 0, 1)              \
    173   V(BitcastInt32ToFloat32, Operator::kNoProperties, 1, 0, 1)              \
    174   V(BitcastInt64ToFloat64, Operator::kNoProperties, 1, 0, 1)              \
    175   V(SignExtendWord8ToInt32, Operator::kNoProperties, 1, 0, 1)             \
    176   V(SignExtendWord16ToInt32, Operator::kNoProperties, 1, 0, 1)            \
    177   V(SignExtendWord8ToInt64, Operator::kNoProperties, 1, 0, 1)             \
    178   V(SignExtendWord16ToInt64, Operator::kNoProperties, 1, 0, 1)            \
    179   V(SignExtendWord32ToInt64, Operator::kNoProperties, 1, 0, 1)            \
    180   V(Float32Abs, Operator::kNoProperties, 1, 0, 1)                         \
    181   V(Float32Add, Operator::kCommutative, 2, 0, 1)                          \
    182   V(Float32Sub, Operator::kNoProperties, 2, 0, 1)                         \
    183   V(Float32Mul, Operator::kCommutative, 2, 0, 1)                          \
    184   V(Float32Div, Operator::kNoProperties, 2, 0, 1)                         \
    185   V(Float32Neg, Operator::kNoProperties, 1, 0, 1)                         \
    186   V(Float32Sqrt, Operator::kNoProperties, 1, 0, 1)                        \
    187   V(Float32Max, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    188   V(Float32Min, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    189   V(Float64Abs, Operator::kNoProperties, 1, 0, 1)                         \
    190   V(Float64Acos, Operator::kNoProperties, 1, 0, 1)                        \
    191   V(Float64Acosh, Operator::kNoProperties, 1, 0, 1)                       \
    192   V(Float64Asin, Operator::kNoProperties, 1, 0, 1)                        \
    193   V(Float64Asinh, Operator::kNoProperties, 1, 0, 1)                       \
    194   V(Float64Atan, Operator::kNoProperties, 1, 0, 1)                        \
    195   V(Float64Atan2, Operator::kNoProperties, 2, 0, 1)                       \
    196   V(Float64Atanh, Operator::kNoProperties, 1, 0, 1)                       \
    197   V(Float64Cbrt, Operator::kNoProperties, 1, 0, 1)                        \
    198   V(Float64Cos, Operator::kNoProperties, 1, 0, 1)                         \
    199   V(Float64Cosh, Operator::kNoProperties, 1, 0, 1)                        \
    200   V(Float64Exp, Operator::kNoProperties, 1, 0, 1)                         \
    201   V(Float64Expm1, Operator::kNoProperties, 1, 0, 1)                       \
    202   V(Float64Log, Operator::kNoProperties, 1, 0, 1)                         \
    203   V(Float64Log1p, Operator::kNoProperties, 1, 0, 1)                       \
    204   V(Float64Log2, Operator::kNoProperties, 1, 0, 1)                        \
    205   V(Float64Log10, Operator::kNoProperties, 1, 0, 1)                       \
    206   V(Float64Max, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    207   V(Float64Min, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
    208   V(Float64Neg, Operator::kNoProperties, 1, 0, 1)                         \
    209   V(Float64Add, Operator::kCommutative, 2, 0, 1)                          \
    210   V(Float64Sub, Operator::kNoProperties, 2, 0, 1)                         \
    211   V(Float64Mul, Operator::kCommutative, 2, 0, 1)                          \
    212   V(Float64Div, Operator::kNoProperties, 2, 0, 1)                         \
    213   V(Float64Mod, Operator::kNoProperties, 2, 0, 1)                         \
    214   V(Float64Pow, Operator::kNoProperties, 2, 0, 1)                         \
    215   V(Float64Sin, Operator::kNoProperties, 1, 0, 1)                         \
    216   V(Float64Sinh, Operator::kNoProperties, 1, 0, 1)                        \
    217   V(Float64Sqrt, Operator::kNoProperties, 1, 0, 1)                        \
    218   V(Float64Tan, Operator::kNoProperties, 1, 0, 1)                         \
    219   V(Float64Tanh, Operator::kNoProperties, 1, 0, 1)                        \
    220   V(Float32Equal, Operator::kCommutative, 2, 0, 1)                        \
    221   V(Float32LessThan, Operator::kNoProperties, 2, 0, 1)                    \
    222   V(Float32LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)             \
    223   V(Float64Equal, Operator::kCommutative, 2, 0, 1)                        \
    224   V(Float64LessThan, Operator::kNoProperties, 2, 0, 1)                    \
    225   V(Float64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)             \
    226   V(Float64ExtractLowWord32, Operator::kNoProperties, 1, 0, 1)            \
    227   V(Float64ExtractHighWord32, Operator::kNoProperties, 1, 0, 1)           \
    228   V(Float64InsertLowWord32, Operator::kNoProperties, 2, 0, 1)             \
    229   V(Float64InsertHighWord32, Operator::kNoProperties, 2, 0, 1)            \
    230   V(LoadStackPointer, Operator::kNoProperties, 0, 0, 1)                   \
    231   V(LoadFramePointer, Operator::kNoProperties, 0, 0, 1)                   \
    232   V(LoadParentFramePointer, Operator::kNoProperties, 0, 0, 1)             \
    233   V(Int32PairAdd, Operator::kNoProperties, 4, 0, 2)                       \
    234   V(Int32PairSub, Operator::kNoProperties, 4, 0, 2)                       \
    235   V(Int32PairMul, Operator::kNoProperties, 4, 0, 2)                       \
    236   V(Word32PairShl, Operator::kNoProperties, 3, 0, 2)                      \
    237   V(Word32PairShr, Operator::kNoProperties, 3, 0, 2)                      \
    238   V(Word32PairSar, Operator::kNoProperties, 3, 0, 2)                      \
    239   V(F32x4Splat, Operator::kNoProperties, 1, 0, 1)                         \
    240   V(F32x4SConvertI32x4, Operator::kNoProperties, 1, 0, 1)                 \
    241   V(F32x4UConvertI32x4, Operator::kNoProperties, 1, 0, 1)                 \
    242   V(F32x4Abs, Operator::kNoProperties, 1, 0, 1)                           \
    243   V(F32x4Neg, Operator::kNoProperties, 1, 0, 1)                           \
    244   V(F32x4RecipApprox, Operator::kNoProperties, 1, 0, 1)                   \
    245   V(F32x4RecipSqrtApprox, Operator::kNoProperties, 1, 0, 1)               \
    246   V(F32x4Add, Operator::kCommutative, 2, 0, 1)                            \
    247   V(F32x4AddHoriz, Operator::kNoProperties, 2, 0, 1)                      \
    248   V(F32x4Sub, Operator::kNoProperties, 2, 0, 1)                           \
    249   V(F32x4Mul, Operator::kCommutative, 2, 0, 1)                            \
    250   V(F32x4Min, Operator::kCommutative, 2, 0, 1)                            \
    251   V(F32x4Max, Operator::kCommutative, 2, 0, 1)                            \
    252   V(F32x4Eq, Operator::kCommutative, 2, 0, 1)                             \
    253   V(F32x4Ne, Operator::kCommutative, 2, 0, 1)                             \
    254   V(F32x4Lt, Operator::kNoProperties, 2, 0, 1)                            \
    255   V(F32x4Le, Operator::kNoProperties, 2, 0, 1)                            \
    256   V(I32x4Splat, Operator::kNoProperties, 1, 0, 1)                         \
    257   V(I32x4SConvertF32x4, Operator::kNoProperties, 1, 0, 1)                 \
    258   V(I32x4SConvertI16x8Low, Operator::kNoProperties, 1, 0, 1)              \
    259   V(I32x4SConvertI16x8High, Operator::kNoProperties, 1, 0, 1)             \
    260   V(I32x4Neg, Operator::kNoProperties, 1, 0, 1)                           \
    261   V(I32x4Add, Operator::kCommutative, 2, 0, 1)                            \
    262   V(I32x4AddHoriz, Operator::kNoProperties, 2, 0, 1)                      \
    263   V(I32x4Sub, Operator::kNoProperties, 2, 0, 1)                           \
    264   V(I32x4Mul, Operator::kCommutative, 2, 0, 1)                            \
    265   V(I32x4MinS, Operator::kCommutative, 2, 0, 1)                           \
    266   V(I32x4MaxS, Operator::kCommutative, 2, 0, 1)                           \
    267   V(I32x4Eq, Operator::kCommutative, 2, 0, 1)                             \
    268   V(I32x4Ne, Operator::kCommutative, 2, 0, 1)                             \
    269   V(I32x4GtS, Operator::kNoProperties, 2, 0, 1)                           \
    270   V(I32x4GeS, Operator::kNoProperties, 2, 0, 1)                           \
    271   V(I32x4UConvertF32x4, Operator::kNoProperties, 1, 0, 1)                 \
    272   V(I32x4UConvertI16x8Low, Operator::kNoProperties, 1, 0, 1)              \
    273   V(I32x4UConvertI16x8High, Operator::kNoProperties, 1, 0, 1)             \
    274   V(I32x4MinU, Operator::kCommutative, 2, 0, 1)                           \
    275   V(I32x4MaxU, Operator::kCommutative, 2, 0, 1)                           \
    276   V(I32x4GtU, Operator::kNoProperties, 2, 0, 1)                           \
    277   V(I32x4GeU, Operator::kNoProperties, 2, 0, 1)                           \
    278   V(I16x8Splat, Operator::kNoProperties, 1, 0, 1)                         \
    279   V(I16x8SConvertI8x16Low, Operator::kNoProperties, 1, 0, 1)              \
    280   V(I16x8SConvertI8x16High, Operator::kNoProperties, 1, 0, 1)             \
    281   V(I16x8Neg, Operator::kNoProperties, 1, 0, 1)                           \
    282   V(I16x8SConvertI32x4, Operator::kNoProperties, 2, 0, 1)                 \
    283   V(I16x8Add, Operator::kCommutative, 2, 0, 1)                            \
    284   V(I16x8AddSaturateS, Operator::kCommutative, 2, 0, 1)                   \
    285   V(I16x8AddHoriz, Operator::kNoProperties, 2, 0, 1)                      \
    286   V(I16x8Sub, Operator::kNoProperties, 2, 0, 1)                           \
    287   V(I16x8SubSaturateS, Operator::kNoProperties, 2, 0, 1)                  \
    288   V(I16x8Mul, Operator::kCommutative, 2, 0, 1)                            \
    289   V(I16x8MinS, Operator::kCommutative, 2, 0, 1)                           \
    290   V(I16x8MaxS, Operator::kCommutative, 2, 0, 1)                           \
    291   V(I16x8Eq, Operator::kCommutative, 2, 0, 1)                             \
    292   V(I16x8Ne, Operator::kCommutative, 2, 0, 1)                             \
    293   V(I16x8GtS, Operator::kNoProperties, 2, 0, 1)                           \
    294   V(I16x8GeS, Operator::kNoProperties, 2, 0, 1)                           \
    295   V(I16x8UConvertI8x16Low, Operator::kNoProperties, 1, 0, 1)              \
    296   V(I16x8UConvertI8x16High, Operator::kNoProperties, 1, 0, 1)             \
    297   V(I16x8UConvertI32x4, Operator::kNoProperties, 2, 0, 1)                 \
    298   V(I16x8AddSaturateU, Operator::kCommutative, 2, 0, 1)                   \
    299   V(I16x8SubSaturateU, Operator::kNoProperties, 2, 0, 1)                  \
    300   V(I16x8MinU, Operator::kCommutative, 2, 0, 1)                           \
    301   V(I16x8MaxU, Operator::kCommutative, 2, 0, 1)                           \
    302   V(I16x8GtU, Operator::kNoProperties, 2, 0, 1)                           \
    303   V(I16x8GeU, Operator::kNoProperties, 2, 0, 1)                           \
    304   V(I8x16Splat, Operator::kNoProperties, 1, 0, 1)                         \
    305   V(I8x16Neg, Operator::kNoProperties, 1, 0, 1)                           \
    306   V(I8x16SConvertI16x8, Operator::kNoProperties, 2, 0, 1)                 \
    307   V(I8x16Add, Operator::kCommutative, 2, 0, 1)                            \
    308   V(I8x16AddSaturateS, Operator::kCommutative, 2, 0, 1)                   \
    309   V(I8x16Sub, Operator::kNoProperties, 2, 0, 1)                           \
    310   V(I8x16SubSaturateS, Operator::kNoProperties, 2, 0, 1)                  \
    311   V(I8x16Mul, Operator::kCommutative, 2, 0, 1)                            \
    312   V(I8x16MinS, Operator::kCommutative, 2, 0, 1)                           \
    313   V(I8x16MaxS, Operator::kCommutative, 2, 0, 1)                           \
    314   V(I8x16Eq, Operator::kCommutative, 2, 0, 1)                             \
    315   V(I8x16Ne, Operator::kCommutative, 2, 0, 1)                             \
    316   V(I8x16GtS, Operator::kNoProperties, 2, 0, 1)                           \
    317   V(I8x16GeS, Operator::kNoProperties, 2, 0, 1)                           \
    318   V(I8x16UConvertI16x8, Operator::kNoProperties, 2, 0, 1)                 \
    319   V(I8x16AddSaturateU, Operator::kCommutative, 2, 0, 1)                   \
    320   V(I8x16SubSaturateU, Operator::kNoProperties, 2, 0, 1)                  \
    321   V(I8x16MinU, Operator::kCommutative, 2, 0, 1)                           \
    322   V(I8x16MaxU, Operator::kCommutative, 2, 0, 1)                           \
    323   V(I8x16GtU, Operator::kNoProperties, 2, 0, 1)                           \
    324   V(I8x16GeU, Operator::kNoProperties, 2, 0, 1)                           \
    325   V(S128Load, Operator::kNoProperties, 2, 0, 1)                           \
    326   V(S128Store, Operator::kNoProperties, 3, 0, 1)                          \
    327   V(S128Zero, Operator::kNoProperties, 0, 0, 1)                           \
    328   V(S128And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)    \
    329   V(S128Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)     \
    330   V(S128Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1)    \
    331   V(S128Not, Operator::kNoProperties, 1, 0, 1)                            \
    332   V(S128Select, Operator::kNoProperties, 3, 0, 1)                         \
    333   V(S1x4AnyTrue, Operator::kNoProperties, 1, 0, 1)                        \
    334   V(S1x4AllTrue, Operator::kNoProperties, 1, 0, 1)                        \
    335   V(S1x8AnyTrue, Operator::kNoProperties, 1, 0, 1)                        \
    336   V(S1x8AllTrue, Operator::kNoProperties, 1, 0, 1)                        \
    337   V(S1x16AnyTrue, Operator::kNoProperties, 1, 0, 1)                       \
    338   V(S1x16AllTrue, Operator::kNoProperties, 1, 0, 1)
    339 
    340 #define PURE_OPTIONAL_OP_LIST(V)                            \
    341   V(Word32Ctz, Operator::kNoProperties, 1, 0, 1)            \
    342   V(Word64Ctz, Operator::kNoProperties, 1, 0, 1)            \
    343   V(Word32ReverseBits, Operator::kNoProperties, 1, 0, 1)    \
    344   V(Word64ReverseBits, Operator::kNoProperties, 1, 0, 1)    \
    345   V(Int32AbsWithOverflow, Operator::kNoProperties, 1, 0, 1) \
    346   V(Int64AbsWithOverflow, Operator::kNoProperties, 1, 0, 1) \
    347   V(Word32Popcnt, Operator::kNoProperties, 1, 0, 1)         \
    348   V(Word64Popcnt, Operator::kNoProperties, 1, 0, 1)         \
    349   V(Float32RoundDown, Operator::kNoProperties, 1, 0, 1)     \
    350   V(Float64RoundDown, Operator::kNoProperties, 1, 0, 1)     \
    351   V(Float32RoundUp, Operator::kNoProperties, 1, 0, 1)       \
    352   V(Float64RoundUp, Operator::kNoProperties, 1, 0, 1)       \
    353   V(Float32RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
    354   V(Float64RoundTruncate, Operator::kNoProperties, 1, 0, 1) \
    355   V(Float64RoundTiesAway, Operator::kNoProperties, 1, 0, 1) \
    356   V(Float32RoundTiesEven, Operator::kNoProperties, 1, 0, 1) \
    357   V(Float64RoundTiesEven, Operator::kNoProperties, 1, 0, 1)
    358 
    359 #define OVERFLOW_OP_LIST(V)                                                \
    360   V(Int32AddWithOverflow, Operator::kAssociative | Operator::kCommutative) \
    361   V(Int32SubWithOverflow, Operator::kNoProperties)                         \
    362   V(Int32MulWithOverflow, Operator::kAssociative | Operator::kCommutative) \
    363   V(Int64AddWithOverflow, Operator::kAssociative | Operator::kCommutative) \
    364   V(Int64SubWithOverflow, Operator::kNoProperties)
    365 
    366 #define MACHINE_TYPE_LIST(V) \
    367   V(Float32)                 \
    368   V(Float64)                 \
    369   V(Simd128)                 \
    370   V(Int8)                    \
    371   V(Uint8)                   \
    372   V(Int16)                   \
    373   V(Uint16)                  \
    374   V(Int32)                   \
    375   V(Uint32)                  \
    376   V(Int64)                   \
    377   V(Uint64)                  \
    378   V(Pointer)                 \
    379   V(TaggedSigned)            \
    380   V(TaggedPointer)           \
    381   V(AnyTagged)
    382 
    383 #define MACHINE_REPRESENTATION_LIST(V) \
    384   V(kFloat32)                          \
    385   V(kFloat64)                          \
    386   V(kSimd128)                          \
    387   V(kWord8)                            \
    388   V(kWord16)                           \
    389   V(kWord32)                           \
    390   V(kWord64)                           \
    391   V(kTaggedSigned)                     \
    392   V(kTaggedPointer)                    \
    393   V(kTagged)
    394 
    395 #define ATOMIC_U32_TYPE_LIST(V) \
    396   V(Uint8)                      \
    397   V(Uint16)                     \
    398   V(Uint32)
    399 
    400 #define ATOMIC_TYPE_LIST(V) \
    401   ATOMIC_U32_TYPE_LIST(V)   \
    402   V(Int8)                   \
    403   V(Int16)                  \
    404   V(Int32)
    405 
    406 #define ATOMIC_U64_TYPE_LIST(V) \
    407   ATOMIC_U32_TYPE_LIST(V)       \
    408   V(Uint64)
    409 
    410 #define ATOMIC_REPRESENTATION_LIST(V) \
    411   V(kWord8)                           \
    412   V(kWord16)                          \
    413   V(kWord32)
    414 
    415 #define ATOMIC64_REPRESENTATION_LIST(V) \
    416   ATOMIC_REPRESENTATION_LIST(V)         \
    417   V(kWord64)
    418 
    419 #define ATOMIC_PAIR_BINOP_LIST(V) \
    420   V(Add)                          \
    421   V(Sub)                          \
    422   V(And)                          \
    423   V(Or)                           \
    424   V(Xor)                          \
    425   V(Exchange)
    426 
    427 #define SIMD_LANE_OP_LIST(V) \
    428   V(F32x4, 4)                \
    429   V(I32x4, 4)                \
    430   V(I16x8, 8)                \
    431   V(I8x16, 16)
    432 
    433 #define SIMD_FORMAT_LIST(V) \
    434   V(32x4, 32)               \
    435   V(16x8, 16)               \
    436   V(8x16, 8)
    437 
    438 #define STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST(V) \
    439   V(4, 0) V(8, 0) V(16, 0) V(4, 4) V(8, 8) V(16, 16)
    440 
    441 struct StackSlotOperator : public Operator1<StackSlotRepresentation> {
    442   explicit StackSlotOperator(int size, int alignment)
    443       : Operator1<StackSlotRepresentation>(
    444             IrOpcode::kStackSlot, Operator::kNoDeopt | Operator::kNoThrow,
    445             "StackSlot", 0, 0, 0, 1, 0, 0,
    446             StackSlotRepresentation(size, alignment)) {}
    447 };
    448 
    449 struct MachineOperatorGlobalCache {
    450 #define PURE(Name, properties, value_input_count, control_input_count,         \
    451              output_count)                                                     \
    452   struct Name##Operator final : public Operator {                              \
    453     Name##Operator()                                                           \
    454         : Operator(IrOpcode::k##Name, Operator::kPure | properties, #Name,     \
    455                    value_input_count, 0, control_input_count, output_count, 0, \
    456                    0) {}                                                       \
    457   };                                                                           \
    458   Name##Operator k##Name;
    459   MACHINE_PURE_OP_LIST(PURE)
    460   PURE_OPTIONAL_OP_LIST(PURE)
    461 #undef PURE
    462 
    463 #define OVERFLOW_OP(Name, properties)                                        \
    464   struct Name##Operator final : public Operator {                            \
    465     Name##Operator()                                                         \
    466         : Operator(IrOpcode::k##Name,                                        \
    467                    Operator::kEliminatable | Operator::kNoRead | properties, \
    468                    #Name, 2, 0, 1, 2, 0, 0) {}                               \
    469   };                                                                         \
    470   Name##Operator k##Name;
    471   OVERFLOW_OP_LIST(OVERFLOW_OP)
    472 #undef OVERFLOW_OP
    473 
    474 #define LOAD(Type)                                                            \
    475   struct Load##Type##Operator final : public Operator1<LoadRepresentation> {  \
    476     Load##Type##Operator()                                                    \
    477         : Operator1<LoadRepresentation>(                                      \
    478               IrOpcode::kLoad,                                                \
    479               Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite,   \
    480               "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {}               \
    481   };                                                                          \
    482   struct PoisonedLoad##Type##Operator final                                   \
    483       : public Operator1<LoadRepresentation> {                                \
    484     PoisonedLoad##Type##Operator()                                            \
    485         : Operator1<LoadRepresentation>(                                      \
    486               IrOpcode::kPoisonedLoad,                                        \
    487               Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite,   \
    488               "PoisonedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {}       \
    489   };                                                                          \
    490   struct UnalignedLoad##Type##Operator final                                  \
    491       : public Operator1<LoadRepresentation> {                                \
    492     UnalignedLoad##Type##Operator()                                           \
    493         : Operator1<LoadRepresentation>(                                      \
    494               IrOpcode::kUnalignedLoad,                                       \
    495               Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite,   \
    496               "UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {}      \
    497   };                                                                          \
    498   struct ProtectedLoad##Type##Operator final                                  \
    499       : public Operator1<LoadRepresentation> {                                \
    500     ProtectedLoad##Type##Operator()                                           \
    501         : Operator1<LoadRepresentation>(                                      \
    502               IrOpcode::kProtectedLoad,                                       \
    503               Operator::kNoDeopt | Operator::kNoThrow, "ProtectedLoad", 2, 1, \
    504               1, 1, 1, 0, MachineType::Type()) {}                             \
    505   };                                                                          \
    506   Load##Type##Operator kLoad##Type;                                           \
    507   PoisonedLoad##Type##Operator kPoisonedLoad##Type;                           \
    508   UnalignedLoad##Type##Operator kUnalignedLoad##Type;                         \
    509   ProtectedLoad##Type##Operator kProtectedLoad##Type;
    510   MACHINE_TYPE_LIST(LOAD)
    511 #undef LOAD
    512 
    513 #define STACKSLOT(Size, Alignment)                                     \
    514   struct StackSlotOfSize##Size##OfAlignment##Alignment##Operator final \
    515       : public StackSlotOperator {                                     \
    516     StackSlotOfSize##Size##OfAlignment##Alignment##Operator()          \
    517         : StackSlotOperator(Size, Alignment) {}                        \
    518   };                                                                   \
    519   StackSlotOfSize##Size##OfAlignment##Alignment##Operator              \
    520       kStackSlotOfSize##Size##OfAlignment##Alignment;
    521   STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST(STACKSLOT)
    522 #undef STACKSLOT
    523 
    524 #define STORE(Type)                                                            \
    525   struct Store##Type##Operator : public Operator1<StoreRepresentation> {       \
    526     explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind)        \
    527         : Operator1<StoreRepresentation>(                                      \
    528               IrOpcode::kStore,                                                \
    529               Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow,     \
    530               "Store", 3, 1, 1, 0, 1, 0,                                       \
    531               StoreRepresentation(MachineRepresentation::Type,                 \
    532                                   write_barrier_kind)) {}                      \
    533   };                                                                           \
    534   struct Store##Type##NoWriteBarrier##Operator final                           \
    535       : public Store##Type##Operator {                                         \
    536     Store##Type##NoWriteBarrier##Operator()                                    \
    537         : Store##Type##Operator(kNoWriteBarrier) {}                            \
    538   };                                                                           \
    539   struct Store##Type##MapWriteBarrier##Operator final                          \
    540       : public Store##Type##Operator {                                         \
    541     Store##Type##MapWriteBarrier##Operator()                                   \
    542         : Store##Type##Operator(kMapWriteBarrier) {}                           \
    543   };                                                                           \
    544   struct Store##Type##PointerWriteBarrier##Operator final                      \
    545       : public Store##Type##Operator {                                         \
    546     Store##Type##PointerWriteBarrier##Operator()                               \
    547         : Store##Type##Operator(kPointerWriteBarrier) {}                       \
    548   };                                                                           \
    549   struct Store##Type##FullWriteBarrier##Operator final                         \
    550       : public Store##Type##Operator {                                         \
    551     Store##Type##FullWriteBarrier##Operator()                                  \
    552         : Store##Type##Operator(kFullWriteBarrier) {}                          \
    553   };                                                                           \
    554   struct UnalignedStore##Type##Operator final                                  \
    555       : public Operator1<UnalignedStoreRepresentation> {                       \
    556     UnalignedStore##Type##Operator()                                           \
    557         : Operator1<UnalignedStoreRepresentation>(                             \
    558               IrOpcode::kUnalignedStore,                                       \
    559               Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow,     \
    560               "UnalignedStore", 3, 1, 1, 0, 1, 0,                              \
    561               MachineRepresentation::Type) {}                                  \
    562   };                                                                           \
    563   struct ProtectedStore##Type##Operator                                        \
    564       : public Operator1<StoreRepresentation> {                                \
    565     explicit ProtectedStore##Type##Operator()                                  \
    566         : Operator1<StoreRepresentation>(                                      \
    567               IrOpcode::kProtectedStore,                                       \
    568               Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow,     \
    569               "Store", 3, 1, 1, 0, 1, 0,                                       \
    570               StoreRepresentation(MachineRepresentation::Type,                 \
    571                                   kNoWriteBarrier)) {}                         \
    572   };                                                                           \
    573   Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier;          \
    574   Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier;        \
    575   Store##Type##PointerWriteBarrier##Operator                                   \
    576       kStore##Type##PointerWriteBarrier;                                       \
    577   Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier;      \
    578   UnalignedStore##Type##Operator kUnalignedStore##Type;                        \
    579   ProtectedStore##Type##Operator kProtectedStore##Type;
    580   MACHINE_REPRESENTATION_LIST(STORE)
    581 #undef STORE
    582 
    583 #define ATOMIC_LOAD(Type)                                                   \
    584   struct Word32AtomicLoad##Type##Operator final                             \
    585       : public Operator1<LoadRepresentation> {                              \
    586     Word32AtomicLoad##Type##Operator()                                      \
    587         : Operator1<LoadRepresentation>(                                    \
    588               IrOpcode::kWord32AtomicLoad,                                  \
    589               Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \
    590               "Word32AtomicLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
    591   };                                                                        \
    592   Word32AtomicLoad##Type##Operator kWord32AtomicLoad##Type;
    593   ATOMIC_TYPE_LIST(ATOMIC_LOAD)
    594 #undef ATOMIC_LOAD
    595 
    596 #define ATOMIC_LOAD(Type)                                                   \
    597   struct Word64AtomicLoad##Type##Operator final                             \
    598       : public Operator1<LoadRepresentation> {                              \
    599     Word64AtomicLoad##Type##Operator()                                      \
    600         : Operator1<LoadRepresentation>(                                    \
    601               IrOpcode::kWord64AtomicLoad,                                  \
    602               Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \
    603               "Word64AtomicLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
    604   };                                                                        \
    605   Word64AtomicLoad##Type##Operator kWord64AtomicLoad##Type;
    606   ATOMIC_U64_TYPE_LIST(ATOMIC_LOAD)
    607 #undef ATOMIC_LOAD
    608 
    609 #define ATOMIC_STORE(Type)                                                 \
    610   struct Word32AtomicStore##Type##Operator                                 \
    611       : public Operator1<MachineRepresentation> {                          \
    612     Word32AtomicStore##Type##Operator()                                    \
    613         : Operator1<MachineRepresentation>(                                \
    614               IrOpcode::kWord32AtomicStore,                                \
    615               Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \
    616               "Word32AtomicStore", 3, 1, 1, 0, 1, 0,                       \
    617               MachineRepresentation::Type) {}                              \
    618   };                                                                       \
    619   Word32AtomicStore##Type##Operator kWord32AtomicStore##Type;
    620   ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE)
    621 #undef ATOMIC_STORE
    622 
    623 #define ATOMIC_STORE(Type)                                                 \
    624   struct Word64AtomicStore##Type##Operator                                 \
    625       : public Operator1<MachineRepresentation> {                          \
    626     Word64AtomicStore##Type##Operator()                                    \
    627         : Operator1<MachineRepresentation>(                                \
    628               IrOpcode::kWord64AtomicStore,                                \
    629               Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \
    630               "Word64AtomicStore", 3, 1, 1, 0, 1, 0,                       \
    631               MachineRepresentation::Type) {}                              \
    632   };                                                                       \
    633   Word64AtomicStore##Type##Operator kWord64AtomicStore##Type;
    634   ATOMIC64_REPRESENTATION_LIST(ATOMIC_STORE)
    635 #undef ATOMIC_STORE
    636 
    637 #define ATOMIC_OP(op, type)                                                    \
    638   struct op##type##Operator : public Operator1<MachineType> {                  \
    639     op##type##Operator()                                                       \
    640         : Operator1<MachineType>(IrOpcode::k##op,                              \
    641                                  Operator::kNoDeopt | Operator::kNoThrow, #op, \
    642                                  3, 1, 1, 1, 1, 0, MachineType::type()) {}     \
    643   };                                                                           \
    644   op##type##Operator k##op##type;
    645 #define ATOMIC_OP_LIST(type)       \
    646   ATOMIC_OP(Word32AtomicAdd, type) \
    647   ATOMIC_OP(Word32AtomicSub, type) \
    648   ATOMIC_OP(Word32AtomicAnd, type) \
    649   ATOMIC_OP(Word32AtomicOr, type)  \
    650   ATOMIC_OP(Word32AtomicXor, type) \
    651   ATOMIC_OP(Word32AtomicExchange, type)
    652   ATOMIC_TYPE_LIST(ATOMIC_OP_LIST)
    653 #undef ATOMIC_OP_LIST
    654 #define ATOMIC64_OP_LIST(type)     \
    655   ATOMIC_OP(Word64AtomicAdd, type) \
    656   ATOMIC_OP(Word64AtomicSub, type) \
    657   ATOMIC_OP(Word64AtomicAnd, type) \
    658   ATOMIC_OP(Word64AtomicOr, type)  \
    659   ATOMIC_OP(Word64AtomicXor, type) \
    660   ATOMIC_OP(Word64AtomicExchange, type)
    661   ATOMIC_U64_TYPE_LIST(ATOMIC64_OP_LIST)
    662 #undef ATOMIC64_OP_LIST
    663 #undef ATOMIC_OP
    664 
    665 #define ATOMIC_COMPARE_EXCHANGE(Type)                                          \
    666   struct Word32AtomicCompareExchange##Type##Operator                           \
    667       : public Operator1<MachineType> {                                        \
    668     Word32AtomicCompareExchange##Type##Operator()                              \
    669         : Operator1<MachineType>(IrOpcode::kWord32AtomicCompareExchange,       \
    670                                  Operator::kNoDeopt | Operator::kNoThrow,      \
    671                                  "Word32AtomicCompareExchange", 4, 1, 1, 1, 1, \
    672                                  0, MachineType::Type()) {}                    \
    673   };                                                                           \
    674   Word32AtomicCompareExchange##Type##Operator                                  \
    675       kWord32AtomicCompareExchange##Type;
    676   ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
    677 #undef ATOMIC_COMPARE_EXCHANGE
    678 
    679 #define ATOMIC_COMPARE_EXCHANGE(Type)                                          \
    680   struct Word64AtomicCompareExchange##Type##Operator                           \
    681       : public Operator1<MachineType> {                                        \
    682     Word64AtomicCompareExchange##Type##Operator()                              \
    683         : Operator1<MachineType>(IrOpcode::kWord64AtomicCompareExchange,       \
    684                                  Operator::kNoDeopt | Operator::kNoThrow,      \
    685                                  "Word64AtomicCompareExchange", 4, 1, 1, 1, 1, \
    686                                  0, MachineType::Type()) {}                    \
    687   };                                                                           \
    688   Word64AtomicCompareExchange##Type##Operator                                  \
    689       kWord64AtomicCompareExchange##Type;
    690   ATOMIC_U64_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
    691 #undef ATOMIC_COMPARE_EXCHANGE
    692 
    693   struct Word32AtomicPairLoadOperator : public Operator {
    694     Word32AtomicPairLoadOperator()
    695         : Operator(IrOpcode::kWord32AtomicPairLoad,
    696                    Operator::kNoDeopt | Operator::kNoThrow,
    697                    "Word32AtomicPairLoad", 2, 1, 1, 2, 1, 0) {}
    698   };
    699   Word32AtomicPairLoadOperator kWord32AtomicPairLoad;
    700 
    701   struct Word32AtomicPairStoreOperator : public Operator {
    702     Word32AtomicPairStoreOperator()
    703         : Operator(IrOpcode::kWord32AtomicPairStore,
    704                    Operator::kNoDeopt | Operator::kNoThrow,
    705                    "Word32AtomicPairStore", 4, 1, 1, 0, 1, 0) {}
    706   };
    707   Word32AtomicPairStoreOperator kWord32AtomicPairStore;
    708 
    709 #define ATOMIC_PAIR_OP(op)                                      \
    710   struct Word32AtomicPair##op##Operator : public Operator {     \
    711     Word32AtomicPair##op##Operator()                            \
    712         : Operator(IrOpcode::kWord32AtomicPair##op,             \
    713                    Operator::kNoDeopt | Operator::kNoThrow,     \
    714                    "Word32AtomicPair##op", 4, 1, 1, 2, 1, 0) {} \
    715   };                                                            \
    716   Word32AtomicPair##op##Operator kWord32AtomicPair##op;
    717   ATOMIC_PAIR_BINOP_LIST(ATOMIC_PAIR_OP)
    718 #undef ATOMIC_PAIR_OP
    719 #undef ATOMIC_PAIR_BINOP_LIST
    720 
    721 #define ATOMIC64_NARROW_OP(op, type)                                           \
    722   struct op##type##Operator : public Operator1<MachineType> {                  \
    723     op##type##Operator()                                                       \
    724         : Operator1<MachineType>(                                              \
    725               IrOpcode::k##op, Operator::kNoDeopt | Operator::kNoThrow, "#op", \
    726               3, 1, 1, 2, 1, 0, MachineType::type()) {}                        \
    727   };                                                                           \
    728   op##type##Operator k##op##type;
    729 #define ATOMIC_OP_LIST(type)                      \
    730   ATOMIC64_NARROW_OP(Word64AtomicNarrowAdd, type) \
    731   ATOMIC64_NARROW_OP(Word64AtomicNarrowSub, type) \
    732   ATOMIC64_NARROW_OP(Word64AtomicNarrowAnd, type) \
    733   ATOMIC64_NARROW_OP(Word64AtomicNarrowOr, type)  \
    734   ATOMIC64_NARROW_OP(Word64AtomicNarrowXor, type) \
    735   ATOMIC64_NARROW_OP(Word64AtomicNarrowExchange, type)
    736   ATOMIC_U32_TYPE_LIST(ATOMIC_OP_LIST)
    737 #undef ATOMIC_OP_LIST
    738 #undef ATOMIC64_NARROW_OP
    739 
    740   struct Word32AtomicPairCompareExchangeOperator : public Operator {
    741     Word32AtomicPairCompareExchangeOperator()
    742         : Operator(IrOpcode::kWord32AtomicPairCompareExchange,
    743                    Operator::kNoDeopt | Operator::kNoThrow,
    744                    "Word32AtomicPairCompareExchange", 6, 1, 1, 2, 1, 0) {}
    745   };
    746   Word32AtomicPairCompareExchangeOperator kWord32AtomicPairCompareExchange;
    747 
    748 #define ATOMIC_COMPARE_EXCHANGE(Type)                                          \
    749   struct Word64AtomicNarrowCompareExchange##Type##Operator                     \
    750       : public Operator1<MachineType> {                                        \
    751     Word64AtomicNarrowCompareExchange##Type##Operator()                        \
    752         : Operator1<MachineType>(IrOpcode::kWord64AtomicNarrowCompareExchange, \
    753                                  Operator::kNoDeopt | Operator::kNoThrow,      \
    754                                  "Word64AtomicNarrowCompareExchange", 4, 1, 1, \
    755                                  2, 1, 0, MachineType::Type()) {}              \
    756   };                                                                           \
    757   Word64AtomicNarrowCompareExchange##Type##Operator                            \
    758       kWord64AtomicNarrowCompareExchange##Type;
    759   ATOMIC_TYPE_LIST(ATOMIC_COMPARE_EXCHANGE)
    760 #undef ATOMIC_COMPARE_EXCHANGE
    761 
    762   // The {BitcastWordToTagged} operator must not be marked as pure (especially
    763   // not idempotent), because otherwise the splitting logic in the Scheduler
    764   // might decide to split these operators, thus potentially creating live
    765   // ranges of allocation top across calls or other things that might allocate.
    766   // See https://bugs.chromium.org/p/v8/issues/detail?id=6059 for more details.
    767   struct BitcastWordToTaggedOperator : public Operator {
    768     BitcastWordToTaggedOperator()
    769         : Operator(IrOpcode::kBitcastWordToTagged,
    770                    Operator::kEliminatable | Operator::kNoWrite,
    771                    "BitcastWordToTagged", 1, 1, 1, 1, 1, 0) {}
    772   };
    773   BitcastWordToTaggedOperator kBitcastWordToTagged;
    774 
    775   struct BitcastTaggedToWordOperator : public Operator {
    776     BitcastTaggedToWordOperator()
    777         : Operator(IrOpcode::kBitcastTaggedToWord,
    778                    Operator::kEliminatable | Operator::kNoWrite,
    779                    "BitcastTaggedToWord", 1, 1, 1, 1, 1, 0) {}
    780   };
    781   BitcastTaggedToWordOperator kBitcastTaggedToWord;
    782 
    783   struct BitcastMaybeObjectToWordOperator : public Operator {
    784     BitcastMaybeObjectToWordOperator()
    785         : Operator(IrOpcode::kBitcastTaggedToWord,
    786                    Operator::kEliminatable | Operator::kNoWrite,
    787                    "BitcastMaybeObjectToWord", 1, 1, 1, 1, 1, 0) {}
    788   };
    789   BitcastMaybeObjectToWordOperator kBitcastMaybeObjectToWord;
    790 
    791   struct TaggedPoisonOnSpeculation : public Operator {
    792     TaggedPoisonOnSpeculation()
    793         : Operator(IrOpcode::kTaggedPoisonOnSpeculation,
    794                    Operator::kEliminatable | Operator::kNoWrite,
    795                    "TaggedPoisonOnSpeculation", 1, 1, 1, 1, 1, 0) {}
    796   };
    797   TaggedPoisonOnSpeculation kTaggedPoisonOnSpeculation;
    798 
    799   struct Word32PoisonOnSpeculation : public Operator {
    800     Word32PoisonOnSpeculation()
    801         : Operator(IrOpcode::kWord32PoisonOnSpeculation,
    802                    Operator::kEliminatable | Operator::kNoWrite,
    803                    "Word32PoisonOnSpeculation", 1, 1, 1, 1, 1, 0) {}
    804   };
    805   Word32PoisonOnSpeculation kWord32PoisonOnSpeculation;
    806 
    807   struct Word64PoisonOnSpeculation : public Operator {
    808     Word64PoisonOnSpeculation()
    809         : Operator(IrOpcode::kWord64PoisonOnSpeculation,
    810                    Operator::kEliminatable | Operator::kNoWrite,
    811                    "Word64PoisonOnSpeculation", 1, 1, 1, 1, 1, 0) {}
    812   };
    813   Word64PoisonOnSpeculation kWord64PoisonOnSpeculation;
    814 
    815   struct SpeculationFenceOperator : public Operator {
    816     SpeculationFenceOperator()
    817         : Operator(IrOpcode::kSpeculationFence, Operator::kNoThrow,
    818                    "SpeculationFence", 0, 1, 1, 0, 1, 0) {}
    819   };
    820   SpeculationFenceOperator kSpeculationFence;
    821 
    822   struct DebugAbortOperator : public Operator {
    823     DebugAbortOperator()
    824         : Operator(IrOpcode::kDebugAbort, Operator::kNoThrow, "DebugAbort", 1,
    825                    1, 1, 0, 1, 0) {}
    826   };
    827   DebugAbortOperator kDebugAbort;
    828 
    829   struct DebugBreakOperator : public Operator {
    830     DebugBreakOperator()
    831         : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0,
    832                    1, 1, 0, 1, 0) {}
    833   };
    834   DebugBreakOperator kDebugBreak;
    835 
    836   struct UnsafePointerAddOperator final : public Operator {
    837     UnsafePointerAddOperator()
    838         : Operator(IrOpcode::kUnsafePointerAdd, Operator::kKontrol,
    839                    "UnsafePointerAdd", 2, 1, 1, 1, 1, 0) {}
    840   };
    841   UnsafePointerAddOperator kUnsafePointerAdd;
    842 };
    843 
    844 struct CommentOperator : public Operator1<const char*> {
    845   explicit CommentOperator(const char* msg)
    846       : Operator1<const char*>(IrOpcode::kComment, Operator::kNoThrow,
    847                                "Comment", 0, 0, 0, 0, 0, 0, msg) {}
    848 };
    849 
    850 static base::LazyInstance<MachineOperatorGlobalCache>::type
    851     kMachineOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER;
    852 
    853 MachineOperatorBuilder::MachineOperatorBuilder(
    854     Zone* zone, MachineRepresentation word, Flags flags,
    855     AlignmentRequirements alignmentRequirements)
    856     : zone_(zone),
    857       cache_(kMachineOperatorGlobalCache.Get()),
    858       word_(word),
    859       flags_(flags),
    860       alignment_requirements_(alignmentRequirements) {
    861   DCHECK(word == MachineRepresentation::kWord32 ||
    862          word == MachineRepresentation::kWord64);
    863 }
    864 
    865 const Operator* MachineOperatorBuilder::UnalignedLoad(LoadRepresentation rep) {
    866 #define LOAD(Type)                       \
    867   if (rep == MachineType::Type()) {      \
    868     return &cache_.kUnalignedLoad##Type; \
    869   }
    870   MACHINE_TYPE_LIST(LOAD)
    871 #undef LOAD
    872   UNREACHABLE();
    873 }
    874 
    875 const Operator* MachineOperatorBuilder::UnalignedStore(
    876     UnalignedStoreRepresentation rep) {
    877   switch (rep) {
    878 #define STORE(kRep)                 \
    879   case MachineRepresentation::kRep: \
    880     return &cache_.kUnalignedStore##kRep;
    881     MACHINE_REPRESENTATION_LIST(STORE)
    882 #undef STORE
    883     case MachineRepresentation::kBit:
    884     case MachineRepresentation::kNone:
    885       break;
    886   }
    887   UNREACHABLE();
    888 }
    889 
    890 #define PURE(Name, properties, value_input_count, control_input_count, \
    891              output_count)                                             \
    892   const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; }
    893 MACHINE_PURE_OP_LIST(PURE)
    894 #undef PURE
    895 
    896 #define PURE(Name, properties, value_input_count, control_input_count, \
    897              output_count)                                             \
    898   const OptionalOperator MachineOperatorBuilder::Name() {              \
    899     return OptionalOperator(flags_ & k##Name, &cache_.k##Name);        \
    900   }
    901 PURE_OPTIONAL_OP_LIST(PURE)
    902 #undef PURE
    903 
    904 #define OVERFLOW_OP(Name, properties) \
    905   const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; }
    906 OVERFLOW_OP_LIST(OVERFLOW_OP)
    907 #undef OVERFLOW_OP
    908 
    909 const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
    910 #define LOAD(Type)                  \
    911   if (rep == MachineType::Type()) { \
    912     return &cache_.kLoad##Type;     \
    913   }
    914     MACHINE_TYPE_LIST(LOAD)
    915 #undef LOAD
    916   UNREACHABLE();
    917 }
    918 
    919 const Operator* MachineOperatorBuilder::PoisonedLoad(LoadRepresentation rep) {
    920 #define LOAD(Type)                      \
    921   if (rep == MachineType::Type()) {     \
    922     return &cache_.kPoisonedLoad##Type; \
    923   }
    924   MACHINE_TYPE_LIST(LOAD)
    925 #undef LOAD
    926   UNREACHABLE();
    927 }
    928 
    929 const Operator* MachineOperatorBuilder::ProtectedLoad(LoadRepresentation rep) {
    930 #define LOAD(Type)                       \
    931   if (rep == MachineType::Type()) {      \
    932     return &cache_.kProtectedLoad##Type; \
    933   }
    934   MACHINE_TYPE_LIST(LOAD)
    935 #undef LOAD
    936   UNREACHABLE();
    937 }
    938 
    939 const Operator* MachineOperatorBuilder::StackSlot(int size, int alignment) {
    940   DCHECK_LE(0, size);
    941   DCHECK(alignment == 0 || alignment == 4 || alignment == 8 || alignment == 16);
    942 #define CASE_CACHED_SIZE(Size, Alignment)                          \
    943   if (size == Size && alignment == Alignment) {                    \
    944     return &cache_.kStackSlotOfSize##Size##OfAlignment##Alignment; \
    945   }
    946 
    947   STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST(CASE_CACHED_SIZE)
    948 
    949 #undef CASE_CACHED_SIZE
    950   return new (zone_) StackSlotOperator(size, alignment);
    951 }
    952 
    953 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep,
    954                                                   int alignment) {
    955   return StackSlot(1 << ElementSizeLog2Of(rep), alignment);
    956 }
    957 
    958 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
    959   switch (store_rep.representation()) {
    960 #define STORE(kRep)                                         \
    961   case MachineRepresentation::kRep:                         \
    962     switch (store_rep.write_barrier_kind()) {               \
    963       case kNoWriteBarrier:                                 \
    964         return &cache_.k##Store##kRep##NoWriteBarrier;      \
    965       case kMapWriteBarrier:                                \
    966         return &cache_.k##Store##kRep##MapWriteBarrier;     \
    967       case kPointerWriteBarrier:                            \
    968         return &cache_.k##Store##kRep##PointerWriteBarrier; \
    969       case kFullWriteBarrier:                               \
    970         return &cache_.k##Store##kRep##FullWriteBarrier;    \
    971     }                                                       \
    972     break;
    973     MACHINE_REPRESENTATION_LIST(STORE)
    974 #undef STORE
    975     case MachineRepresentation::kBit:
    976     case MachineRepresentation::kNone:
    977       break;
    978   }
    979   UNREACHABLE();
    980 }
    981 
    982 const Operator* MachineOperatorBuilder::ProtectedStore(
    983     MachineRepresentation rep) {
    984   switch (rep) {
    985 #define STORE(kRep)                       \
    986   case MachineRepresentation::kRep:       \
    987     return &cache_.kProtectedStore##kRep; \
    988     break;
    989     MACHINE_REPRESENTATION_LIST(STORE)
    990 #undef STORE
    991     case MachineRepresentation::kBit:
    992     case MachineRepresentation::kNone:
    993       break;
    994   }
    995   UNREACHABLE();
    996 }
    997 
    998 const Operator* MachineOperatorBuilder::UnsafePointerAdd() {
    999   return &cache_.kUnsafePointerAdd;
   1000 }
   1001 
   1002 const Operator* MachineOperatorBuilder::BitcastWordToTagged() {
   1003   return &cache_.kBitcastWordToTagged;
   1004 }
   1005 
   1006 const Operator* MachineOperatorBuilder::BitcastTaggedToWord() {
   1007   return &cache_.kBitcastTaggedToWord;
   1008 }
   1009 
   1010 const Operator* MachineOperatorBuilder::BitcastMaybeObjectToWord() {
   1011   return &cache_.kBitcastMaybeObjectToWord;
   1012 }
   1013 
   1014 const Operator* MachineOperatorBuilder::DebugAbort() {
   1015   return &cache_.kDebugAbort;
   1016 }
   1017 
   1018 const Operator* MachineOperatorBuilder::DebugBreak() {
   1019   return &cache_.kDebugBreak;
   1020 }
   1021 
   1022 const Operator* MachineOperatorBuilder::Comment(const char* msg) {
   1023   return new (zone_) CommentOperator(msg);
   1024 }
   1025 
   1026 const Operator* MachineOperatorBuilder::Word32AtomicLoad(
   1027     LoadRepresentation rep) {
   1028 #define LOAD(Type)                          \
   1029   if (rep == MachineType::Type()) {         \
   1030     return &cache_.kWord32AtomicLoad##Type; \
   1031   }
   1032   ATOMIC_TYPE_LIST(LOAD)
   1033 #undef LOAD
   1034   UNREACHABLE();
   1035 }
   1036 
   1037 const Operator* MachineOperatorBuilder::Word32AtomicStore(
   1038     MachineRepresentation rep) {
   1039 #define STORE(kRep)                          \
   1040   if (rep == MachineRepresentation::kRep) {  \
   1041     return &cache_.kWord32AtomicStore##kRep; \
   1042   }
   1043   ATOMIC_REPRESENTATION_LIST(STORE)
   1044 #undef STORE
   1045   UNREACHABLE();
   1046 }
   1047 
   1048 const Operator* MachineOperatorBuilder::Word32AtomicExchange(MachineType type) {
   1049 #define EXCHANGE(kType)                          \
   1050   if (type == MachineType::kType()) {            \
   1051     return &cache_.kWord32AtomicExchange##kType; \
   1052   }
   1053   ATOMIC_TYPE_LIST(EXCHANGE)
   1054 #undef EXCHANGE
   1055   UNREACHABLE();
   1056 }
   1057 
   1058 const Operator* MachineOperatorBuilder::Word32AtomicCompareExchange(
   1059     MachineType type) {
   1060 #define COMPARE_EXCHANGE(kType)                         \
   1061   if (type == MachineType::kType()) {                   \
   1062     return &cache_.kWord32AtomicCompareExchange##kType; \
   1063   }
   1064   ATOMIC_TYPE_LIST(COMPARE_EXCHANGE)
   1065 #undef COMPARE_EXCHANGE
   1066   UNREACHABLE();
   1067 }
   1068 
   1069 const Operator* MachineOperatorBuilder::Word32AtomicAdd(MachineType type) {
   1070 #define ADD(kType)                          \
   1071   if (type == MachineType::kType()) {       \
   1072     return &cache_.kWord32AtomicAdd##kType; \
   1073   }
   1074   ATOMIC_TYPE_LIST(ADD)
   1075 #undef ADD
   1076   UNREACHABLE();
   1077 }
   1078 
   1079 const Operator* MachineOperatorBuilder::Word32AtomicSub(MachineType type) {
   1080 #define SUB(kType)                          \
   1081   if (type == MachineType::kType()) {       \
   1082     return &cache_.kWord32AtomicSub##kType; \
   1083   }
   1084   ATOMIC_TYPE_LIST(SUB)
   1085 #undef SUB
   1086   UNREACHABLE();
   1087 }
   1088 
   1089 const Operator* MachineOperatorBuilder::Word32AtomicAnd(MachineType type) {
   1090 #define AND(kType)                          \
   1091   if (type == MachineType::kType()) {       \
   1092     return &cache_.kWord32AtomicAnd##kType; \
   1093   }
   1094   ATOMIC_TYPE_LIST(AND)
   1095 #undef AND
   1096   UNREACHABLE();
   1097 }
   1098 
   1099 const Operator* MachineOperatorBuilder::Word32AtomicOr(MachineType type) {
   1100 #define OR(kType)                          \
   1101   if (type == MachineType::kType()) {      \
   1102     return &cache_.kWord32AtomicOr##kType; \
   1103   }
   1104   ATOMIC_TYPE_LIST(OR)
   1105 #undef OR
   1106   UNREACHABLE();
   1107 }
   1108 
   1109 const Operator* MachineOperatorBuilder::Word32AtomicXor(MachineType type) {
   1110 #define XOR(kType)                          \
   1111   if (type == MachineType::kType()) {       \
   1112     return &cache_.kWord32AtomicXor##kType; \
   1113   }
   1114   ATOMIC_TYPE_LIST(XOR)
   1115 #undef XOR
   1116   UNREACHABLE();
   1117 }
   1118 
   1119 const Operator* MachineOperatorBuilder::Word64AtomicLoad(
   1120     LoadRepresentation rep) {
   1121 #define LOAD(Type)                          \
   1122   if (rep == MachineType::Type()) {         \
   1123     return &cache_.kWord64AtomicLoad##Type; \
   1124   }
   1125   ATOMIC_U64_TYPE_LIST(LOAD)
   1126 #undef LOAD
   1127   UNREACHABLE();
   1128 }
   1129 
   1130 const Operator* MachineOperatorBuilder::Word64AtomicStore(
   1131     MachineRepresentation rep) {
   1132 #define STORE(kRep)                          \
   1133   if (rep == MachineRepresentation::kRep) {  \
   1134     return &cache_.kWord64AtomicStore##kRep; \
   1135   }
   1136   ATOMIC64_REPRESENTATION_LIST(STORE)
   1137 #undef STORE
   1138   UNREACHABLE();
   1139 }
   1140 
   1141 const Operator* MachineOperatorBuilder::Word64AtomicAdd(MachineType type) {
   1142 #define ADD(kType)                          \
   1143   if (type == MachineType::kType()) {       \
   1144     return &cache_.kWord64AtomicAdd##kType; \
   1145   }
   1146   ATOMIC_U64_TYPE_LIST(ADD)
   1147 #undef ADD
   1148   UNREACHABLE();
   1149 }
   1150 
   1151 const Operator* MachineOperatorBuilder::Word64AtomicSub(MachineType type) {
   1152 #define SUB(kType)                          \
   1153   if (type == MachineType::kType()) {       \
   1154     return &cache_.kWord64AtomicSub##kType; \
   1155   }
   1156   ATOMIC_U64_TYPE_LIST(SUB)
   1157 #undef SUB
   1158   UNREACHABLE();
   1159 }
   1160 
   1161 const Operator* MachineOperatorBuilder::Word64AtomicAnd(MachineType type) {
   1162 #define AND(kType)                          \
   1163   if (type == MachineType::kType()) {       \
   1164     return &cache_.kWord64AtomicAnd##kType; \
   1165   }
   1166   ATOMIC_U64_TYPE_LIST(AND)
   1167 #undef AND
   1168   UNREACHABLE();
   1169 }
   1170 
   1171 const Operator* MachineOperatorBuilder::Word64AtomicOr(MachineType type) {
   1172 #define OR(kType)                          \
   1173   if (type == MachineType::kType()) {      \
   1174     return &cache_.kWord64AtomicOr##kType; \
   1175   }
   1176   ATOMIC_U64_TYPE_LIST(OR)
   1177 #undef OR
   1178   UNREACHABLE();
   1179 }
   1180 
   1181 const Operator* MachineOperatorBuilder::Word64AtomicXor(MachineType type) {
   1182 #define XOR(kType)                          \
   1183   if (type == MachineType::kType()) {       \
   1184     return &cache_.kWord64AtomicXor##kType; \
   1185   }
   1186   ATOMIC_U64_TYPE_LIST(XOR)
   1187 #undef XOR
   1188   UNREACHABLE();
   1189 }
   1190 
   1191 const Operator* MachineOperatorBuilder::Word64AtomicExchange(MachineType type) {
   1192 #define EXCHANGE(kType)                          \
   1193   if (type == MachineType::kType()) {            \
   1194     return &cache_.kWord64AtomicExchange##kType; \
   1195   }
   1196   ATOMIC_U64_TYPE_LIST(EXCHANGE)
   1197 #undef EXCHANGE
   1198   UNREACHABLE();
   1199 }
   1200 
   1201 const Operator* MachineOperatorBuilder::Word64AtomicCompareExchange(
   1202     MachineType type) {
   1203 #define COMPARE_EXCHANGE(kType)                         \
   1204   if (type == MachineType::kType()) {                   \
   1205     return &cache_.kWord64AtomicCompareExchange##kType; \
   1206   }
   1207   ATOMIC_U64_TYPE_LIST(COMPARE_EXCHANGE)
   1208 #undef COMPARE_EXCHANGE
   1209   UNREACHABLE();
   1210 }
   1211 
   1212 const Operator* MachineOperatorBuilder::Word32AtomicPairLoad() {
   1213   return &cache_.kWord32AtomicPairLoad;
   1214 }
   1215 
   1216 const Operator* MachineOperatorBuilder::Word32AtomicPairStore() {
   1217   return &cache_.kWord32AtomicPairStore;
   1218 }
   1219 
   1220 const Operator* MachineOperatorBuilder::Word32AtomicPairAdd() {
   1221   return &cache_.kWord32AtomicPairAdd;
   1222 }
   1223 
   1224 const Operator* MachineOperatorBuilder::Word32AtomicPairSub() {
   1225   return &cache_.kWord32AtomicPairSub;
   1226 }
   1227 
   1228 const Operator* MachineOperatorBuilder::Word32AtomicPairAnd() {
   1229   return &cache_.kWord32AtomicPairAnd;
   1230 }
   1231 
   1232 const Operator* MachineOperatorBuilder::Word32AtomicPairOr() {
   1233   return &cache_.kWord32AtomicPairOr;
   1234 }
   1235 
   1236 const Operator* MachineOperatorBuilder::Word32AtomicPairXor() {
   1237   return &cache_.kWord32AtomicPairXor;
   1238 }
   1239 
   1240 const Operator* MachineOperatorBuilder::Word32AtomicPairExchange() {
   1241   return &cache_.kWord32AtomicPairExchange;
   1242 }
   1243 
   1244 const Operator* MachineOperatorBuilder::Word32AtomicPairCompareExchange() {
   1245   return &cache_.kWord32AtomicPairCompareExchange;
   1246 }
   1247 
   1248 const Operator* MachineOperatorBuilder::Word64AtomicNarrowAdd(
   1249     MachineType type) {
   1250 #define ADD(kType)                                \
   1251   if (type == MachineType::kType()) {             \
   1252     return &cache_.kWord64AtomicNarrowAdd##kType; \
   1253   }
   1254   ATOMIC_U32_TYPE_LIST(ADD)
   1255 #undef ADD
   1256   UNREACHABLE();
   1257 }
   1258 
   1259 const Operator* MachineOperatorBuilder::Word64AtomicNarrowSub(
   1260     MachineType type) {
   1261 #define SUB(kType)                                \
   1262   if (type == MachineType::kType()) {             \
   1263     return &cache_.kWord64AtomicNarrowSub##kType; \
   1264   }
   1265   ATOMIC_U32_TYPE_LIST(SUB)
   1266 #undef SUB
   1267   UNREACHABLE();
   1268 }
   1269 
   1270 const Operator* MachineOperatorBuilder::Word64AtomicNarrowAnd(
   1271     MachineType type) {
   1272 #define AND(kType)                                \
   1273   if (type == MachineType::kType()) {             \
   1274     return &cache_.kWord64AtomicNarrowAnd##kType; \
   1275   }
   1276   ATOMIC_U32_TYPE_LIST(AND)
   1277 #undef AND
   1278   UNREACHABLE();
   1279 }
   1280 
   1281 const Operator* MachineOperatorBuilder::Word64AtomicNarrowOr(MachineType type) {
   1282 #define OR(kType)                                \
   1283   if (type == MachineType::kType()) {            \
   1284     return &cache_.kWord64AtomicNarrowOr##kType; \
   1285   }
   1286   ATOMIC_U32_TYPE_LIST(OR)
   1287 #undef OR
   1288   UNREACHABLE();
   1289 }
   1290 
   1291 const Operator* MachineOperatorBuilder::Word64AtomicNarrowXor(
   1292     MachineType type) {
   1293 #define XOR(kType)                                \
   1294   if (type == MachineType::kType()) {             \
   1295     return &cache_.kWord64AtomicNarrowXor##kType; \
   1296   }
   1297   ATOMIC_U32_TYPE_LIST(XOR)
   1298 #undef XOR
   1299   UNREACHABLE();
   1300 }
   1301 
   1302 const Operator* MachineOperatorBuilder::Word64AtomicNarrowExchange(
   1303     MachineType type) {
   1304 #define EXCHANGE(kType)                                \
   1305   if (type == MachineType::kType()) {                  \
   1306     return &cache_.kWord64AtomicNarrowExchange##kType; \
   1307   }
   1308   ATOMIC_U32_TYPE_LIST(EXCHANGE)
   1309 #undef EXCHANGE
   1310   UNREACHABLE();
   1311 }
   1312 
   1313 const Operator* MachineOperatorBuilder::Word64AtomicNarrowCompareExchange(
   1314     MachineType type) {
   1315 #define CMP_EXCHANGE(kType)                                   \
   1316   if (type == MachineType::kType()) {                         \
   1317     return &cache_.kWord64AtomicNarrowCompareExchange##kType; \
   1318   }
   1319   ATOMIC_U32_TYPE_LIST(CMP_EXCHANGE)
   1320 #undef CMP_EXCHANGE
   1321   UNREACHABLE();
   1322 }
   1323 
   1324 const Operator* MachineOperatorBuilder::TaggedPoisonOnSpeculation() {
   1325   return &cache_.kTaggedPoisonOnSpeculation;
   1326 }
   1327 
   1328 const Operator* MachineOperatorBuilder::Word32PoisonOnSpeculation() {
   1329   return &cache_.kWord32PoisonOnSpeculation;
   1330 }
   1331 
   1332 const Operator* MachineOperatorBuilder::Word64PoisonOnSpeculation() {
   1333   return &cache_.kWord64PoisonOnSpeculation;
   1334 }
   1335 
   1336 const OptionalOperator MachineOperatorBuilder::SpeculationFence() {
   1337   return OptionalOperator(flags_ & kSpeculationFence,
   1338                           &cache_.kSpeculationFence);
   1339 }
   1340 
   1341 #define SIMD_LANE_OPS(Type, lane_count)                                     \
   1342   const Operator* MachineOperatorBuilder::Type##ExtractLane(                \
   1343       int32_t lane_index) {                                                 \
   1344     DCHECK(0 <= lane_index && lane_index < lane_count);                     \
   1345     return new (zone_)                                                      \
   1346         Operator1<int32_t>(IrOpcode::k##Type##ExtractLane, Operator::kPure, \
   1347                            "Extract lane", 1, 0, 0, 1, 0, 0, lane_index);   \
   1348   }                                                                         \
   1349   const Operator* MachineOperatorBuilder::Type##ReplaceLane(                \
   1350       int32_t lane_index) {                                                 \
   1351     DCHECK(0 <= lane_index && lane_index < lane_count);                     \
   1352     return new (zone_)                                                      \
   1353         Operator1<int32_t>(IrOpcode::k##Type##ReplaceLane, Operator::kPure, \
   1354                            "Replace lane", 2, 0, 0, 1, 0, 0, lane_index);   \
   1355   }
   1356 SIMD_LANE_OP_LIST(SIMD_LANE_OPS)
   1357 #undef SIMD_LANE_OPS
   1358 
   1359 #define SIMD_SHIFT_OPS(format, bits)                                           \
   1360   const Operator* MachineOperatorBuilder::I##format##Shl(int32_t shift) {      \
   1361     DCHECK(0 <= shift && shift < bits);                                        \
   1362     return new (zone_)                                                         \
   1363         Operator1<int32_t>(IrOpcode::kI##format##Shl, Operator::kPure,         \
   1364                            "Shift left", 1, 0, 0, 1, 0, 0, shift);             \
   1365   }                                                                            \
   1366   const Operator* MachineOperatorBuilder::I##format##ShrS(int32_t shift) {     \
   1367     DCHECK(0 < shift && shift <= bits);                                        \
   1368     return new (zone_)                                                         \
   1369         Operator1<int32_t>(IrOpcode::kI##format##ShrS, Operator::kPure,        \
   1370                            "Arithmetic shift right", 1, 0, 0, 1, 0, 0, shift); \
   1371   }                                                                            \
   1372   const Operator* MachineOperatorBuilder::I##format##ShrU(int32_t shift) {     \
   1373     DCHECK(0 <= shift && shift < bits);                                        \
   1374     return new (zone_)                                                         \
   1375         Operator1<int32_t>(IrOpcode::kI##format##ShrU, Operator::kPure,        \
   1376                            "Shift right", 1, 0, 0, 1, 0, 0, shift);            \
   1377   }
   1378 SIMD_FORMAT_LIST(SIMD_SHIFT_OPS)
   1379 #undef SIMD_SHIFT_OPS
   1380 
   1381 const Operator* MachineOperatorBuilder::S8x16Shuffle(
   1382     const uint8_t shuffle[16]) {
   1383   uint8_t* array = zone_->NewArray<uint8_t>(16);
   1384   memcpy(array, shuffle, 16);
   1385   return new (zone_)
   1386       Operator1<uint8_t*>(IrOpcode::kS8x16Shuffle, Operator::kPure, "Shuffle",
   1387                           2, 0, 0, 1, 0, 0, array);
   1388 }
   1389 
   1390 #undef PURE_BINARY_OP_LIST_32
   1391 #undef PURE_BINARY_OP_LIST_64
   1392 #undef MACHINE_PURE_OP_LIST
   1393 #undef PURE_OPTIONAL_OP_LIST
   1394 #undef OVERFLOW_OP_LIST
   1395 #undef MACHINE_TYPE_LIST
   1396 #undef MACHINE_REPRESENTATION_LIST
   1397 #undef ATOMIC_TYPE_LIST
   1398 #undef ATOMIC_U64_TYPE_LIST
   1399 #undef ATOMIC_U32_TYPE_LIST
   1400 #undef ATOMIC_REPRESENTATION_LIST
   1401 #undef ATOMIC64_REPRESENTATION_LIST
   1402 #undef SIMD_LANE_OP_LIST
   1403 #undef SIMD_FORMAT_LIST
   1404 #undef STACK_SLOT_CACHED_SIZES_ALIGNMENTS_LIST
   1405 
   1406 }  // namespace compiler
   1407 }  // namespace internal
   1408 }  // namespace v8
   1409