LCOV - code coverage report
Current view: top level - src/compiler - common-operator.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 318 417 76.3 %
Date: 2019-04-17 Functions: 238 523 45.5 %

          Line data    Source code
       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/common-operator.h"
       6             : 
       7             : #include "src/base/lazy-instance.h"
       8             : #include "src/compiler/linkage.h"
       9             : #include "src/compiler/node.h"
      10             : #include "src/compiler/opcodes.h"
      11             : #include "src/compiler/operator.h"
      12             : #include "src/handles-inl.h"
      13             : #include "src/zone/zone.h"
      14             : 
      15             : namespace v8 {
      16             : namespace internal {
      17             : namespace compiler {
      18             : 
      19          91 : std::ostream& operator<<(std::ostream& os, BranchHint hint) {
      20          91 :   switch (hint) {
      21             :     case BranchHint::kNone:
      22          25 :       return os << "None";
      23             :     case BranchHint::kTrue:
      24          49 :       return os << "True";
      25             :     case BranchHint::kFalse:
      26          17 :       return os << "False";
      27             :   }
      28           0 :   UNREACHABLE();
      29             : }
      30             : 
      31         112 : std::ostream& operator<<(std::ostream& os, IsSafetyCheck is_safety_check) {
      32         112 :   switch (is_safety_check) {
      33             :     case IsSafetyCheck::kCriticalSafetyCheck:
      34           0 :       return os << "CriticalSafetyCheck";
      35             :     case IsSafetyCheck::kSafetyCheck:
      36         104 :       return os << "SafetyCheck";
      37             :     case IsSafetyCheck::kNoSafetyCheck:
      38           8 :       return os << "NoSafetyCheck";
      39             :   }
      40           0 :   UNREACHABLE();
      41             : }
      42             : 
      43           0 : std::ostream& operator<<(std::ostream& os, TrapId trap_id) {
      44           0 :   switch (trap_id) {
      45             : #define TRAP_CASE(Name) \
      46             :   case TrapId::k##Name: \
      47             :     return os << #Name;
      48           0 :     FOREACH_WASM_TRAPREASON(TRAP_CASE)
      49             : #undef TRAP_CASE
      50             :     case TrapId::kInvalid:
      51           0 :       return os << "Invalid";
      52             :   }
      53           0 :   UNREACHABLE();
      54             : }
      55             : 
      56      142030 : TrapId TrapIdOf(const Operator* const op) {
      57             :   DCHECK(op->opcode() == IrOpcode::kTrapIf ||
      58             :          op->opcode() == IrOpcode::kTrapUnless);
      59      142030 :   return OpParameter<TrapId>(op);
      60             : }
      61             : 
      62          40 : std::ostream& operator<<(std::ostream& os, BranchOperatorInfo info) {
      63          80 :   return os << info.hint << "|" << info.is_safety_check;
      64             : }
      65             : 
      66      890556 : const BranchOperatorInfo& BranchOperatorInfoOf(const Operator* const op) {
      67             :   DCHECK_EQ(IrOpcode::kBranch, op->opcode());
      68      890556 :   return OpParameter<BranchOperatorInfo>(op);
      69             : }
      70             : 
      71     7480715 : BranchHint BranchHintOf(const Operator* const op) {
      72     7480715 :   switch (op->opcode()) {
      73             :     case IrOpcode::kBranch:
      74     7114093 :       return BranchOperatorInfoOf(op).hint;
      75             :     case IrOpcode::kIfValue:
      76      328320 :       return IfValueParametersOf(op).hint();
      77             :     case IrOpcode::kIfDefault:
      78       38302 :       return OpParameter<BranchHint>(op);
      79             :     default:
      80           0 :       UNREACHABLE();
      81             :   }
      82             : }
      83             : 
      84     3727108 : int ValueInputCountOfReturn(Operator const* const op) {
      85             :   DCHECK_EQ(IrOpcode::kReturn, op->opcode());
      86             :   // Return nodes have a hidden input at index 0 which we ignore in the value
      87             :   // input count.
      88     3727108 :   return op->ValueInputCount() - 1;
      89             : }
      90             : 
      91           0 : bool operator==(DeoptimizeParameters lhs, DeoptimizeParameters rhs) {
      92           0 :   return lhs.kind() == rhs.kind() && lhs.reason() == rhs.reason() &&
      93           0 :          lhs.feedback() == rhs.feedback() &&
      94           0 :          lhs.is_safety_check() == rhs.is_safety_check();
      95             : }
      96             : 
      97           0 : bool operator!=(DeoptimizeParameters lhs, DeoptimizeParameters rhs) {
      98           0 :   return !(lhs == rhs);
      99             : }
     100             : 
     101           0 : size_t hash_value(DeoptimizeParameters p) {
     102             :   return base::hash_combine(p.kind(), p.reason(), p.feedback(),
     103           0 :                             p.is_safety_check());
     104             : }
     105             : 
     106          72 : std::ostream& operator<<(std::ostream& os, DeoptimizeParameters p) {
     107         216 :   os << p.kind() << ":" << p.reason() << ":" << p.is_safety_check();
     108          72 :   if (p.feedback().IsValid()) {
     109           0 :     os << "; " << p.feedback();
     110             :   }
     111          72 :   return os;
     112             : }
     113             : 
     114     1510147 : DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const op) {
     115             :   DCHECK(op->opcode() == IrOpcode::kDeoptimize ||
     116             :          op->opcode() == IrOpcode::kDeoptimizeIf ||
     117             :          op->opcode() == IrOpcode::kDeoptimizeUnless);
     118     1510147 :   return OpParameter<DeoptimizeParameters>(op);
     119             : }
     120             : 
     121     5415507 : IsSafetyCheck IsSafetyCheckOf(const Operator* op) {
     122     5415507 :   if (op->opcode() == IrOpcode::kBranch) {
     123     5408646 :     return BranchOperatorInfoOf(op).is_safety_check;
     124             :   }
     125        6861 :   return DeoptimizeParametersOf(op).is_safety_check();
     126             : }
     127             : 
     128        3934 : const Operator* CommonOperatorBuilder::MarkAsSafetyCheck(
     129             :     const Operator* op, IsSafetyCheck safety_check) {
     130        3934 :   if (op->opcode() == IrOpcode::kBranch) {
     131        3782 :     BranchOperatorInfo info = BranchOperatorInfoOf(op);
     132        3782 :     if (info.is_safety_check == safety_check) return op;
     133        3782 :     return Branch(info.hint, safety_check);
     134             :   }
     135         152 :   DeoptimizeParameters p = DeoptimizeParametersOf(op);
     136         152 :   if (p.is_safety_check() == safety_check) return op;
     137         152 :   switch (op->opcode()) {
     138             :     case IrOpcode::kDeoptimizeIf:
     139           0 :       return DeoptimizeIf(p.kind(), p.reason(), p.feedback(), safety_check);
     140             :     case IrOpcode::kDeoptimizeUnless:
     141         152 :       return DeoptimizeUnless(p.kind(), p.reason(), p.feedback(), safety_check);
     142             :     default:
     143           0 :       UNREACHABLE();
     144             :   }
     145             : }
     146             : 
     147        5039 : const Operator* CommonOperatorBuilder::DelayedStringConstant(
     148             :     const StringConstantBase* str) {
     149             :   return new (zone()) Operator1<const StringConstantBase*>(
     150             :       IrOpcode::kDelayedStringConstant, Operator::kPure,
     151        5039 :       "DelayedStringConstant", 0, 0, 0, 1, 0, 0, str);
     152             : }
     153             : 
     154           0 : bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
     155        1662 :   return lhs.representation() == rhs.representation() &&
     156           0 :          lhs.hint() == rhs.hint();
     157             : }
     158             : 
     159             : 
     160           0 : bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) {
     161           0 :   return !(lhs == rhs);
     162             : }
     163             : 
     164             : 
     165       45474 : size_t hash_value(SelectParameters const& p) {
     166       45474 :   return base::hash_combine(p.representation(), p.hint());
     167             : }
     168             : 
     169             : 
     170           0 : std::ostream& operator<<(std::ostream& os, SelectParameters const& p) {
     171           0 :   return os << p.representation() << "|" << p.hint();
     172             : }
     173             : 
     174             : 
     175       31049 : SelectParameters const& SelectParametersOf(const Operator* const op) {
     176             :   DCHECK_EQ(IrOpcode::kSelect, op->opcode());
     177       31049 :   return OpParameter<SelectParameters>(op);
     178             : }
     179             : 
     180    10571363 : CallDescriptor const* CallDescriptorOf(const Operator* const op) {
     181             :   DCHECK(op->opcode() == IrOpcode::kCall ||
     182             :          op->opcode() == IrOpcode::kCallWithCallerSavedRegisters ||
     183             :          op->opcode() == IrOpcode::kTailCall);
     184    10571363 :   return OpParameter<CallDescriptor const*>(op);
     185             : }
     186             : 
     187     1023984 : size_t ProjectionIndexOf(const Operator* const op) {
     188             :   DCHECK_EQ(IrOpcode::kProjection, op->opcode());
     189     1023984 :   return OpParameter<size_t>(op);
     190             : }
     191             : 
     192             : 
     193     6321941 : MachineRepresentation PhiRepresentationOf(const Operator* const op) {
     194             :   DCHECK_EQ(IrOpcode::kPhi, op->opcode());
     195     6735394 :   return OpParameter<MachineRepresentation>(op);
     196             : }
     197             : 
     198             : 
     199    12615421 : int ParameterIndexOf(const Operator* const op) {
     200             :   DCHECK_EQ(IrOpcode::kParameter, op->opcode());
     201    12615421 :   return OpParameter<ParameterInfo>(op).index();
     202             : }
     203             : 
     204             : 
     205           0 : const ParameterInfo& ParameterInfoOf(const Operator* const op) {
     206             :   DCHECK_EQ(IrOpcode::kParameter, op->opcode());
     207           0 :   return OpParameter<ParameterInfo>(op);
     208             : }
     209             : 
     210             : 
     211           0 : bool operator==(ParameterInfo const& lhs, ParameterInfo const& rhs) {
     212     8838719 :   return lhs.index() == rhs.index();
     213             : }
     214             : 
     215             : 
     216           0 : bool operator!=(ParameterInfo const& lhs, ParameterInfo const& rhs) {
     217           0 :   return !(lhs == rhs);
     218             : }
     219             : 
     220             : 
     221    13673630 : size_t hash_value(ParameterInfo const& p) { return p.index(); }
     222             : 
     223             : 
     224         535 : std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
     225         535 :   if (i.debug_name()) os << i.debug_name() << '#';
     226         535 :   os << i.index();
     227         535 :   return os;
     228             : }
     229             : 
     230           0 : std::ostream& operator<<(std::ostream& os, ObjectStateInfo const& i) {
     231           0 :   return os << "id:" << i.object_id() << "|size:" << i.size();
     232             : }
     233             : 
     234      135237 : size_t hash_value(ObjectStateInfo const& p) {
     235      135237 :   return base::hash_combine(p.object_id(), p.size());
     236             : }
     237             : 
     238           0 : std::ostream& operator<<(std::ostream& os, TypedObjectStateInfo const& i) {
     239           0 :   return os << "id:" << i.object_id() << "|" << i.machine_types();
     240             : }
     241             : 
     242       76827 : size_t hash_value(TypedObjectStateInfo const& p) {
     243       76827 :   return base::hash_combine(p.object_id(), p.machine_types());
     244             : }
     245             : 
     246           0 : bool operator==(RelocatablePtrConstantInfo const& lhs,
     247             :                 RelocatablePtrConstantInfo const& rhs) {
     248         241 :   return lhs.rmode() == rhs.rmode() && lhs.value() == rhs.value() &&
     249           0 :          lhs.type() == rhs.type();
     250             : }
     251             : 
     252           0 : bool operator!=(RelocatablePtrConstantInfo const& lhs,
     253             :                 RelocatablePtrConstantInfo const& rhs) {
     254           0 :   return !(lhs == rhs);
     255             : }
     256             : 
     257      146408 : size_t hash_value(RelocatablePtrConstantInfo const& p) {
     258      146624 :   return base::hash_combine(p.value(), int8_t{p.rmode()}, p.type());
     259             : }
     260             : 
     261           0 : std::ostream& operator<<(std::ostream& os,
     262             :                          RelocatablePtrConstantInfo const& p) {
     263           0 :   return os << p.value() << "|" << p.rmode() << "|" << p.type();
     264             : }
     265             : 
     266           0 : SparseInputMask::InputIterator::InputIterator(
     267             :     SparseInputMask::BitMaskType bit_mask, Node* parent)
     268    23212405 :     : bit_mask_(bit_mask), parent_(parent), real_index_(0) {
     269             : #if DEBUG
     270             :   if (bit_mask_ != SparseInputMask::kDenseBitMask) {
     271             :     DCHECK_EQ(base::bits::CountPopulation(bit_mask_) -
     272             :                   base::bits::CountPopulation(kEndMarker),
     273             :               parent->InputCount());
     274             :   }
     275             : #endif
     276           0 : }
     277             : 
     278    86423110 : void SparseInputMask::InputIterator::Advance() {
     279             :   DCHECK(!IsEnd());
     280             : 
     281    86423110 :   if (IsReal()) {
     282    30869885 :     ++real_index_;
     283             :   }
     284    86423110 :   bit_mask_ >>= 1;
     285    86423110 : }
     286             : 
     287    45791984 : Node* SparseInputMask::InputIterator::GetReal() const {
     288             :   DCHECK(IsReal());
     289    91583968 :   return parent_->InputAt(real_index_);
     290             : }
     291             : 
     292   183378642 : bool SparseInputMask::InputIterator::IsReal() const {
     293   480454664 :   return bit_mask_ == SparseInputMask::kDenseBitMask ||
     294   394031554 :          (bit_mask_ & kEntryMask);
     295             : }
     296             : 
     297    81846932 : bool SparseInputMask::InputIterator::IsEnd() const {
     298    81846932 :   return (bit_mask_ == kEndMarker) ||
     299    27035309 :          (bit_mask_ == SparseInputMask::kDenseBitMask &&
     300   108882241 :           real_index_ >= parent_->InputCount());
     301             : }
     302             : 
     303           0 : int SparseInputMask::CountReal() const {
     304             :   DCHECK(!IsDense());
     305           0 :   return base::bits::CountPopulation(bit_mask_) -
     306           0 :          base::bits::CountPopulation(kEndMarker);
     307             : }
     308             : 
     309    23212405 : SparseInputMask::InputIterator SparseInputMask::IterateOverInputs(Node* node) {
     310             :   DCHECK(IsDense() || CountReal() == node->InputCount());
     311    46424810 :   return InputIterator(bit_mask_, node);
     312             : }
     313             : 
     314           0 : bool operator==(SparseInputMask const& lhs, SparseInputMask const& rhs) {
     315     1433573 :   return lhs.mask() == rhs.mask();
     316             : }
     317             : 
     318     5972565 : bool operator!=(SparseInputMask const& lhs, SparseInputMask const& rhs) {
     319     5972565 :   return !(lhs == rhs);
     320             : }
     321             : 
     322           0 : size_t hash_value(SparseInputMask const& p) {
     323    30723807 :   return base::hash_value(p.mask());
     324             : }
     325             : 
     326         153 : std::ostream& operator<<(std::ostream& os, SparseInputMask const& p) {
     327         153 :   if (p.IsDense()) {
     328         118 :     return os << "dense";
     329             :   } else {
     330             :     SparseInputMask::BitMaskType mask = p.mask();
     331             :     DCHECK_NE(mask, SparseInputMask::kDenseBitMask);
     332             : 
     333          35 :     os << "sparse:";
     334             : 
     335         105 :     while (mask != SparseInputMask::kEndMarker) {
     336          35 :       if (mask & SparseInputMask::kEntryMask) {
     337           0 :         os << "^";
     338             :       } else {
     339          35 :         os << ".";
     340             :       }
     341          35 :       mask >>= 1;
     342             :     }
     343             :     return os;
     344             :   }
     345             : }
     346             : 
     347           0 : bool operator==(TypedStateValueInfo const& lhs,
     348             :                 TypedStateValueInfo const& rhs) {
     349     2515001 :   return lhs.machine_types() == rhs.machine_types() &&
     350           0 :          lhs.sparse_input_mask() == rhs.sparse_input_mask();
     351             : }
     352             : 
     353           0 : bool operator!=(TypedStateValueInfo const& lhs,
     354             :                 TypedStateValueInfo const& rhs) {
     355           0 :   return !(lhs == rhs);
     356             : }
     357             : 
     358    12693689 : size_t hash_value(TypedStateValueInfo const& p) {
     359    12693693 :   return base::hash_combine(p.machine_types(), p.sparse_input_mask());
     360             : }
     361             : 
     362         105 : std::ostream& operator<<(std::ostream& os, TypedStateValueInfo const& p) {
     363         210 :   return os << p.machine_types() << "|" << p.sparse_input_mask();
     364             : }
     365             : 
     366           0 : size_t hash_value(RegionObservability observability) {
     367           0 :   return static_cast<size_t>(observability);
     368             : }
     369             : 
     370           0 : std::ostream& operator<<(std::ostream& os, RegionObservability observability) {
     371           0 :   switch (observability) {
     372             :     case RegionObservability::kObservable:
     373           0 :       return os << "observable";
     374             :     case RegionObservability::kNotObservable:
     375           0 :       return os << "not-observable";
     376             :   }
     377           0 :   UNREACHABLE();
     378             : }
     379             : 
     380      133633 : RegionObservability RegionObservabilityOf(Operator const* op) {
     381             :   DCHECK_EQ(IrOpcode::kBeginRegion, op->opcode());
     382      133633 :   return OpParameter<RegionObservability>(op);
     383             : }
     384             : 
     385      100220 : Type TypeGuardTypeOf(Operator const* op) {
     386             :   DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode());
     387      100220 :   return OpParameter<Type>(op);
     388             : }
     389             : 
     390         105 : std::ostream& operator<<(std::ostream& os,
     391             :                          const ZoneVector<MachineType>* types) {
     392             :   // Print all the MachineTypes, separated by commas.
     393             :   bool first = true;
     394         210 :   for (MachineType elem : *types) {
     395         105 :     if (!first) {
     396          70 :       os << ", ";
     397             :     }
     398             :     first = false;
     399         105 :     os << elem;
     400             :   }
     401         105 :   return os;
     402             : }
     403             : 
     404       21446 : int OsrValueIndexOf(Operator const* op) {
     405             :   DCHECK_EQ(IrOpcode::kOsrValue, op->opcode());
     406       21446 :   return OpParameter<int>(op);
     407             : }
     408             : 
     409    32162557 : SparseInputMask SparseInputMaskOf(Operator const* op) {
     410             :   DCHECK(op->opcode() == IrOpcode::kStateValues ||
     411             :          op->opcode() == IrOpcode::kTypedStateValues);
     412             : 
     413    32162557 :   if (op->opcode() == IrOpcode::kTypedStateValues) {
     414             :     return OpParameter<TypedStateValueInfo>(op).sparse_input_mask();
     415             :   }
     416     8958214 :   return OpParameter<SparseInputMask>(op);
     417             : }
     418             : 
     419    14962656 : ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) {
     420             :   DCHECK(op->opcode() == IrOpcode::kTypedObjectState ||
     421             :          op->opcode() == IrOpcode::kTypedStateValues);
     422             : 
     423    14962656 :   if (op->opcode() == IrOpcode::kTypedStateValues) {
     424    14873616 :     return OpParameter<TypedStateValueInfo>(op).machine_types();
     425             :   }
     426       89040 :   return OpParameter<TypedObjectStateInfo>(op).machine_types();
     427             : }
     428             : 
     429       10004 : V8_EXPORT_PRIVATE bool operator==(IfValueParameters const& l,
     430             :                                   IfValueParameters const& r) {
     431             :   return l.value() == r.value() &&
     432       10004 :          r.comparison_order() == r.comparison_order() && l.hint() == r.hint();
     433             : }
     434             : 
     435           0 : size_t hash_value(IfValueParameters const& p) {
     436           0 :   return base::hash_combine(p.value(), p.comparison_order(), p.hint());
     437             : }
     438             : 
     439           0 : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
     440             :                                            IfValueParameters const& p) {
     441           0 :   out << p.value() << " (order " << p.comparison_order() << ", hint "
     442           0 :       << p.hint() << ")";
     443           0 :   return out;
     444             : }
     445             : 
     446     1983323 : IfValueParameters const& IfValueParametersOf(const Operator* op) {
     447             :   DCHECK(op->opcode() == IrOpcode::kIfValue);
     448     1983323 :   return OpParameter<IfValueParameters>(op);
     449             : }
     450             : 
     451             : #define COMMON_CACHED_OP_LIST(V)                                              \
     452             :   V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1)                              \
     453             :   V(Unreachable, Operator::kFoldable, 0, 1, 1, 1, 1, 0)                       \
     454             :   V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1)                             \
     455             :   V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1)                            \
     456             :   V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1)                          \
     457             :   V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1)                        \
     458             :   V(Throw, Operator::kKontrol, 0, 1, 1, 0, 0, 1)                              \
     459             :   V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1)                          \
     460             :   V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1)                    \
     461             :   V(OsrLoopEntry, Operator::kFoldable | Operator::kNoThrow, 0, 1, 1, 0, 1, 1) \
     462             :   V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1)                           \
     463             :   V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0)                         \
     464             :   V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0)                     \
     465             :   V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0)                         \
     466             :   V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0)                       \
     467             :   V(Retain, Operator::kKontrol, 1, 1, 0, 0, 1, 0)
     468             : 
     469             : #define CACHED_BRANCH_LIST(V)   \
     470             :   V(None, CriticalSafetyCheck)  \
     471             :   V(True, CriticalSafetyCheck)  \
     472             :   V(False, CriticalSafetyCheck) \
     473             :   V(None, SafetyCheck)          \
     474             :   V(True, SafetyCheck)          \
     475             :   V(False, SafetyCheck)         \
     476             :   V(None, NoSafetyCheck)        \
     477             :   V(True, NoSafetyCheck)        \
     478             :   V(False, NoSafetyCheck)
     479             : 
     480             : #define CACHED_RETURN_LIST(V) \
     481             :   V(1)                        \
     482             :   V(2)                        \
     483             :   V(3)                        \
     484             :   V(4)
     485             : 
     486             : #define CACHED_END_LIST(V) \
     487             :   V(1)                     \
     488             :   V(2)                     \
     489             :   V(3)                     \
     490             :   V(4)                     \
     491             :   V(5)                     \
     492             :   V(6)                     \
     493             :   V(7)                     \
     494             :   V(8)
     495             : 
     496             : 
     497             : #define CACHED_EFFECT_PHI_LIST(V) \
     498             :   V(1)                            \
     499             :   V(2)                            \
     500             :   V(3)                            \
     501             :   V(4)                            \
     502             :   V(5)                            \
     503             :   V(6)
     504             : 
     505             : #define CACHED_INDUCTION_VARIABLE_PHI_LIST(V) \
     506             :   V(4)                                        \
     507             :   V(5)                                        \
     508             :   V(6)                                        \
     509             :   V(7)
     510             : 
     511             : #define CACHED_LOOP_LIST(V) \
     512             :   V(1)                      \
     513             :   V(2)
     514             : 
     515             : 
     516             : #define CACHED_MERGE_LIST(V) \
     517             :   V(1)                       \
     518             :   V(2)                       \
     519             :   V(3)                       \
     520             :   V(4)                       \
     521             :   V(5)                       \
     522             :   V(6)                       \
     523             :   V(7)                       \
     524             :   V(8)
     525             : 
     526             : #define CACHED_DEOPTIMIZE_LIST(V)                        \
     527             :   V(Eager, MinusZero)                                    \
     528             :   V(Eager, WrongMap)                                     \
     529             :   V(Soft, InsufficientTypeFeedbackForGenericKeyedAccess) \
     530             :   V(Soft, InsufficientTypeFeedbackForGenericNamedAccess)
     531             : 
     532             : #define CACHED_DEOPTIMIZE_IF_LIST(V)      \
     533             :   V(Eager, DivisionByZero, NoSafetyCheck) \
     534             :   V(Eager, DivisionByZero, SafetyCheck)   \
     535             :   V(Eager, Hole, NoSafetyCheck)           \
     536             :   V(Eager, Hole, SafetyCheck)             \
     537             :   V(Eager, MinusZero, NoSafetyCheck)      \
     538             :   V(Eager, MinusZero, SafetyCheck)        \
     539             :   V(Eager, Overflow, NoSafetyCheck)       \
     540             :   V(Eager, Overflow, SafetyCheck)         \
     541             :   V(Eager, Smi, SafetyCheck)
     542             : 
     543             : #define CACHED_DEOPTIMIZE_UNLESS_LIST(V)      \
     544             :   V(Eager, LostPrecision, NoSafetyCheck)      \
     545             :   V(Eager, LostPrecision, SafetyCheck)        \
     546             :   V(Eager, LostPrecisionOrNaN, NoSafetyCheck) \
     547             :   V(Eager, LostPrecisionOrNaN, SafetyCheck)   \
     548             :   V(Eager, NotAHeapNumber, SafetyCheck)       \
     549             :   V(Eager, NotANumberOrOddball, SafetyCheck)  \
     550             :   V(Eager, NotASmi, SafetyCheck)              \
     551             :   V(Eager, OutOfBounds, SafetyCheck)          \
     552             :   V(Eager, WrongInstanceType, SafetyCheck)    \
     553             :   V(Eager, WrongMap, SafetyCheck)
     554             : 
     555             : #define CACHED_TRAP_IF_LIST(V) \
     556             :   V(TrapDivUnrepresentable)    \
     557             :   V(TrapFloatUnrepresentable)
     558             : 
     559             : // The reason for a trap.
     560             : #define CACHED_TRAP_UNLESS_LIST(V) \
     561             :   V(TrapUnreachable)               \
     562             :   V(TrapMemOutOfBounds)            \
     563             :   V(TrapDivByZero)                 \
     564             :   V(TrapDivUnrepresentable)        \
     565             :   V(TrapRemByZero)                 \
     566             :   V(TrapFloatUnrepresentable)      \
     567             :   V(TrapFuncInvalid)               \
     568             :   V(TrapFuncSigMismatch)
     569             : 
     570             : #define CACHED_PARAMETER_LIST(V) \
     571             :   V(0)                           \
     572             :   V(1)                           \
     573             :   V(2)                           \
     574             :   V(3)                           \
     575             :   V(4)                           \
     576             :   V(5)                           \
     577             :   V(6)
     578             : 
     579             : 
     580             : #define CACHED_PHI_LIST(V) \
     581             :   V(kTagged, 1)            \
     582             :   V(kTagged, 2)            \
     583             :   V(kTagged, 3)            \
     584             :   V(kTagged, 4)            \
     585             :   V(kTagged, 5)            \
     586             :   V(kTagged, 6)            \
     587             :   V(kBit, 2)               \
     588             :   V(kFloat64, 2)           \
     589             :   V(kWord32, 2)
     590             : 
     591             : 
     592             : #define CACHED_PROJECTION_LIST(V) \
     593             :   V(0)                            \
     594             :   V(1)
     595             : 
     596             : 
     597             : #define CACHED_STATE_VALUES_LIST(V) \
     598             :   V(0)                              \
     599             :   V(1)                              \
     600             :   V(2)                              \
     601             :   V(3)                              \
     602             :   V(4)                              \
     603             :   V(5)                              \
     604             :   V(6)                              \
     605             :   V(7)                              \
     606             :   V(8)                              \
     607             :   V(10)                             \
     608             :   V(11)                             \
     609             :   V(12)                             \
     610             :   V(13)                             \
     611             :   V(14)
     612             : 
     613             : 
     614       29744 : struct CommonOperatorGlobalCache final {
     615             : #define CACHED(Name, properties, value_input_count, effect_input_count,      \
     616             :                control_input_count, value_output_count, effect_output_count, \
     617             :                control_output_count)                                         \
     618             :   struct Name##Operator final : public Operator {                            \
     619             :     Name##Operator()                                                         \
     620             :         : Operator(IrOpcode::k##Name, properties, #Name, value_input_count,  \
     621             :                    effect_input_count, control_input_count,                  \
     622             :                    value_output_count, effect_output_count,                  \
     623             :                    control_output_count) {}                                  \
     624             :   };                                                                         \
     625             :   Name##Operator k##Name##Operator;
     626      922064 :   COMMON_CACHED_OP_LIST(CACHED)
     627             : #undef CACHED
     628             : 
     629             :   template <size_t kInputCount>
     630           0 :   struct EndOperator final : public Operator {
     631      237952 :     EndOperator()
     632             :         : Operator(                                // --
     633             :               IrOpcode::kEnd, Operator::kKontrol,  // opcode
     634             :               "End",                               // name
     635      237952 :               0, 0, kInputCount, 0, 0, 0) {}       // counts
     636             :   };
     637             : #define CACHED_END(input_count) \
     638             :   EndOperator<input_count> kEnd##input_count##Operator;
     639             :   CACHED_END_LIST(CACHED_END)
     640             : #undef CACHED_END
     641             : 
     642             :   template <size_t kValueInputCount>
     643           0 :   struct ReturnOperator final : public Operator {
     644      118976 :     ReturnOperator()
     645             :         : Operator(                                    // --
     646             :               IrOpcode::kReturn, Operator::kNoThrow,   // opcode
     647             :               "Return",                                // name
     648      118976 :               kValueInputCount + 1, 1, 1, 0, 0, 1) {}  // counts
     649             :   };
     650             : #define CACHED_RETURN(value_input_count) \
     651             :   ReturnOperator<value_input_count> kReturn##value_input_count##Operator;
     652             :   CACHED_RETURN_LIST(CACHED_RETURN)
     653             : #undef CACHED_RETURN
     654             : 
     655             :   template <BranchHint hint, IsSafetyCheck is_safety_check>
     656           0 :   struct BranchOperator final : public Operator1<BranchOperatorInfo> {
     657      267696 :     BranchOperator()
     658             :         : Operator1<BranchOperatorInfo>(                     // --
     659             :               IrOpcode::kBranch, Operator::kKontrol,         // opcode
     660             :               "Branch",                                      // name
     661             :               1, 0, 1, 0, 0, 2,                              // counts
     662      267696 :               BranchOperatorInfo{hint, is_safety_check}) {}  // parameter
     663             :   };
     664             : #define CACHED_BRANCH(Hint, IsCheck)                             \
     665             :   BranchOperator<BranchHint::k##Hint, IsSafetyCheck::k##IsCheck> \
     666             :       kBranch##Hint##IsCheck##Operator;
     667             :   CACHED_BRANCH_LIST(CACHED_BRANCH)
     668             : #undef CACHED_BRANCH
     669             : 
     670             :   template <int kEffectInputCount>
     671           0 :   struct EffectPhiOperator final : public Operator {
     672      178464 :     EffectPhiOperator()
     673             :         : Operator(                                      // --
     674             :               IrOpcode::kEffectPhi, Operator::kKontrol,  // opcode
     675             :               "EffectPhi",                               // name
     676      178464 :               0, kEffectInputCount, 1, 0, 1, 0) {}       // counts
     677             :   };
     678             : #define CACHED_EFFECT_PHI(input_count) \
     679             :   EffectPhiOperator<input_count> kEffectPhi##input_count##Operator;
     680             :   CACHED_EFFECT_PHI_LIST(CACHED_EFFECT_PHI)
     681             : #undef CACHED_EFFECT_PHI
     682             : 
     683             :   template <RegionObservability kRegionObservability>
     684           0 :   struct BeginRegionOperator final : public Operator1<RegionObservability> {
     685       59488 :     BeginRegionOperator()
     686             :         : Operator1<RegionObservability>(                  // --
     687             :               IrOpcode::kBeginRegion, Operator::kKontrol,  // opcode
     688             :               "BeginRegion",                               // name
     689             :               0, 1, 0, 0, 1, 0,                            // counts
     690       59488 :               kRegionObservability) {}                     // parameter
     691             :   };
     692             :   BeginRegionOperator<RegionObservability::kObservable>
     693             :       kBeginRegionObservableOperator;
     694             :   BeginRegionOperator<RegionObservability::kNotObservable>
     695             :       kBeginRegionNotObservableOperator;
     696             : 
     697             :   template <size_t kInputCount>
     698           0 :   struct LoopOperator final : public Operator {
     699       59488 :     LoopOperator()
     700             :         : Operator(                                 // --
     701             :               IrOpcode::kLoop, Operator::kKontrol,  // opcode
     702             :               "Loop",                               // name
     703       59488 :               0, 0, kInputCount, 0, 0, 1) {}        // counts
     704             :   };
     705             : #define CACHED_LOOP(input_count) \
     706             :   LoopOperator<input_count> kLoop##input_count##Operator;
     707             :   CACHED_LOOP_LIST(CACHED_LOOP)
     708             : #undef CACHED_LOOP
     709             : 
     710             :   template <size_t kInputCount>
     711           0 :   struct MergeOperator final : public Operator {
     712      237952 :     MergeOperator()
     713             :         : Operator(                                  // --
     714             :               IrOpcode::kMerge, Operator::kKontrol,  // opcode
     715             :               "Merge",                               // name
     716      237952 :               0, 0, kInputCount, 0, 0, 1) {}         // counts
     717             :   };
     718             : #define CACHED_MERGE(input_count) \
     719             :   MergeOperator<input_count> kMerge##input_count##Operator;
     720             :   CACHED_MERGE_LIST(CACHED_MERGE)
     721             : #undef CACHED_MERGE
     722             : 
     723             :   template <DeoptimizeKind kKind, DeoptimizeReason kReason>
     724           0 :   struct DeoptimizeOperator final : public Operator1<DeoptimizeParameters> {
     725      118976 :     DeoptimizeOperator()
     726             :         : Operator1<DeoptimizeParameters>(               // --
     727             :               IrOpcode::kDeoptimize,                     // opcode
     728             :               Operator::kFoldable | Operator::kNoThrow,  // properties
     729             :               "Deoptimize",                              // name
     730             :               1, 1, 1, 0, 0, 1,                          // counts
     731             :               DeoptimizeParameters(kKind, kReason, VectorSlotPair(),
     732      237952 :                                    IsSafetyCheck::kNoSafetyCheck)) {}
     733             :   };
     734             : #define CACHED_DEOPTIMIZE(Kind, Reason)                                    \
     735             :   DeoptimizeOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason> \
     736             :       kDeoptimize##Kind##Reason##Operator;
     737             :   CACHED_DEOPTIMIZE_LIST(CACHED_DEOPTIMIZE)
     738             : #undef CACHED_DEOPTIMIZE
     739             : 
     740             :   template <DeoptimizeKind kKind, DeoptimizeReason kReason,
     741             :             IsSafetyCheck is_safety_check>
     742           0 :   struct DeoptimizeIfOperator final : public Operator1<DeoptimizeParameters> {
     743      267696 :     DeoptimizeIfOperator()
     744             :         : Operator1<DeoptimizeParameters>(               // --
     745             :               IrOpcode::kDeoptimizeIf,                   // opcode
     746             :               Operator::kFoldable | Operator::kNoThrow,  // properties
     747             :               "DeoptimizeIf",                            // name
     748             :               2, 1, 1, 0, 1, 1,                          // counts
     749             :               DeoptimizeParameters(kKind, kReason, VectorSlotPair(),
     750      535392 :                                    is_safety_check)) {}
     751             :   };
     752             : #define CACHED_DEOPTIMIZE_IF(Kind, Reason, IsCheck)                          \
     753             :   DeoptimizeIfOperator<DeoptimizeKind::k##Kind, DeoptimizeReason::k##Reason, \
     754             :                        IsSafetyCheck::k##IsCheck>                            \
     755             :       kDeoptimizeIf##Kind##Reason##IsCheck##Operator;
     756             :   CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
     757             : #undef CACHED_DEOPTIMIZE_IF
     758             : 
     759             :   template <DeoptimizeKind kKind, DeoptimizeReason kReason,
     760             :             IsSafetyCheck is_safety_check>
     761           0 :   struct DeoptimizeUnlessOperator final
     762             :       : public Operator1<DeoptimizeParameters> {
     763      297440 :     DeoptimizeUnlessOperator()
     764             :         : Operator1<DeoptimizeParameters>(               // --
     765             :               IrOpcode::kDeoptimizeUnless,               // opcode
     766             :               Operator::kFoldable | Operator::kNoThrow,  // properties
     767             :               "DeoptimizeUnless",                        // name
     768             :               2, 1, 1, 0, 1, 1,                          // counts
     769             :               DeoptimizeParameters(kKind, kReason, VectorSlotPair(),
     770      594880 :                                    is_safety_check)) {}
     771             :   };
     772             : #define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason, IsCheck) \
     773             :   DeoptimizeUnlessOperator<DeoptimizeKind::k##Kind,     \
     774             :                            DeoptimizeReason::k##Reason, \
     775             :                            IsSafetyCheck::k##IsCheck>   \
     776             :       kDeoptimizeUnless##Kind##Reason##IsCheck##Operator;
     777             :   CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
     778             : #undef CACHED_DEOPTIMIZE_UNLESS
     779             : 
     780             :   template <TrapId trap_id>
     781           0 :   struct TrapIfOperator final : public Operator1<TrapId> {
     782       59488 :     TrapIfOperator()
     783             :         : Operator1<TrapId>(                             // --
     784             :               IrOpcode::kTrapIf,                         // opcode
     785             :               Operator::kFoldable | Operator::kNoThrow,  // properties
     786             :               "TrapIf",                                  // name
     787             :               1, 1, 1, 0, 0, 1,                          // counts
     788       59488 :               trap_id) {}                                // parameter
     789             :   };
     790             : #define CACHED_TRAP_IF(Trap) \
     791             :   TrapIfOperator<TrapId::k##Trap> kTrapIf##Trap##Operator;
     792             :   CACHED_TRAP_IF_LIST(CACHED_TRAP_IF)
     793             : #undef CACHED_TRAP_IF
     794             : 
     795             :   template <TrapId trap_id>
     796           0 :   struct TrapUnlessOperator final : public Operator1<TrapId> {
     797      237952 :     TrapUnlessOperator()
     798             :         : Operator1<TrapId>(                             // --
     799             :               IrOpcode::kTrapUnless,                     // opcode
     800             :               Operator::kFoldable | Operator::kNoThrow,  // properties
     801             :               "TrapUnless",                              // name
     802             :               1, 1, 1, 0, 0, 1,                          // counts
     803      237952 :               trap_id) {}                                // parameter
     804             :   };
     805             : #define CACHED_TRAP_UNLESS(Trap) \
     806             :   TrapUnlessOperator<TrapId::k##Trap> kTrapUnless##Trap##Operator;
     807             :   CACHED_TRAP_UNLESS_LIST(CACHED_TRAP_UNLESS)
     808             : #undef CACHED_TRAP_UNLESS
     809             : 
     810             :   template <MachineRepresentation kRep, int kInputCount>
     811           0 :   struct PhiOperator final : public Operator1<MachineRepresentation> {
     812      267696 :     PhiOperator()
     813             :         : Operator1<MachineRepresentation>(     //--
     814             :               IrOpcode::kPhi, Operator::kPure,  // opcode
     815             :               "Phi",                            // name
     816             :               kInputCount, 0, 1, 1, 0, 0,       // counts
     817      267696 :               kRep) {}                          // parameter
     818             :   };
     819             : #define CACHED_PHI(rep, input_count)                   \
     820             :   PhiOperator<MachineRepresentation::rep, input_count> \
     821             :       kPhi##rep##input_count##Operator;
     822             :   CACHED_PHI_LIST(CACHED_PHI)
     823             : #undef CACHED_PHI
     824             : 
     825             :   template <int kInputCount>
     826           0 :   struct InductionVariablePhiOperator final : public Operator {
     827      118976 :     InductionVariablePhiOperator()
     828             :         : Operator(                                              //--
     829             :               IrOpcode::kInductionVariablePhi, Operator::kPure,  // opcode
     830             :               "InductionVariablePhi",                            // name
     831      118976 :               kInputCount, 0, 1, 1, 0, 0) {}                     // counts
     832             :   };
     833             : #define CACHED_INDUCTION_VARIABLE_PHI(input_count) \
     834             :   InductionVariablePhiOperator<input_count>        \
     835             :       kInductionVariablePhi##input_count##Operator;
     836             :   CACHED_INDUCTION_VARIABLE_PHI_LIST(CACHED_INDUCTION_VARIABLE_PHI)
     837             : #undef CACHED_INDUCTION_VARIABLE_PHI
     838             : 
     839             :   template <int kIndex>
     840           0 :   struct ParameterOperator final : public Operator1<ParameterInfo> {
     841      208208 :     ParameterOperator()
     842             :         : Operator1<ParameterInfo>(                   // --
     843             :               IrOpcode::kParameter, Operator::kPure,  // opcode
     844             :               "Parameter",                            // name
     845             :               1, 0, 0, 1, 0, 0,                       // counts,
     846      208208 :               ParameterInfo(kIndex, nullptr)) {}      // parameter and name
     847             :   };
     848             : #define CACHED_PARAMETER(index) \
     849             :   ParameterOperator<index> kParameter##index##Operator;
     850             :   CACHED_PARAMETER_LIST(CACHED_PARAMETER)
     851             : #undef CACHED_PARAMETER
     852             : 
     853             :   template <size_t kIndex>
     854           0 :   struct ProjectionOperator final : public Operator1<size_t> {
     855       59488 :     ProjectionOperator()
     856             :         : Operator1<size_t>(          // --
     857             :               IrOpcode::kProjection,  // opcode
     858             :               Operator::kPure,        // flags
     859             :               "Projection",           // name
     860             :               1, 0, 1, 1, 0, 0,       // counts,
     861       59488 :               kIndex) {}              // parameter
     862             :   };
     863             : #define CACHED_PROJECTION(index) \
     864             :   ProjectionOperator<index> kProjection##index##Operator;
     865             :   CACHED_PROJECTION_LIST(CACHED_PROJECTION)
     866             : #undef CACHED_PROJECTION
     867             : 
     868             :   template <int kInputCount>
     869           0 :   struct StateValuesOperator final : public Operator1<SparseInputMask> {
     870      416416 :     StateValuesOperator()
     871             :         : Operator1<SparseInputMask>(       // --
     872             :               IrOpcode::kStateValues,       // opcode
     873             :               Operator::kPure,              // flags
     874             :               "StateValues",                // name
     875             :               kInputCount, 0, 0, 1, 0, 0,   // counts
     876      416416 :               SparseInputMask::Dense()) {}  // parameter
     877             :   };
     878             : #define CACHED_STATE_VALUES(input_count) \
     879             :   StateValuesOperator<input_count> kStateValues##input_count##Operator;
     880             :   CACHED_STATE_VALUES_LIST(CACHED_STATE_VALUES)
     881             : #undef CACHED_STATE_VALUES
     882             : };
     883             : 
     884             : namespace {
     885     5477324 : DEFINE_LAZY_LEAKY_OBJECT_GETTER(CommonOperatorGlobalCache,
     886             :                                 GetCommonOperatorGlobalCache)
     887             : }
     888             : 
     889     5447555 : CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone)
     890     5447555 :     : cache_(*GetCommonOperatorGlobalCache()), zone_(zone) {}
     891             : 
     892             : #define CACHED(Name, properties, value_input_count, effect_input_count,      \
     893             :                control_input_count, value_output_count, effect_output_count, \
     894             :                control_output_count)                                         \
     895             :   const Operator* CommonOperatorBuilder::Name() {                            \
     896             :     return &cache_.k##Name##Operator;                                        \
     897             :   }
     898    22286405 : COMMON_CACHED_OP_LIST(CACHED)
     899             : #undef CACHED
     900             : 
     901             : 
     902     3600454 : const Operator* CommonOperatorBuilder::End(size_t control_input_count) {
     903     3600454 :   switch (control_input_count) {
     904             : #define CACHED_END(input_count) \
     905             :   case input_count:             \
     906             :     return &cache_.kEnd##input_count##Operator;
     907     2515484 :     CACHED_END_LIST(CACHED_END)
     908             : #undef CACHED_END
     909             :     default:
     910             :       break;
     911             :   }
     912             :   // Uncached.
     913             :   return new (zone()) Operator(             //--
     914             :       IrOpcode::kEnd, Operator::kKontrol,   // opcode
     915             :       "End",                                // name
     916      478332 :       0, 0, control_input_count, 0, 0, 0);  // counts
     917             : }
     918             : 
     919     3086287 : const Operator* CommonOperatorBuilder::Return(int value_input_count) {
     920     3086287 :   switch (value_input_count) {
     921             : #define CACHED_RETURN(input_count) \
     922             :   case input_count:                \
     923             :     return &cache_.kReturn##input_count##Operator;
     924     2842577 :     CACHED_RETURN_LIST(CACHED_RETURN)
     925             : #undef CACHED_RETURN
     926             :     default:
     927             :       break;
     928             :   }
     929             :   // Uncached.
     930             :   return new (zone()) Operator(               //--
     931             :       IrOpcode::kReturn, Operator::kNoThrow,  // opcode
     932             :       "Return",                               // name
     933      241937 :       value_input_count + 1, 1, 1, 0, 0, 1);  // counts
     934             : }
     935             : 
     936     5462192 : const Operator* CommonOperatorBuilder::Branch(BranchHint hint,
     937             :                                               IsSafetyCheck is_safety_check) {
     938             : #define CACHED_BRANCH(Hint, IsCheck)                  \
     939             :   if (hint == BranchHint::k##Hint &&                  \
     940             :       is_safety_check == IsSafetyCheck::k##IsCheck) { \
     941             :     return &cache_.kBranch##Hint##IsCheck##Operator;  \
     942             :   }
     943     5462192 :   CACHED_BRANCH_LIST(CACHED_BRANCH)
     944             : #undef CACHED_BRANCH
     945           0 :   UNREACHABLE();
     946             : }
     947             : 
     948       70582 : const Operator* CommonOperatorBuilder::Deoptimize(
     949             :     DeoptimizeKind kind, DeoptimizeReason reason,
     950             :     VectorSlotPair const& feedback) {
     951             : #define CACHED_DEOPTIMIZE(Kind, Reason)                               \
     952             :   if (kind == DeoptimizeKind::k##Kind &&                              \
     953             :       reason == DeoptimizeReason::k##Reason && !feedback.IsValid()) { \
     954             :     return &cache_.kDeoptimize##Kind##Reason##Operator;               \
     955             :   }
     956       79865 :   CACHED_DEOPTIMIZE_LIST(CACHED_DEOPTIMIZE)
     957             : #undef CACHED_DEOPTIMIZE
     958             :   // Uncached
     959             :   DeoptimizeParameters parameter(kind, reason, feedback,
     960             :                                  IsSafetyCheck::kNoSafetyCheck);
     961             :   return new (zone()) Operator1<DeoptimizeParameters>(  // --
     962             :       IrOpcode::kDeoptimize,                            // opcodes
     963             :       Operator::kFoldable | Operator::kNoThrow,         // properties
     964             :       "Deoptimize",                                     // name
     965             :       1, 1, 1, 0, 0, 1,                                 // counts
     966             :       parameter);                                       // parameter
     967             : }
     968             : 
     969      117419 : const Operator* CommonOperatorBuilder::DeoptimizeIf(
     970             :     DeoptimizeKind kind, DeoptimizeReason reason,
     971             :     VectorSlotPair const& feedback, IsSafetyCheck is_safety_check) {
     972             : #define CACHED_DEOPTIMIZE_IF(Kind, Reason, IsCheck)                          \
     973             :   if (kind == DeoptimizeKind::k##Kind &&                                     \
     974             :       reason == DeoptimizeReason::k##Reason &&                               \
     975             :       is_safety_check == IsSafetyCheck::k##IsCheck && !feedback.IsValid()) { \
     976             :     return &cache_.kDeoptimizeIf##Kind##Reason##IsCheck##Operator;           \
     977             :   }
     978      230620 :   CACHED_DEOPTIMIZE_IF_LIST(CACHED_DEOPTIMIZE_IF)
     979             : #undef CACHED_DEOPTIMIZE_IF
     980             :   // Uncached
     981             :   DeoptimizeParameters parameter(kind, reason, feedback, is_safety_check);
     982             :   return new (zone()) Operator1<DeoptimizeParameters>(  // --
     983             :       IrOpcode::kDeoptimizeIf,                          // opcode
     984             :       Operator::kFoldable | Operator::kNoThrow,         // properties
     985             :       "DeoptimizeIf",                                   // name
     986             :       2, 1, 1, 0, 1, 1,                                 // counts
     987             :       parameter);                                       // parameter
     988             : }
     989             : 
     990      230610 : const Operator* CommonOperatorBuilder::DeoptimizeUnless(
     991             :     DeoptimizeKind kind, DeoptimizeReason reason,
     992             :     VectorSlotPair const& feedback, IsSafetyCheck is_safety_check) {
     993             : #define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason, IsCheck)                      \
     994             :   if (kind == DeoptimizeKind::k##Kind &&                                     \
     995             :       reason == DeoptimizeReason::k##Reason &&                               \
     996             :       is_safety_check == IsSafetyCheck::k##IsCheck && !feedback.IsValid()) { \
     997             :     return &cache_.kDeoptimizeUnless##Kind##Reason##IsCheck##Operator;       \
     998             :   }
     999      340219 :   CACHED_DEOPTIMIZE_UNLESS_LIST(CACHED_DEOPTIMIZE_UNLESS)
    1000             : #undef CACHED_DEOPTIMIZE_UNLESS
    1001             :   // Uncached
    1002             :   DeoptimizeParameters parameter(kind, reason, feedback, is_safety_check);
    1003             :   return new (zone()) Operator1<DeoptimizeParameters>(  // --
    1004             :       IrOpcode::kDeoptimizeUnless,                      // opcode
    1005             :       Operator::kFoldable | Operator::kNoThrow,         // properties
    1006             :       "DeoptimizeUnless",                               // name
    1007             :       2, 1, 1, 0, 1, 1,                                 // counts
    1008             :       parameter);                                       // parameter
    1009             : }
    1010             : 
    1011        6314 : const Operator* CommonOperatorBuilder::TrapIf(TrapId trap_id) {
    1012        6314 :   switch (trap_id) {
    1013             : #define CACHED_TRAP_IF(Trap) \
    1014             :   case TrapId::k##Trap:      \
    1015             :     return &cache_.kTrapIf##Trap##Operator;
    1016         204 :     CACHED_TRAP_IF_LIST(CACHED_TRAP_IF)
    1017             : #undef CACHED_TRAP_IF
    1018             :     default:
    1019             :       break;
    1020             :   }
    1021             :   // Uncached
    1022             :   return new (zone()) Operator1<TrapId>(         // --
    1023             :       IrOpcode::kTrapIf,                         // opcode
    1024             :       Operator::kFoldable | Operator::kNoThrow,  // properties
    1025             :       "TrapIf",                                  // name
    1026             :       1, 1, 1, 0, 0, 1,                          // counts
    1027             :       trap_id);                                  // parameter
    1028             : }
    1029             : 
    1030      136593 : const Operator* CommonOperatorBuilder::TrapUnless(TrapId trap_id) {
    1031      136593 :   switch (trap_id) {
    1032             : #define CACHED_TRAP_UNLESS(Trap) \
    1033             :   case TrapId::k##Trap:          \
    1034             :     return &cache_.kTrapUnless##Trap##Operator;
    1035      106110 :     CACHED_TRAP_UNLESS_LIST(CACHED_TRAP_UNLESS)
    1036             : #undef CACHED_TRAP_UNLESS
    1037             :     default:
    1038             :       break;
    1039             :   }
    1040             :   // Uncached
    1041             :   return new (zone()) Operator1<TrapId>(         // --
    1042             :       IrOpcode::kTrapUnless,                     // opcode
    1043             :       Operator::kFoldable | Operator::kNoThrow,  // properties
    1044             :       "TrapUnless",                              // name
    1045             :       1, 1, 1, 0, 0, 1,                          // counts
    1046             :       trap_id);                                  // parameter
    1047             : }
    1048             : 
    1049       25182 : const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) {
    1050             :   return new (zone()) Operator(               // --
    1051             :       IrOpcode::kSwitch, Operator::kKontrol,  // opcode
    1052             :       "Switch",                               // name
    1053       25184 :       1, 0, 1, 0, 0, control_output_count);   // counts
    1054             : }
    1055             : 
    1056      331932 : const Operator* CommonOperatorBuilder::IfValue(int32_t index,
    1057             :                                                int32_t comparison_order,
    1058             :                                                BranchHint hint) {
    1059             :   return new (zone()) Operator1<IfValueParameters>(       // --
    1060             :       IrOpcode::kIfValue, Operator::kKontrol,             // opcode
    1061             :       "IfValue",                                          // name
    1062             :       0, 0, 1, 0, 0, 1,                                   // counts
    1063      331931 :       IfValueParameters(index, comparison_order, hint));  // parameter
    1064             : }
    1065             : 
    1066       33071 : const Operator* CommonOperatorBuilder::IfDefault(BranchHint hint) {
    1067             :   return new (zone()) Operator1<BranchHint>(     // --
    1068             :       IrOpcode::kIfDefault, Operator::kKontrol,  // opcode
    1069             :       "IfDefault",                               // name
    1070             :       0, 0, 1, 0, 0, 1,                          // counts
    1071       33072 :       hint);                                     // parameter
    1072             : }
    1073             : 
    1074     2832680 : const Operator* CommonOperatorBuilder::Start(int value_output_count) {
    1075             :   return new (zone()) Operator(                                    // --
    1076     5665188 :       IrOpcode::kStart, Operator::kFoldable | Operator::kNoThrow,  // opcode
    1077             :       "Start",                                                     // name
    1078     5665118 :       0, 0, 0, value_output_count, 1, 1);                          // counts
    1079             : }
    1080             : 
    1081             : 
    1082      689433 : const Operator* CommonOperatorBuilder::Loop(int control_input_count) {
    1083      689433 :   switch (control_input_count) {
    1084             : #define CACHED_LOOP(input_count) \
    1085             :   case input_count:              \
    1086             :     return &cache_.kLoop##input_count##Operator;
    1087       50960 :     CACHED_LOOP_LIST(CACHED_LOOP)
    1088             : #undef CACHED_LOOP
    1089             :     default:
    1090             :       break;
    1091             :   }
    1092             :   // Uncached.
    1093             :   return new (zone()) Operator(             // --
    1094             :       IrOpcode::kLoop, Operator::kKontrol,  // opcode
    1095             :       "Loop",                               // name
    1096         772 :       0, 0, control_input_count, 0, 0, 1);  // counts
    1097             : }
    1098             : 
    1099             : 
    1100     4522463 : const Operator* CommonOperatorBuilder::Merge(int control_input_count) {
    1101     4522463 :   switch (control_input_count) {
    1102             : #define CACHED_MERGE(input_count) \
    1103             :   case input_count:               \
    1104             :     return &cache_.kMerge##input_count##Operator;
    1105      801581 :     CACHED_MERGE_LIST(CACHED_MERGE)
    1106             : #undef CACHED_MERGE
    1107             :     default:
    1108             :       break;
    1109             :   }
    1110             :   // Uncached.
    1111             :   return new (zone()) Operator(              // --
    1112             :       IrOpcode::kMerge, Operator::kKontrol,  // opcode
    1113             :       "Merge",                               // name
    1114      322643 :       0, 0, control_input_count, 0, 0, 1);   // counts
    1115             : }
    1116             : 
    1117             : 
    1118     5984313 : const Operator* CommonOperatorBuilder::Parameter(int index,
    1119             :                                                  const char* debug_name) {
    1120     5984313 :   if (!debug_name) {
    1121     4088875 :     switch (index) {
    1122             : #define CACHED_PARAMETER(index) \
    1123             :   case index:                   \
    1124             :     return &cache_.kParameter##index##Operator;
    1125     2060810 :       CACHED_PARAMETER_LIST(CACHED_PARAMETER)
    1126             : #undef CACHED_PARAMETER
    1127             :       default:
    1128             :         break;
    1129             :     }
    1130             :   }
    1131             :   // Uncached.
    1132             :   return new (zone()) Operator1<ParameterInfo>(  // --
    1133             :       IrOpcode::kParameter, Operator::kPure,     // opcode
    1134             :       "Parameter",                               // name
    1135             :       1, 0, 0, 1, 0, 0,                          // counts
    1136             :       ParameterInfo(index, debug_name));         // parameter info
    1137             : }
    1138             : 
    1139       44754 : const Operator* CommonOperatorBuilder::OsrValue(int index) {
    1140             :   return new (zone()) Operator1<int>(                // --
    1141             :       IrOpcode::kOsrValue, Operator::kNoProperties,  // opcode
    1142             :       "OsrValue",                                    // name
    1143             :       0, 0, 1, 1, 0, 0,                              // counts
    1144       44754 :       index);                                        // parameter
    1145             : }
    1146             : 
    1147    14721146 : const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) {
    1148             :   return new (zone()) Operator1<int32_t>(         // --
    1149             :       IrOpcode::kInt32Constant, Operator::kPure,  // opcode
    1150             :       "Int32Constant",                            // name
    1151             :       0, 0, 0, 1, 0, 0,                           // counts
    1152    14722221 :       value);                                     // parameter
    1153             : }
    1154             : 
    1155             : 
    1156    10462144 : const Operator* CommonOperatorBuilder::Int64Constant(int64_t value) {
    1157             :   return new (zone()) Operator1<int64_t>(         // --
    1158             :       IrOpcode::kInt64Constant, Operator::kPure,  // opcode
    1159             :       "Int64Constant",                            // name
    1160             :       0, 0, 0, 1, 0, 0,                           // counts
    1161    10462413 :       value);                                     // parameter
    1162             : }
    1163             : 
    1164             : 
    1165      314518 : const Operator* CommonOperatorBuilder::Float32Constant(volatile float value) {
    1166             :   return new (zone()) Operator1<float>(             // --
    1167             :       IrOpcode::kFloat32Constant, Operator::kPure,  // opcode
    1168             :       "Float32Constant",                            // name
    1169             :       0, 0, 0, 1, 0, 0,                             // counts
    1170      629044 :       value);                                       // parameter
    1171             : }
    1172             : 
    1173             : 
    1174      439397 : const Operator* CommonOperatorBuilder::Float64Constant(volatile double value) {
    1175             :   return new (zone()) Operator1<double>(            // --
    1176             :       IrOpcode::kFloat64Constant, Operator::kPure,  // opcode
    1177             :       "Float64Constant",                            // name
    1178             :       0, 0, 0, 1, 0, 0,                             // counts
    1179      878810 :       value);                                       // parameter
    1180             : }
    1181             : 
    1182             : 
    1183    11578123 : const Operator* CommonOperatorBuilder::ExternalConstant(
    1184             :     const ExternalReference& value) {
    1185             :   return new (zone()) Operator1<ExternalReference>(  // --
    1186             :       IrOpcode::kExternalConstant, Operator::kPure,  // opcode
    1187             :       "ExternalConstant",                            // name
    1188             :       0, 0, 0, 1, 0, 0,                              // counts
    1189    23156252 :       value);                                        // parameter
    1190             : }
    1191             : 
    1192             : 
    1193     2636397 : const Operator* CommonOperatorBuilder::NumberConstant(volatile double value) {
    1194             :   return new (zone()) Operator1<double>(           // --
    1195             :       IrOpcode::kNumberConstant, Operator::kPure,  // opcode
    1196             :       "NumberConstant",                            // name
    1197             :       0, 0, 0, 1, 0, 0,                            // counts
    1198     5272802 :       value);                                      // parameter
    1199             : }
    1200             : 
    1201         229 : const Operator* CommonOperatorBuilder::PointerConstant(intptr_t value) {
    1202             :   return new (zone()) Operator1<intptr_t>(          // --
    1203             :       IrOpcode::kPointerConstant, Operator::kPure,  // opcode
    1204             :       "PointerConstant",                            // name
    1205             :       0, 0, 0, 1, 0, 0,                             // counts
    1206         229 :       value);                                       // parameter
    1207             : }
    1208             : 
    1209    17615069 : const Operator* CommonOperatorBuilder::HeapConstant(
    1210             :     const Handle<HeapObject>& value) {
    1211             :   return new (zone()) Operator1<Handle<HeapObject>>(  // --
    1212             :       IrOpcode::kHeapConstant, Operator::kPure,       // opcode
    1213             :       "HeapConstant",                                 // name
    1214             :       0, 0, 0, 1, 0, 0,                               // counts
    1215    35230140 :       value);                                         // parameter
    1216             : }
    1217             : 
    1218    33079588 : Handle<HeapObject> HeapConstantOf(const Operator* op) {
    1219             :   DCHECK_EQ(IrOpcode::kHeapConstant, op->opcode());
    1220    33079588 :   return OpParameter<Handle<HeapObject>>(op);
    1221             : }
    1222             : 
    1223       11045 : const StringConstantBase* StringConstantBaseOf(const Operator* op) {
    1224             :   DCHECK_EQ(IrOpcode::kDelayedStringConstant, op->opcode());
    1225       11045 :   return OpParameter<const StringConstantBase*>(op);
    1226             : }
    1227             : 
    1228           0 : const Operator* CommonOperatorBuilder::RelocatableInt32Constant(
    1229             :     int32_t value, RelocInfo::Mode rmode) {
    1230             :   return new (zone()) Operator1<RelocatablePtrConstantInfo>(  // --
    1231             :       IrOpcode::kRelocatableInt32Constant, Operator::kPure,   // opcode
    1232             :       "RelocatableInt32Constant",                             // name
    1233             :       0, 0, 0, 1, 0, 0,                                       // counts
    1234           0 :       RelocatablePtrConstantInfo(value, rmode));              // parameter
    1235             : }
    1236             : 
    1237      150068 : const Operator* CommonOperatorBuilder::RelocatableInt64Constant(
    1238             :     int64_t value, RelocInfo::Mode rmode) {
    1239             :   return new (zone()) Operator1<RelocatablePtrConstantInfo>(  // --
    1240             :       IrOpcode::kRelocatableInt64Constant, Operator::kPure,   // opcode
    1241             :       "RelocatableInt64Constant",                             // name
    1242             :       0, 0, 0, 1, 0, 0,                                       // counts
    1243      150104 :       RelocatablePtrConstantInfo(value, rmode));              // parameter
    1244             : }
    1245             : 
    1246        3686 : const Operator* CommonOperatorBuilder::ObjectId(uint32_t object_id) {
    1247             :   return new (zone()) Operator1<uint32_t>(   // --
    1248             :       IrOpcode::kObjectId, Operator::kPure,  // opcode
    1249             :       "ObjectId",                            // name
    1250             :       0, 0, 0, 1, 0, 0,                      // counts
    1251        3686 :       object_id);                            // parameter
    1252             : }
    1253             : 
    1254       33994 : const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep,
    1255             :                                               BranchHint hint) {
    1256             :   return new (zone()) Operator1<SelectParameters>(  // --
    1257             :       IrOpcode::kSelect, Operator::kPure,           // opcode
    1258             :       "Select",                                     // name
    1259             :       3, 0, 0, 1, 0, 0,                             // counts
    1260       33994 :       SelectParameters(rep, hint));                 // parameter
    1261             : }
    1262             : 
    1263             : 
    1264     8041610 : const Operator* CommonOperatorBuilder::Phi(MachineRepresentation rep,
    1265             :                                            int value_input_count) {
    1266             :   DCHECK_LT(0, value_input_count);  // Disallow empty phis.
    1267             : #define CACHED_PHI(kRep, kValueInputCount)                 \
    1268             :   if (MachineRepresentation::kRep == rep &&                \
    1269             :       kValueInputCount == value_input_count) {             \
    1270             :     return &cache_.kPhi##kRep##kValueInputCount##Operator; \
    1271             :   }
    1272     8041610 :   CACHED_PHI_LIST(CACHED_PHI)
    1273             : #undef CACHED_PHI
    1274             :   // Uncached.
    1275             :   return new (zone()) Operator1<MachineRepresentation>(  // --
    1276             :       IrOpcode::kPhi, Operator::kPure,                   // opcode
    1277             :       "Phi",                                             // name
    1278             :       value_input_count, 0, 1, 1, 0, 0,                  // counts
    1279     4418497 :       rep);                                              // parameter
    1280             : }
    1281             : 
    1282       18659 : const Operator* CommonOperatorBuilder::TypeGuard(Type type) {
    1283             :   return new (zone()) Operator1<Type>(        // --
    1284             :       IrOpcode::kTypeGuard, Operator::kPure,  // opcode
    1285             :       "TypeGuard",                            // name
    1286             :       1, 1, 1, 1, 1, 0,                       // counts
    1287       37318 :       type);                                  // parameter
    1288             : }
    1289             : 
    1290     3592661 : const Operator* CommonOperatorBuilder::EffectPhi(int effect_input_count) {
    1291             :   DCHECK_LT(0, effect_input_count);  // Disallow empty effect phis.
    1292     3592661 :   switch (effect_input_count) {
    1293             : #define CACHED_EFFECT_PHI(input_count) \
    1294             :   case input_count:                    \
    1295             :     return &cache_.kEffectPhi##input_count##Operator;
    1296      271049 :     CACHED_EFFECT_PHI_LIST(CACHED_EFFECT_PHI)
    1297             : #undef CACHED_EFFECT_PHI
    1298             :     default:
    1299             :       break;
    1300             :   }
    1301             :   // Uncached.
    1302             :   return new (zone()) Operator(                  // --
    1303             :       IrOpcode::kEffectPhi, Operator::kKontrol,  // opcode
    1304             :       "EffectPhi",                               // name
    1305      195391 :       0, effect_input_count, 1, 0, 1, 0);        // counts
    1306             : }
    1307             : 
    1308       12224 : const Operator* CommonOperatorBuilder::InductionVariablePhi(int input_count) {
    1309             :   DCHECK_LE(4, input_count);  // There must be always the entry, backedge,
    1310             :                               // increment and at least one bound.
    1311       12224 :   switch (input_count) {
    1312             : #define CACHED_INDUCTION_VARIABLE_PHI(input_count) \
    1313             :   case input_count:                                \
    1314             :     return &cache_.kInductionVariablePhi##input_count##Operator;
    1315       12091 :     CACHED_INDUCTION_VARIABLE_PHI_LIST(CACHED_INDUCTION_VARIABLE_PHI)
    1316             : #undef CACHED_INDUCTION_VARIABLE_PHI
    1317             :     default:
    1318             :       break;
    1319             :   }
    1320             :   // Uncached.
    1321             :   return new (zone()) Operator(                          // --
    1322             :       IrOpcode::kInductionVariablePhi, Operator::kPure,  // opcode
    1323             :       "InductionVariablePhi",                            // name
    1324           0 :       input_count, 0, 1, 1, 0, 0);                       // counts
    1325             : }
    1326             : 
    1327      161677 : const Operator* CommonOperatorBuilder::BeginRegion(
    1328             :     RegionObservability region_observability) {
    1329      161677 :   switch (region_observability) {
    1330             :     case RegionObservability::kObservable:
    1331       21992 :       return &cache_.kBeginRegionObservableOperator;
    1332             :     case RegionObservability::kNotObservable:
    1333      139685 :       return &cache_.kBeginRegionNotObservableOperator;
    1334             :   }
    1335           0 :   UNREACHABLE();
    1336             : }
    1337             : 
    1338     3645305 : const Operator* CommonOperatorBuilder::StateValues(int arguments,
    1339             :                                                    SparseInputMask bitmask) {
    1340     3645305 :   if (bitmask.IsDense()) {
    1341      766250 :     switch (arguments) {
    1342             : #define CACHED_STATE_VALUES(arguments) \
    1343             :   case arguments:                      \
    1344             :     return &cache_.kStateValues##arguments##Operator;
    1345      186018 :       CACHED_STATE_VALUES_LIST(CACHED_STATE_VALUES)
    1346             : #undef CACHED_STATE_VALUES
    1347             :       default:
    1348             :         break;
    1349             :     }
    1350             :   }
    1351             : 
    1352             : #if DEBUG
    1353             :   DCHECK(bitmask.IsDense() || bitmask.CountReal() == arguments);
    1354             : #endif
    1355             : 
    1356             :   // Uncached.
    1357             :   return new (zone()) Operator1<SparseInputMask>(  // --
    1358             :       IrOpcode::kStateValues, Operator::kPure,     // opcode
    1359             :       "StateValues",                               // name
    1360             :       arguments, 0, 0, 1, 0, 0,                    // counts
    1361     2882465 :       bitmask);                                    // parameter
    1362             : }
    1363             : 
    1364     4444140 : const Operator* CommonOperatorBuilder::TypedStateValues(
    1365             :     const ZoneVector<MachineType>* types, SparseInputMask bitmask) {
    1366             : #if DEBUG
    1367             :   DCHECK(bitmask.IsDense() ||
    1368             :          bitmask.CountReal() == static_cast<int>(types->size()));
    1369             : #endif
    1370             : 
    1371             :   return new (zone()) Operator1<TypedStateValueInfo>(  // --
    1372             :       IrOpcode::kTypedStateValues, Operator::kPure,    // opcode
    1373             :       "TypedStateValues",                              // name
    1374             :       static_cast<int>(types->size()), 0, 0, 1, 0, 0,  // counts
    1375     8888278 :       TypedStateValueInfo(types, bitmask));            // parameters
    1376             : }
    1377             : 
    1378        2626 : const Operator* CommonOperatorBuilder::ArgumentsElementsState(
    1379             :     ArgumentsStateType type) {
    1380             :   return new (zone()) Operator1<ArgumentsStateType>(       // --
    1381             :       IrOpcode::kArgumentsElementsState, Operator::kPure,  // opcode
    1382             :       "ArgumentsElementsState",                            // name
    1383             :       0, 0, 0, 1, 0, 0,                                    // counts
    1384        2626 :       type);                                               // parameter
    1385             : }
    1386             : 
    1387        1303 : const Operator* CommonOperatorBuilder::ArgumentsLengthState(
    1388             :     ArgumentsStateType type) {
    1389             :   return new (zone()) Operator1<ArgumentsStateType>(     // --
    1390             :       IrOpcode::kArgumentsLengthState, Operator::kPure,  // opcode
    1391             :       "ArgumentsLengthState",                            // name
    1392             :       0, 0, 0, 1, 0, 0,                                  // counts
    1393        1303 :       type);                                             // parameter
    1394             : }
    1395             : 
    1396       12278 : ArgumentsStateType ArgumentsStateTypeOf(Operator const* op) {
    1397             :   DCHECK(op->opcode() == IrOpcode::kArgumentsElementsState ||
    1398             :          op->opcode() == IrOpcode::kArgumentsLengthState);
    1399       12278 :   return OpParameter<ArgumentsStateType>(op);
    1400             : }
    1401             : 
    1402      112782 : const Operator* CommonOperatorBuilder::ObjectState(uint32_t object_id,
    1403             :                                                    int pointer_slots) {
    1404             :   return new (zone()) Operator1<ObjectStateInfo>(  // --
    1405             :       IrOpcode::kObjectState, Operator::kPure,     // opcode
    1406             :       "ObjectState",                               // name
    1407             :       pointer_slots, 0, 0, 1, 0, 0,                // counts
    1408      225564 :       ObjectStateInfo{object_id, pointer_slots});  // parameter
    1409             : }
    1410             : 
    1411       22455 : const Operator* CommonOperatorBuilder::TypedObjectState(
    1412             :     uint32_t object_id, const ZoneVector<MachineType>* types) {
    1413             :   return new (zone()) Operator1<TypedObjectStateInfo>(  // --
    1414             :       IrOpcode::kTypedObjectState, Operator::kPure,     // opcode
    1415             :       "TypedObjectState",                               // name
    1416             :       static_cast<int>(types->size()), 0, 0, 1, 0, 0,   // counts
    1417       44910 :       TypedObjectStateInfo(object_id, types));          // parameter
    1418             : }
    1419             : 
    1420      218055 : uint32_t ObjectIdOf(Operator const* op) {
    1421      218055 :   switch (op->opcode()) {
    1422             :     case IrOpcode::kObjectState:
    1423       22455 :       return OpParameter<ObjectStateInfo>(op).object_id();
    1424             :     case IrOpcode::kTypedObjectState:
    1425      158216 :       return OpParameter<TypedObjectStateInfo>(op).object_id();
    1426             :     case IrOpcode::kObjectId:
    1427       37384 :       return OpParameter<uint32_t>(op);
    1428             :     default:
    1429           0 :       UNREACHABLE();
    1430             :   }
    1431             : }
    1432             : 
    1433       59791 : MachineRepresentation DeadValueRepresentationOf(Operator const* op) {
    1434             :   DCHECK_EQ(IrOpcode::kDeadValue, op->opcode());
    1435       59791 :   return OpParameter<MachineRepresentation>(op);
    1436             : }
    1437             : 
    1438     6765549 : const Operator* CommonOperatorBuilder::FrameState(
    1439             :     BailoutId bailout_id, OutputFrameStateCombine state_combine,
    1440             :     const FrameStateFunctionInfo* function_info) {
    1441             :   FrameStateInfo state_info(bailout_id, state_combine, function_info);
    1442             :   return new (zone()) Operator1<FrameStateInfo>(  // --
    1443             :       IrOpcode::kFrameState, Operator::kPure,     // opcode
    1444             :       "FrameState",                               // name
    1445             :       5, 0, 0, 1, 0, 0,                           // counts
    1446     6765539 :       state_info);                                // parameter
    1447             : }
    1448             : 
    1449     5650680 : const Operator* CommonOperatorBuilder::Call(
    1450             :     const CallDescriptor* call_descriptor) {
    1451           0 :   class CallOperator final : public Operator1<const CallDescriptor*> {
    1452             :    public:
    1453     5650719 :     explicit CallOperator(const CallDescriptor* call_descriptor)
    1454             :         : Operator1<const CallDescriptor*>(
    1455             :               IrOpcode::kCall, call_descriptor->properties(), "Call",
    1456             :               call_descriptor->InputCount() +
    1457             :                   call_descriptor->FrameStateCount(),
    1458             :               Operator::ZeroIfPure(call_descriptor->properties()),
    1459             :               Operator::ZeroIfEliminatable(call_descriptor->properties()),
    1460             :               call_descriptor->ReturnCount(),
    1461             :               Operator::ZeroIfPure(call_descriptor->properties()),
    1462             :               Operator::ZeroIfNoThrow(call_descriptor->properties()),
    1463    11301435 :               call_descriptor) {}
    1464             : 
    1465          32 :     void PrintParameter(std::ostream& os,
    1466             :                         PrintVerbosity verbose) const override {
    1467          64 :       os << "[" << *parameter() << "]";
    1468          32 :     }
    1469             :   };
    1470     5650733 :   return new (zone()) CallOperator(call_descriptor);
    1471             : }
    1472             : 
    1473         452 : const Operator* CommonOperatorBuilder::CallWithCallerSavedRegisters(
    1474             :     const CallDescriptor* call_descriptor) {
    1475           0 :   class CallOperator final : public Operator1<const CallDescriptor*> {
    1476             :    public:
    1477         452 :     explicit CallOperator(const CallDescriptor* call_descriptor)
    1478             :         : Operator1<const CallDescriptor*>(
    1479             :               IrOpcode::kCallWithCallerSavedRegisters,
    1480             :               call_descriptor->properties(), "CallWithCallerSavedRegisters",
    1481             :               call_descriptor->InputCount() +
    1482             :                   call_descriptor->FrameStateCount(),
    1483             :               Operator::ZeroIfPure(call_descriptor->properties()),
    1484             :               Operator::ZeroIfEliminatable(call_descriptor->properties()),
    1485             :               call_descriptor->ReturnCount(),
    1486             :               Operator::ZeroIfPure(call_descriptor->properties()),
    1487             :               Operator::ZeroIfNoThrow(call_descriptor->properties()),
    1488         904 :               call_descriptor) {}
    1489             : 
    1490           0 :     void PrintParameter(std::ostream& os,
    1491             :                         PrintVerbosity verbose) const override {
    1492           0 :       os << "[" << *parameter() << "]";
    1493           0 :     }
    1494             :   };
    1495         452 :   return new (zone()) CallOperator(call_descriptor);
    1496             : }
    1497             : 
    1498       63322 : const Operator* CommonOperatorBuilder::TailCall(
    1499             :     const CallDescriptor* call_descriptor) {
    1500           0 :   class TailCallOperator final : public Operator1<const CallDescriptor*> {
    1501             :    public:
    1502       63322 :     explicit TailCallOperator(const CallDescriptor* call_descriptor)
    1503             :         : Operator1<const CallDescriptor*>(
    1504             :               IrOpcode::kTailCall,
    1505             :               call_descriptor->properties() | Operator::kNoThrow, "TailCall",
    1506             :               call_descriptor->InputCount() +
    1507             :                   call_descriptor->FrameStateCount(),
    1508      126644 :               1, 1, 0, 0, 1, call_descriptor) {}
    1509             : 
    1510           0 :     void PrintParameter(std::ostream& os,
    1511             :                         PrintVerbosity verbose) const override {
    1512           0 :       os << "[" << *parameter() << "]";
    1513           0 :     }
    1514             :   };
    1515       63322 :   return new (zone()) TailCallOperator(call_descriptor);
    1516             : }
    1517             : 
    1518      425427 : const Operator* CommonOperatorBuilder::Projection(size_t index) {
    1519      425427 :   switch (index) {
    1520             : #define CACHED_PROJECTION(index) \
    1521             :   case index:                    \
    1522             :     return &cache_.kProjection##index##Operator;
    1523      209489 :     CACHED_PROJECTION_LIST(CACHED_PROJECTION)
    1524             : #undef CACHED_PROJECTION
    1525             :     default:
    1526             :       break;
    1527             :   }
    1528             :   // Uncached.
    1529             :   return new (zone()) Operator1<size_t>(  // --
    1530             :       IrOpcode::kProjection,              // opcode
    1531             :       Operator::kPure,                    // flags
    1532             :       "Projection",                       // name
    1533             :       1, 0, 1, 1, 0, 0,                   // counts
    1534             :       index);                             // parameter
    1535             : }
    1536             : 
    1537             : 
    1538      850106 : const Operator* CommonOperatorBuilder::ResizeMergeOrPhi(const Operator* op,
    1539             :                                                         int size) {
    1540      850106 :   if (op->opcode() == IrOpcode::kPhi) {
    1541      413453 :     return Phi(PhiRepresentationOf(op), size);
    1542      436653 :   } else if (op->opcode() == IrOpcode::kEffectPhi) {
    1543      117945 :     return EffectPhi(size);
    1544      318708 :   } else if (op->opcode() == IrOpcode::kMerge) {
    1545      310161 :     return Merge(size);
    1546        8547 :   } else if (op->opcode() == IrOpcode::kLoop) {
    1547        8547 :     return Loop(size);
    1548             :   } else {
    1549           0 :     UNREACHABLE();
    1550             :   }
    1551             : }
    1552             : 
    1553             : const FrameStateFunctionInfo*
    1554      572954 : CommonOperatorBuilder::CreateFrameStateFunctionInfo(
    1555             :     FrameStateType type, int parameter_count, int local_count,
    1556             :     Handle<SharedFunctionInfo> shared_info) {
    1557             :   return new (zone()->New(sizeof(FrameStateFunctionInfo)))
    1558     1718864 :       FrameStateFunctionInfo(type, parameter_count, local_count, shared_info);
    1559             : }
    1560             : 
    1561       60016 : const Operator* CommonOperatorBuilder::DeadValue(MachineRepresentation rep) {
    1562             :   return new (zone()) Operator1<MachineRepresentation>(  // --
    1563             :       IrOpcode::kDeadValue, Operator::kPure,             // opcode
    1564             :       "DeadValue",                                       // name
    1565             :       1, 0, 0, 1, 0, 0,                                  // counts
    1566       60016 :       rep);                                              // parameter
    1567             : }
    1568             : 
    1569     3863673 : const FrameStateInfo& FrameStateInfoOf(const Operator* op) {
    1570             :   DCHECK_EQ(IrOpcode::kFrameState, op->opcode());
    1571     3863673 :   return OpParameter<FrameStateInfo>(op);
    1572             : }
    1573             : 
    1574       25902 : IsSafetyCheck CombineSafetyChecks(IsSafetyCheck a, IsSafetyCheck b) {
    1575       51804 :   if (a == IsSafetyCheck::kCriticalSafetyCheck ||
    1576       25902 :       b == IsSafetyCheck::kCriticalSafetyCheck) {
    1577             :     return IsSafetyCheck::kCriticalSafetyCheck;
    1578             :   }
    1579       22259 :   if (a == IsSafetyCheck::kSafetyCheck || b == IsSafetyCheck::kSafetyCheck) {
    1580             :     return IsSafetyCheck::kSafetyCheck;
    1581             :   }
    1582        1684 :   return IsSafetyCheck::kNoSafetyCheck;
    1583             : }
    1584             : 
    1585             : #undef COMMON_CACHED_OP_LIST
    1586             : #undef CACHED_BRANCH_LIST
    1587             : #undef CACHED_RETURN_LIST
    1588             : #undef CACHED_END_LIST
    1589             : #undef CACHED_EFFECT_PHI_LIST
    1590             : #undef CACHED_INDUCTION_VARIABLE_PHI_LIST
    1591             : #undef CACHED_LOOP_LIST
    1592             : #undef CACHED_MERGE_LIST
    1593             : #undef CACHED_DEOPTIMIZE_LIST
    1594             : #undef CACHED_DEOPTIMIZE_IF_LIST
    1595             : #undef CACHED_DEOPTIMIZE_UNLESS_LIST
    1596             : #undef CACHED_TRAP_IF_LIST
    1597             : #undef CACHED_TRAP_UNLESS_LIST
    1598             : #undef CACHED_PARAMETER_LIST
    1599             : #undef CACHED_PHI_LIST
    1600             : #undef CACHED_PROJECTION_LIST
    1601             : #undef CACHED_STATE_VALUES_LIST
    1602             : 
    1603             : }  // namespace compiler
    1604             : }  // namespace internal
    1605      122004 : }  // namespace v8

Generated by: LCOV version 1.10