opcodes.h 40.1 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_OPCODES_H_
#define V8_COMPILER_OPCODES_H_

8 9
#include <iosfwd>

10
#include "src/common/globals.h"
11

12
// Opcodes for control operators.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#define CONTROL_OP_LIST(V)           \
  V(Start)                           \
  V(Loop)                            \
  V(Branch)                          \
  V(Switch)                          \
  V(IfTrue)                          \
  V(IfFalse)                         \
  V(IfSuccess)                       \
  V(IfException)                     \
  V(IfValue)                         \
  V(IfDefault)                       \
  V(Merge)                           \
  V(Deoptimize)                      \
  V(DeoptimizeIf)                    \
  V(DeoptimizeUnless)                \
  V(DynamicCheckMapsWithDeoptUnless) \
  V(TrapIf)                          \
  V(TrapUnless)                      \
  V(Return)                          \
  V(TailCall)                        \
  V(Terminate)                       \
  V(Throw)                           \
35 36
  V(End)

37
// Opcodes for constant operators.
38 39 40
#define CONSTANT_OP_LIST(V)   \
  V(Int32Constant)            \
  V(Int64Constant)            \
41
  V(TaggedIndexConstant)      \
42 43 44 45
  V(Float32Constant)          \
  V(Float64Constant)          \
  V(ExternalConstant)         \
  V(NumberConstant)           \
46
  V(PointerConstant)          \
47
  V(HeapConstant)             \
48
  V(CompressedHeapConstant)   \
49 50
  V(RelocatableInt32Constant) \
  V(RelocatableInt64Constant)
51

52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#define INNER_OP_LIST(V)    \
  V(Select)                 \
  V(Phi)                    \
  V(EffectPhi)              \
  V(InductionVariablePhi)   \
  V(Checkpoint)             \
  V(BeginRegion)            \
  V(FinishRegion)           \
  V(FrameState)             \
  V(StateValues)            \
  V(TypedStateValues)       \
  V(ArgumentsElementsState) \
  V(ArgumentsLengthState)   \
  V(ObjectState)            \
  V(ObjectId)               \
  V(TypedObjectState)       \
  V(Call)                   \
  V(Parameter)              \
  V(OsrValue)               \
  V(LoopExit)               \
  V(LoopExitValue)          \
  V(LoopExitEffect)         \
  V(Projection)             \
  V(Retain)                 \
  V(MapGuard)               \
  V(FoldConstant)           \
78
  V(TypeGuard)
79 80

#define COMMON_OP_LIST(V) \
81
  CONSTANT_OP_LIST(V)     \
82
  INNER_OP_LIST(V)        \
83 84
  V(Unreachable)          \
  V(DeadValue)            \
85
  V(Dead)                 \
86
  V(Plug)                 \
87
  V(StaticAssert)
88 89

// Opcodes for JavaScript operators.
90 91 92 93 94 95 96 97
// Arguments are JSName (the name with a 'JS' prefix), and Name.
#define JS_COMPARE_BINOP_LIST(V)        \
  V(JSEqual, Equal)                     \
  V(JSStrictEqual, StrictEqual)         \
  V(JSLessThan, LessThan)               \
  V(JSGreaterThan, GreaterThan)         \
  V(JSLessThanOrEqual, LessThanOrEqual) \
  V(JSGreaterThanOrEqual, GreaterThanOrEqual)
98 99

#define JS_BITWISE_BINOP_LIST(V) \
100 101 102 103 104 105
  V(JSBitwiseOr, BitwiseOr)      \
  V(JSBitwiseXor, BitwiseXor)    \
  V(JSBitwiseAnd, BitwiseAnd)    \
  V(JSShiftLeft, ShiftLeft)      \
  V(JSShiftRight, ShiftRight)    \
  V(JSShiftRightLogical, ShiftRightLogical)
106 107

#define JS_ARITH_BINOP_LIST(V) \
108 109 110 111 112 113
  V(JSAdd, Add)                \
  V(JSSubtract, Subtract)      \
  V(JSMultiply, Multiply)      \
  V(JSDivide, Divide)          \
  V(JSModulus, Modulus)        \
  V(JSExponentiate, Exponentiate)
114 115 116 117

#define JS_SIMPLE_BINOP_LIST(V) \
  JS_COMPARE_BINOP_LIST(V)      \
  JS_BITWISE_BINOP_LIST(V)      \
118
  JS_ARITH_BINOP_LIST(V)        \
119
  V(JSHasInPrototypeChain)      \
120 121
  V(JSInstanceOf)               \
  V(JSOrdinaryHasInstance)
122 123

#define JS_CONVERSION_UNOP_LIST(V) \
124
  V(JSToLength)                    \
125
  V(JSToName)                      \
126
  V(JSToNumber)                    \
127
  V(JSToNumberConvertBigInt)       \
128
  V(JSToNumeric)                   \
129
  V(JSToObject)                    \
130 131
  V(JSToString)                    \
  V(JSParseInt)
132

133 134 135 136 137 138 139 140
#define JS_BITWISE_UNOP_LIST(V) \
  V(JSBitwiseNot, BitwiseNot)   \
  V(JSNegate, Negate)

#define JS_ARITH_UNOP_LIST(V) \
  V(JSDecrement, Decrement)   \
  V(JSIncrement, Increment)

141
#define JS_SIMPLE_UNOP_LIST(V) \
142 143 144
  JS_ARITH_UNOP_LIST(V)        \
  JS_BITWISE_UNOP_LIST(V)      \
  JS_CONVERSION_UNOP_LIST(V)
145

146
#define JS_CREATE_OP_LIST(V)     \
147
  V(JSCloneObject)               \
148 149 150
  V(JSCreate)                    \
  V(JSCreateArguments)           \
  V(JSCreateArray)               \
151
  V(JSCreateArrayFromIterable)   \
152 153 154 155 156
  V(JSCreateArrayIterator)       \
  V(JSCreateAsyncFunctionObject) \
  V(JSCreateBoundFunction)       \
  V(JSCreateClosure)             \
  V(JSCreateCollectionIterator)  \
157 158
  V(JSCreateEmptyLiteralArray)   \
  V(JSCreateEmptyLiteralObject)  \
159 160 161 162 163
  V(JSCreateGeneratorObject)     \
  V(JSCreateIterResultObject)    \
  V(JSCreateKeyValueArray)       \
  V(JSCreateLiteralArray)        \
  V(JSCreateLiteralObject)       \
164 165 166 167
  V(JSCreateLiteralRegExp)       \
  V(JSCreateObject)              \
  V(JSCreatePromise)             \
  V(JSCreateStringIterator)      \
168 169
  V(JSCreateTypedArray)          \
  V(JSGetTemplateObject)
170

171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
#define JS_OBJECT_OP_LIST(V)           \
  JS_CREATE_OP_LIST(V)                 \
  V(JSLoadProperty)                    \
  V(JSLoadNamed)                       \
  V(JSLoadNamedFromSuper)              \
  V(JSLoadGlobal)                      \
  V(JSSetKeyedProperty)                \
  V(JSDefineKeyedOwnProperty)          \
  V(JSSetNamedProperty)                \
  V(JSDefineNamedOwnProperty)          \
  V(JSStoreGlobal)                     \
  V(JSDefineKeyedOwnPropertyInLiteral) \
  V(JSStoreInArrayLiteral)             \
  V(JSDeleteProperty)                  \
  V(JSHasProperty)                     \
186
  V(JSGetSuperConstructor)
187 188

#define JS_CONTEXT_OP_LIST(V) \
189
  V(JSHasContextExtension)    \
190 191 192 193 194
  V(JSLoadContext)            \
  V(JSStoreContext)           \
  V(JSCreateFunctionContext)  \
  V(JSCreateCatchContext)     \
  V(JSCreateWithContext)      \
195
  V(JSCreateBlockContext)
196

197 198 199 200
#define JS_CALL_OP_LIST(V) \
  V(JSCall)                \
  V(JSCallForwardVarargs)  \
  V(JSCallWithArrayLike)   \
201
  V(JSCallWithSpread)      \
202
  IF_WASM(V, JSWasmCall)
203

204 205 206 207 208 209
#define JS_CONSTRUCT_OP_LIST(V) \
  V(JSConstructForwardVarargs)  \
  V(JSConstruct)                \
  V(JSConstructWithArrayLike)   \
  V(JSConstructWithSpread)

210
#define JS_OTHER_OP_LIST(V)            \
211
  JS_CALL_OP_LIST(V)                   \
212
  JS_CONSTRUCT_OP_LIST(V)              \
213 214 215
  V(JSAsyncFunctionEnter)              \
  V(JSAsyncFunctionReject)             \
  V(JSAsyncFunctionResolve)            \
216 217 218 219
  V(JSCallRuntime)                     \
  V(JSForInEnumerate)                  \
  V(JSForInNext)                       \
  V(JSForInPrepare)                    \
220
  V(JSGetIterator)                     \
221 222 223 224
  V(JSLoadMessage)                     \
  V(JSStoreMessage)                    \
  V(JSLoadModule)                      \
  V(JSStoreModule)                     \
225
  V(JSGetImportMeta)                   \
226 227
  V(JSGeneratorStore)                  \
  V(JSGeneratorRestoreContinuation)    \
228
  V(JSGeneratorRestoreContext)         \
229 230
  V(JSGeneratorRestoreRegister)        \
  V(JSGeneratorRestoreInputOrDebugPos) \
231
  V(JSFulfillPromise)                  \
232
  V(JSPerformPromiseThen)              \
233
  V(JSPromiseResolve)                  \
234 235
  V(JSRejectPromise)                   \
  V(JSResolvePromise)                  \
236
  V(JSStackCheck)                      \
237
  V(JSObjectIsArray)                   \
238
  V(JSRegExpTest)                      \
239
  V(JSDebugger)
240 241 242 243 244 245 246 247

#define JS_OP_LIST(V)     \
  JS_SIMPLE_BINOP_LIST(V) \
  JS_SIMPLE_UNOP_LIST(V)  \
  JS_OBJECT_OP_LIST(V)    \
  JS_CONTEXT_OP_LIST(V)   \
  JS_OTHER_OP_LIST(V)

248
// Opcodes for VirtuaMachine-level operators.
249 250
#define SIMPLIFIED_CHANGE_OP_LIST(V) \
  V(ChangeTaggedSignedToInt32)       \
251
  V(ChangeTaggedSignedToInt64)       \
252
  V(ChangeTaggedToInt32)             \
253
  V(ChangeTaggedToInt64)             \
254 255
  V(ChangeTaggedToUint32)            \
  V(ChangeTaggedToFloat64)           \
256
  V(ChangeTaggedToTaggedSigned)      \
257 258
  V(ChangeInt31ToTaggedSigned)       \
  V(ChangeInt32ToTagged)             \
259
  V(ChangeInt64ToTagged)             \
260
  V(ChangeUint32ToTagged)            \
261
  V(ChangeUint64ToTagged)            \
262
  V(ChangeFloat64ToTagged)           \
263
  V(ChangeFloat64ToTaggedPointer)    \
264 265
  V(ChangeTaggedToBit)               \
  V(ChangeBitToTagged)               \
266
  V(ChangeInt64ToBigInt)             \
267
  V(ChangeUint64ToBigInt)            \
268
  V(TruncateBigIntToWord64)          \
269
  V(TruncateTaggedToWord32)          \
270
  V(TruncateTaggedToFloat64)         \
271 272
  V(TruncateTaggedToBit)             \
  V(TruncateTaggedPointerToBit)
273 274 275 276

#define SIMPLIFIED_CHECKED_OP_LIST(V) \
  V(CheckedInt32Add)                  \
  V(CheckedInt32Sub)                  \
277 278
  V(CheckedInt32Div)                  \
  V(CheckedInt32Mod)                  \
279 280
  V(CheckedUint32Div)                 \
  V(CheckedUint32Mod)                 \
281
  V(CheckedInt32Mul)                  \
282
  V(CheckedInt32ToTaggedSigned)       \
283 284
  V(CheckedInt64ToInt32)              \
  V(CheckedInt64ToTaggedSigned)       \
285
  V(CheckedUint32Bounds)              \
286
  V(CheckedUint32ToInt32)             \
287
  V(CheckedUint32ToTaggedSigned)      \
288
  V(CheckedUint64Bounds)              \
289 290
  V(CheckedUint64ToInt32)             \
  V(CheckedUint64ToTaggedSigned)      \
291
  V(CheckedFloat64ToInt32)            \
292
  V(CheckedFloat64ToInt64)            \
293
  V(CheckedTaggedSignedToInt32)       \
294
  V(CheckedTaggedToInt32)             \
295
  V(CheckedTaggedToArrayIndex)        \
296
  V(CheckedTruncateTaggedToWord32)    \
297
  V(CheckedTaggedToFloat64)           \
298
  V(CheckedTaggedToInt64)             \
299
  V(CheckedTaggedToTaggedSigned)      \
300
  V(CheckedTaggedToTaggedPointer)
301

302 303 304 305
#define SIMPLIFIED_COMPARE_BINOP_LIST(V) \
  V(NumberEqual)                         \
  V(NumberLessThan)                      \
  V(NumberLessThanOrEqual)               \
306 307 308
  V(SpeculativeNumberEqual)              \
  V(SpeculativeNumberLessThan)           \
  V(SpeculativeNumberLessThanOrEqual)    \
309
  V(ReferenceEqual)                      \
310
  V(SameValue)                           \
311
  V(SameValueNumbersOnly)                \
312
  V(NumberSameValue)                     \
313 314 315 316
  V(StringEqual)                         \
  V(StringLessThan)                      \
  V(StringLessThanOrEqual)

317
#define SIMPLIFIED_NUMBER_BINOP_LIST(V) \
318 319 320 321 322 323 324 325 326
  V(NumberAdd)                          \
  V(NumberSubtract)                     \
  V(NumberMultiply)                     \
  V(NumberDivide)                       \
  V(NumberModulus)                      \
  V(NumberBitwiseOr)                    \
  V(NumberBitwiseXor)                   \
  V(NumberBitwiseAnd)                   \
  V(NumberShiftLeft)                    \
327 328
  V(NumberShiftRight)                   \
  V(NumberShiftRightLogical)            \
329
  V(NumberAtan2)                        \
330
  V(NumberImul)                         \
331 332
  V(NumberMax)                          \
  V(NumberMin)                          \
333 334
  V(NumberPow)

335 336 337
#define SIMPLIFIED_BIGINT_BINOP_LIST(V) \
  V(BigIntAdd)                          \
  V(BigIntSubtract)
338

339 340 341 342
#define SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
  V(SpeculativeNumberAdd)                           \
  V(SpeculativeNumberSubtract)                      \
  V(SpeculativeNumberMultiply)                      \
343
  V(SpeculativeNumberPow)                           \
344 345 346 347 348 349 350
  V(SpeculativeNumberDivide)                        \
  V(SpeculativeNumberModulus)                       \
  V(SpeculativeNumberBitwiseAnd)                    \
  V(SpeculativeNumberBitwiseOr)                     \
  V(SpeculativeNumberBitwiseXor)                    \
  V(SpeculativeNumberShiftLeft)                     \
  V(SpeculativeNumberShiftRight)                    \
351 352 353
  V(SpeculativeNumberShiftRightLogical)             \
  V(SpeculativeSafeIntegerAdd)                      \
  V(SpeculativeSafeIntegerSubtract)
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383

#define SIMPLIFIED_NUMBER_UNOP_LIST(V) \
  V(NumberAbs)                         \
  V(NumberAcos)                        \
  V(NumberAcosh)                       \
  V(NumberAsin)                        \
  V(NumberAsinh)                       \
  V(NumberAtan)                        \
  V(NumberAtanh)                       \
  V(NumberCbrt)                        \
  V(NumberCeil)                        \
  V(NumberClz32)                       \
  V(NumberCos)                         \
  V(NumberCosh)                        \
  V(NumberExp)                         \
  V(NumberExpm1)                       \
  V(NumberFloor)                       \
  V(NumberFround)                      \
  V(NumberLog)                         \
  V(NumberLog1p)                       \
  V(NumberLog2)                        \
  V(NumberLog10)                       \
  V(NumberRound)                       \
  V(NumberSign)                        \
  V(NumberSin)                         \
  V(NumberSinh)                        \
  V(NumberSqrt)                        \
  V(NumberTan)                         \
  V(NumberTanh)                        \
  V(NumberTrunc)                       \
384
  V(NumberToBoolean)                   \
385
  V(NumberToInt32)                     \
386
  V(NumberToString)                    \
387
  V(NumberToUint32)                    \
388
  V(NumberToUint8Clamped)              \
389 390
  V(NumberSilenceNaN)

391
#define SIMPLIFIED_BIGINT_UNOP_LIST(V) \
392
  V(BigIntNegate)                      \
393 394
  V(CheckBigInt)

395 396
#define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) V(SpeculativeToNumber)

397
#define SIMPLIFIED_OTHER_OP_LIST(V)     \
398 399 400 401
  V(Allocate)                           \
  V(AllocateRaw)                        \
  V(ArgumentsLength)                    \
  V(AssertType)                         \
402 403
  V(BooleanNot)                         \
  V(CheckBounds)                        \
404 405 406 407 408
  V(CheckClosure)                       \
  V(CheckEqualsInternalizedString)      \
  V(CheckEqualsSymbol)                  \
  V(CheckFloat64Hole)                   \
  V(CheckHeapObject)                    \
409
  V(CheckIf)                            \
410
  V(CheckInternalizedString)            \
411
  V(CheckMaps)                          \
412
  V(CheckNotTaggedHole)                 \
413 414
  V(CheckNumber)                        \
  V(CheckReceiver)                      \
415
  V(CheckReceiverOrNullOrUndefined)     \
416
  V(CheckSmi)                           \
417 418 419
  V(CheckString)                        \
  V(CheckSymbol)                        \
  V(CompareMaps)                        \
420
  V(ConvertReceiver)                    \
421
  V(ConvertTaggedHoleToUndefined)       \
422 423 424 425 426 427 428
  V(DateNow)                            \
  V(DelayedStringConstant)              \
  V(DynamicCheckMaps)                   \
  V(EnsureWritableFastElements)         \
  V(FastApiCall)                        \
  V(FindOrderedHashMapEntry)            \
  V(FindOrderedHashMapEntryForInt32Key) \
429
  V(InitializeImmutableInObject)        \
430
  V(LoadDataViewElement)                \
431
  V(LoadElement)                        \
432 433
  V(LoadField)                          \
  V(LoadFieldByIndex)                   \
434
  V(LoadFromObject)                     \
435
  V(LoadImmutableFromObject)            \
436
  V(LoadMessage)                        \
437
  V(LoadStackArgument)                  \
438 439 440 441 442 443
  V(LoadTypedElement)                   \
  V(MaybeGrowFastElements)              \
  V(NewArgumentsElements)               \
  V(NewConsString)                      \
  V(NewDoubleElements)                  \
  V(NewSmiOrObjectElements)             \
444
  V(NumberIsFinite)                     \
445
  V(NumberIsFloat64Hole)                \
446
  V(NumberIsInteger)                    \
447 448
  V(NumberIsMinusZero)                  \
  V(NumberIsNaN)                        \
449
  V(NumberIsSafeInteger)                \
450
  V(ObjectIsArrayBufferView)            \
451
  V(ObjectIsBigInt)                     \
452 453 454
  V(ObjectIsCallable)                   \
  V(ObjectIsConstructor)                \
  V(ObjectIsDetectableCallable)         \
455 456
  V(ObjectIsFiniteNumber)               \
  V(ObjectIsInteger)                    \
457 458 459 460 461
  V(ObjectIsMinusZero)                  \
  V(ObjectIsNaN)                        \
  V(ObjectIsNonCallable)                \
  V(ObjectIsNumber)                     \
  V(ObjectIsReceiver)                   \
462
  V(ObjectIsSafeInteger)                \
463 464 465 466
  V(ObjectIsSmi)                        \
  V(ObjectIsString)                     \
  V(ObjectIsSymbol)                     \
  V(ObjectIsUndetectable)               \
467 468 469 470
  V(PlainPrimitiveToFloat64)            \
  V(PlainPrimitiveToNumber)             \
  V(PlainPrimitiveToWord32)             \
  V(RestLength)                         \
471
  V(RuntimeAbort)                       \
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
  V(StoreDataViewElement)               \
  V(StoreElement)                       \
  V(StoreField)                         \
  V(StoreMessage)                       \
  V(StoreSignedSmallElement)            \
  V(StoreToObject)                      \
  V(StoreTypedElement)                  \
  V(StringCharCodeAt)                   \
  V(StringCodePointAt)                  \
  V(StringConcat)                       \
  V(StringFromCodePointAt)              \
  V(StringFromSingleCharCode)           \
  V(StringFromSingleCodePoint)          \
  V(StringIndexOf)                      \
  V(StringLength)                       \
  V(StringSubstring)                    \
  V(StringToLowerCaseIntl)              \
  V(StringToNumber)                     \
  V(StringToUpperCaseIntl)              \
  V(ToBoolean)                          \
  V(TransitionAndStoreElement)          \
  V(TransitionAndStoreNonNumberElement) \
  V(TransitionAndStoreNumberElement)    \
  V(TransitionElementsKind)             \
  V(TypeOf)                             \
497
  V(VerifyType)
498

499 500 501 502
#define SIMPLIFIED_SPECULATIVE_BIGINT_BINOP_LIST(V) \
  V(SpeculativeBigIntAdd)                           \
  V(SpeculativeBigIntSubtract)

503
#define SIMPLIFIED_SPECULATIVE_BIGINT_UNOP_LIST(V) \
504
  V(SpeculativeBigIntAsIntN)                       \
505 506
  V(SpeculativeBigIntAsUintN)                      \
  V(SpeculativeBigIntNegate)
507

508 509 510 511 512
#define SIMPLIFIED_OP_LIST(V)                 \
  SIMPLIFIED_CHANGE_OP_LIST(V)                \
  SIMPLIFIED_CHECKED_OP_LIST(V)               \
  SIMPLIFIED_COMPARE_BINOP_LIST(V)            \
  SIMPLIFIED_NUMBER_BINOP_LIST(V)             \
513
  SIMPLIFIED_BIGINT_BINOP_LIST(V)             \
514 515
  SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \
  SIMPLIFIED_NUMBER_UNOP_LIST(V)              \
516
  SIMPLIFIED_BIGINT_UNOP_LIST(V)              \
517
  SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V)  \
518
  SIMPLIFIED_SPECULATIVE_BIGINT_UNOP_LIST(V)  \
519
  SIMPLIFIED_SPECULATIVE_BIGINT_BINOP_LIST(V) \
520 521
  SIMPLIFIED_OTHER_OP_LIST(V)

522
// Opcodes for Machine-level operators.
523 524 525 526 527 528 529 530 531 532
#define MACHINE_COMPARE_BINOP_LIST(V) \
  V(Word32Equal)                      \
  V(Word64Equal)                      \
  V(Int32LessThan)                    \
  V(Int32LessThanOrEqual)             \
  V(Uint32LessThan)                   \
  V(Uint32LessThanOrEqual)            \
  V(Int64LessThan)                    \
  V(Int64LessThanOrEqual)             \
  V(Uint64LessThan)                   \
533
  V(Uint64LessThanOrEqual)            \
534 535 536
  V(Float32Equal)                     \
  V(Float32LessThan)                  \
  V(Float32LessThanOrEqual)           \
537 538 539 540
  V(Float64Equal)                     \
  V(Float64LessThan)                  \
  V(Float64LessThanOrEqual)

541 542 543
#define MACHINE_UNOP_32_LIST(V) \
  V(Word32Clz)                  \
  V(Word32Ctz)                  \
544
  V(Int32AbsWithOverflow)       \
545 546 547 548 549 550 551 552 553 554
  V(Word32ReverseBits)          \
  V(Word32ReverseBytes)

#define MACHINE_BINOP_32_LIST(V) \
  V(Word32And)                   \
  V(Word32Or)                    \
  V(Word32Xor)                   \
  V(Word32Shl)                   \
  V(Word32Shr)                   \
  V(Word32Sar)                   \
555
  V(Word32Rol)                   \
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
  V(Word32Ror)                   \
  V(Int32Add)                    \
  V(Int32AddWithOverflow)        \
  V(Int32Sub)                    \
  V(Int32SubWithOverflow)        \
  V(Int32Mul)                    \
  V(Int32MulWithOverflow)        \
  V(Int32MulHigh)                \
  V(Int32Div)                    \
  V(Int32Mod)                    \
  V(Uint32Div)                   \
  V(Uint32Mod)                   \
  V(Uint32MulHigh)

#define MACHINE_BINOP_64_LIST(V) \
  V(Word64And)                   \
  V(Word64Or)                    \
  V(Word64Xor)                   \
  V(Word64Shl)                   \
  V(Word64Shr)                   \
  V(Word64Sar)                   \
577
  V(Word64Rol)                   \
578
  V(Word64Ror)                   \
579 580
  V(Word64RolLowerable)          \
  V(Word64RorLowerable)          \
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
  V(Int64Add)                    \
  V(Int64AddWithOverflow)        \
  V(Int64Sub)                    \
  V(Int64SubWithOverflow)        \
  V(Int64Mul)                    \
  V(Int64Div)                    \
  V(Int64Mod)                    \
  V(Uint64Div)                   \
  V(Uint64Mod)

#define MACHINE_FLOAT32_UNOP_LIST(V) \
  V(Float32Abs)                      \
  V(Float32Neg)                      \
  V(Float32RoundDown)                \
  V(Float32RoundTiesEven)            \
  V(Float32RoundTruncate)            \
  V(Float32RoundUp)                  \
  V(Float32Sqrt)

#define MACHINE_FLOAT32_BINOP_LIST(V) \
  V(Float32Add)                       \
  V(Float32Sub)                       \
  V(Float32Mul)                       \
  V(Float32Div)                       \
  V(Float32Max)                       \
  V(Float32Min)

#define MACHINE_FLOAT64_UNOP_LIST(V) \
  V(Float64Abs)                      \
  V(Float64Acos)                     \
  V(Float64Acosh)                    \
  V(Float64Asin)                     \
  V(Float64Asinh)                    \
  V(Float64Atan)                     \
  V(Float64Atanh)                    \
  V(Float64Cbrt)                     \
  V(Float64Cos)                      \
  V(Float64Cosh)                     \
  V(Float64Exp)                      \
  V(Float64Expm1)                    \
  V(Float64Log)                      \
  V(Float64Log1p)                    \
  V(Float64Log10)                    \
  V(Float64Log2)                     \
  V(Float64Neg)                      \
  V(Float64RoundDown)                \
  V(Float64RoundTiesAway)            \
  V(Float64RoundTiesEven)            \
  V(Float64RoundTruncate)            \
  V(Float64RoundUp)                  \
  V(Float64Sin)                      \
  V(Float64Sinh)                     \
  V(Float64Sqrt)                     \
  V(Float64Tan)                      \
  V(Float64Tanh)

#define MACHINE_FLOAT64_BINOP_LIST(V) \
  V(Float64Atan2)                     \
  V(Float64Max)                       \
  V(Float64Min)                       \
  V(Float64Add)                       \
  V(Float64Sub)                       \
  V(Float64Mul)                       \
  V(Float64Div)                       \
  V(Float64Mod)                       \
  V(Float64Pow)

648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674
#define MACHINE_ATOMIC_OP_LIST(V)    \
  V(Word32AtomicLoad)                \
  V(Word32AtomicStore)               \
  V(Word32AtomicExchange)            \
  V(Word32AtomicCompareExchange)     \
  V(Word32AtomicAdd)                 \
  V(Word32AtomicSub)                 \
  V(Word32AtomicAnd)                 \
  V(Word32AtomicOr)                  \
  V(Word32AtomicXor)                 \
  V(Word32AtomicPairLoad)            \
  V(Word32AtomicPairStore)           \
  V(Word32AtomicPairAdd)             \
  V(Word32AtomicPairSub)             \
  V(Word32AtomicPairAnd)             \
  V(Word32AtomicPairOr)              \
  V(Word32AtomicPairXor)             \
  V(Word32AtomicPairExchange)        \
  V(Word32AtomicPairCompareExchange) \
  V(Word64AtomicLoad)                \
  V(Word64AtomicStore)               \
  V(Word64AtomicAdd)                 \
  V(Word64AtomicSub)                 \
  V(Word64AtomicAnd)                 \
  V(Word64AtomicOr)                  \
  V(Word64AtomicXor)                 \
  V(Word64AtomicExchange)            \
675
  V(Word64AtomicCompareExchange)
676

677 678 679 680 681 682 683 684 685 686
#define MACHINE_OP_LIST(V)               \
  MACHINE_UNOP_32_LIST(V)                \
  MACHINE_BINOP_32_LIST(V)               \
  MACHINE_BINOP_64_LIST(V)               \
  MACHINE_COMPARE_BINOP_LIST(V)          \
  MACHINE_FLOAT32_BINOP_LIST(V)          \
  MACHINE_FLOAT32_UNOP_LIST(V)           \
  MACHINE_FLOAT64_BINOP_LIST(V)          \
  MACHINE_FLOAT64_UNOP_LIST(V)           \
  MACHINE_ATOMIC_OP_LIST(V)              \
687
  V(AbortCSADcheck)                      \
688 689 690
  V(DebugBreak)                          \
  V(Comment)                             \
  V(Load)                                \
691
  V(LoadImmutable)                       \
692 693 694 695 696 697
  V(Store)                               \
  V(StackSlot)                           \
  V(Word32Popcnt)                        \
  V(Word64Popcnt)                        \
  V(Word64Clz)                           \
  V(Word64Ctz)                           \
698 699
  V(Word64ClzLowerable)                  \
  V(Word64CtzLowerable)                  \
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745
  V(Word64ReverseBits)                   \
  V(Word64ReverseBytes)                  \
  V(Simd128ReverseBytes)                 \
  V(Int64AbsWithOverflow)                \
  V(BitcastTaggedToWord)                 \
  V(BitcastTaggedToWordForTagAndSmiBits) \
  V(BitcastWordToTagged)                 \
  V(BitcastWordToTaggedSigned)           \
  V(TruncateFloat64ToWord32)             \
  V(ChangeFloat32ToFloat64)              \
  V(ChangeFloat64ToInt32)                \
  V(ChangeFloat64ToInt64)                \
  V(ChangeFloat64ToUint32)               \
  V(ChangeFloat64ToUint64)               \
  V(Float64SilenceNaN)                   \
  V(TruncateFloat64ToInt64)              \
  V(TruncateFloat64ToUint32)             \
  V(TruncateFloat32ToInt32)              \
  V(TruncateFloat32ToUint32)             \
  V(TryTruncateFloat32ToInt64)           \
  V(TryTruncateFloat64ToInt64)           \
  V(TryTruncateFloat32ToUint64)          \
  V(TryTruncateFloat64ToUint64)          \
  V(ChangeInt32ToFloat64)                \
  V(BitcastWord32ToWord64)               \
  V(ChangeInt32ToInt64)                  \
  V(ChangeInt64ToFloat64)                \
  V(ChangeUint32ToFloat64)               \
  V(ChangeUint32ToUint64)                \
  V(TruncateFloat64ToFloat32)            \
  V(TruncateInt64ToInt32)                \
  V(RoundFloat64ToInt32)                 \
  V(RoundInt32ToFloat32)                 \
  V(RoundInt64ToFloat32)                 \
  V(RoundInt64ToFloat64)                 \
  V(RoundUint32ToFloat32)                \
  V(RoundUint64ToFloat32)                \
  V(RoundUint64ToFloat64)                \
  V(BitcastFloat32ToInt32)               \
  V(BitcastFloat64ToInt64)               \
  V(BitcastInt32ToFloat32)               \
  V(BitcastInt64ToFloat64)               \
  V(Float64ExtractLowWord32)             \
  V(Float64ExtractHighWord32)            \
  V(Float64InsertLowWord32)              \
  V(Float64InsertHighWord32)             \
746 747
  V(Word32Select)                        \
  V(Word64Select)                        \
748 749
  V(Float32Select)                       \
  V(Float64Select)                       \
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
  V(LoadStackCheckOffset)                \
  V(LoadFramePointer)                    \
  V(LoadParentFramePointer)              \
  V(UnalignedLoad)                       \
  V(UnalignedStore)                      \
  V(Int32PairAdd)                        \
  V(Int32PairSub)                        \
  V(Int32PairMul)                        \
  V(Word32PairShl)                       \
  V(Word32PairShr)                       \
  V(Word32PairSar)                       \
  V(ProtectedLoad)                       \
  V(ProtectedStore)                      \
  V(MemoryBarrier)                       \
  V(SignExtendWord8ToInt32)              \
  V(SignExtendWord16ToInt32)             \
  V(SignExtendWord8ToInt64)              \
  V(SignExtendWord16ToInt64)             \
  V(SignExtendWord32ToInt64)             \
  V(UnsafePointerAdd)                    \
770
  V(StackPointerGreaterThan)
771

772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
#define MACHINE_SIMD_OP_LIST(V)  \
  V(F64x2Splat)                  \
  V(F64x2ExtractLane)            \
  V(F64x2ReplaceLane)            \
  V(F64x2Abs)                    \
  V(F64x2Neg)                    \
  V(F64x2Sqrt)                   \
  V(F64x2Add)                    \
  V(F64x2Sub)                    \
  V(F64x2Mul)                    \
  V(F64x2Div)                    \
  V(F64x2Min)                    \
  V(F64x2Max)                    \
  V(F64x2Eq)                     \
  V(F64x2Ne)                     \
  V(F64x2Lt)                     \
  V(F64x2Le)                     \
  V(F64x2Qfma)                   \
  V(F64x2Qfms)                   \
  V(F64x2Pmin)                   \
  V(F64x2Pmax)                   \
  V(F64x2Ceil)                   \
  V(F64x2Floor)                  \
  V(F64x2Trunc)                  \
  V(F64x2NearestInt)             \
  V(F64x2ConvertLowI32x4S)       \
  V(F64x2ConvertLowI32x4U)       \
  V(F64x2PromoteLowF32x4)        \
  V(F32x4Splat)                  \
  V(F32x4ExtractLane)            \
  V(F32x4ReplaceLane)            \
  V(F32x4SConvertI32x4)          \
  V(F32x4UConvertI32x4)          \
  V(F32x4Abs)                    \
  V(F32x4Neg)                    \
  V(F32x4Sqrt)                   \
  V(F32x4RecipApprox)            \
  V(F32x4RecipSqrtApprox)        \
  V(F32x4Add)                    \
  V(F32x4Sub)                    \
  V(F32x4Mul)                    \
  V(F32x4Div)                    \
  V(F32x4Min)                    \
  V(F32x4Max)                    \
  V(F32x4Eq)                     \
  V(F32x4Ne)                     \
  V(F32x4Lt)                     \
  V(F32x4Le)                     \
  V(F32x4Gt)                     \
  V(F32x4Ge)                     \
  V(F32x4Qfma)                   \
  V(F32x4Qfms)                   \
  V(F32x4Pmin)                   \
  V(F32x4Pmax)                   \
  V(F32x4Ceil)                   \
  V(F32x4Floor)                  \
  V(F32x4Trunc)                  \
  V(F32x4NearestInt)             \
  V(F32x4DemoteF64x2Zero)        \
  V(I64x2Splat)                  \
  V(I64x2SplatI32Pair)           \
  V(I64x2ExtractLane)            \
  V(I64x2ReplaceLane)            \
  V(I64x2ReplaceLaneI32Pair)     \
  V(I64x2Abs)                    \
  V(I64x2Neg)                    \
  V(I64x2SConvertI32x4Low)       \
  V(I64x2SConvertI32x4High)      \
  V(I64x2UConvertI32x4Low)       \
  V(I64x2UConvertI32x4High)      \
  V(I64x2BitMask)                \
  V(I64x2Shl)                    \
  V(I64x2ShrS)                   \
  V(I64x2Add)                    \
  V(I64x2Sub)                    \
  V(I64x2Mul)                    \
  V(I64x2Eq)                     \
  V(I64x2Ne)                     \
  V(I64x2GtS)                    \
  V(I64x2GeS)                    \
  V(I64x2ShrU)                   \
  V(I64x2ExtMulLowI32x4S)        \
  V(I64x2ExtMulHighI32x4S)       \
  V(I64x2ExtMulLowI32x4U)        \
  V(I64x2ExtMulHighI32x4U)       \
  V(I32x4Splat)                  \
  V(I32x4ExtractLane)            \
  V(I32x4ReplaceLane)            \
  V(I32x4SConvertF32x4)          \
  V(I32x4SConvertI16x8Low)       \
  V(I32x4SConvertI16x8High)      \
  V(I32x4Neg)                    \
  V(I32x4Shl)                    \
  V(I32x4ShrS)                   \
  V(I32x4Add)                    \
  V(I32x4Sub)                    \
  V(I32x4Mul)                    \
  V(I32x4MinS)                   \
  V(I32x4MaxS)                   \
  V(I32x4Eq)                     \
  V(I32x4Ne)                     \
  V(I32x4LtS)                    \
  V(I32x4LeS)                    \
  V(I32x4GtS)                    \
  V(I32x4GeS)                    \
  V(I32x4UConvertF32x4)          \
  V(I32x4UConvertI16x8Low)       \
  V(I32x4UConvertI16x8High)      \
  V(I32x4ShrU)                   \
  V(I32x4MinU)                   \
  V(I32x4MaxU)                   \
  V(I32x4LtU)                    \
  V(I32x4LeU)                    \
  V(I32x4GtU)                    \
  V(I32x4GeU)                    \
  V(I32x4Abs)                    \
  V(I32x4BitMask)                \
  V(I32x4DotI16x8S)              \
  V(I32x4ExtMulLowI16x8S)        \
  V(I32x4ExtMulHighI16x8S)       \
  V(I32x4ExtMulLowI16x8U)        \
  V(I32x4ExtMulHighI16x8U)       \
  V(I32x4ExtAddPairwiseI16x8S)   \
  V(I32x4ExtAddPairwiseI16x8U)   \
  V(I32x4TruncSatF64x2SZero)     \
  V(I32x4TruncSatF64x2UZero)     \
  V(I16x8Splat)                  \
  V(I16x8ExtractLaneU)           \
  V(I16x8ExtractLaneS)           \
  V(I16x8ReplaceLane)            \
  V(I16x8SConvertI8x16Low)       \
  V(I16x8SConvertI8x16High)      \
  V(I16x8Neg)                    \
  V(I16x8Shl)                    \
  V(I16x8ShrS)                   \
  V(I16x8SConvertI32x4)          \
  V(I16x8Add)                    \
  V(I16x8AddSatS)                \
  V(I16x8Sub)                    \
  V(I16x8SubSatS)                \
  V(I16x8Mul)                    \
  V(I16x8MinS)                   \
  V(I16x8MaxS)                   \
  V(I16x8Eq)                     \
  V(I16x8Ne)                     \
  V(I16x8LtS)                    \
  V(I16x8LeS)                    \
  V(I16x8GtS)                    \
  V(I16x8GeS)                    \
  V(I16x8UConvertI8x16Low)       \
  V(I16x8UConvertI8x16High)      \
  V(I16x8ShrU)                   \
  V(I16x8UConvertI32x4)          \
  V(I16x8AddSatU)                \
  V(I16x8SubSatU)                \
  V(I16x8MinU)                   \
  V(I16x8MaxU)                   \
  V(I16x8LtU)                    \
  V(I16x8LeU)                    \
  V(I16x8GtU)                    \
  V(I16x8GeU)                    \
  V(I16x8RoundingAverageU)       \
  V(I16x8Q15MulRSatS)            \
  V(I16x8Abs)                    \
  V(I16x8BitMask)                \
  V(I16x8ExtMulLowI8x16S)        \
  V(I16x8ExtMulHighI8x16S)       \
  V(I16x8ExtMulLowI8x16U)        \
  V(I16x8ExtMulHighI8x16U)       \
  V(I16x8ExtAddPairwiseI8x16S)   \
  V(I16x8ExtAddPairwiseI8x16U)   \
  V(I8x16Splat)                  \
  V(I8x16ExtractLaneU)           \
  V(I8x16ExtractLaneS)           \
  V(I8x16ReplaceLane)            \
  V(I8x16SConvertI16x8)          \
  V(I8x16Neg)                    \
  V(I8x16Shl)                    \
  V(I8x16ShrS)                   \
  V(I8x16Add)                    \
  V(I8x16AddSatS)                \
  V(I8x16Sub)                    \
  V(I8x16SubSatS)                \
  V(I8x16MinS)                   \
  V(I8x16MaxS)                   \
  V(I8x16Eq)                     \
  V(I8x16Ne)                     \
  V(I8x16LtS)                    \
  V(I8x16LeS)                    \
  V(I8x16GtS)                    \
  V(I8x16GeS)                    \
  V(I8x16UConvertI16x8)          \
  V(I8x16AddSatU)                \
  V(I8x16SubSatU)                \
  V(I8x16ShrU)                   \
  V(I8x16MinU)                   \
  V(I8x16MaxU)                   \
  V(I8x16LtU)                    \
  V(I8x16LeU)                    \
  V(I8x16GtU)                    \
  V(I8x16GeU)                    \
  V(I8x16RoundingAverageU)       \
  V(I8x16Popcnt)                 \
  V(I8x16Abs)                    \
  V(I8x16BitMask)                \
  V(S128Zero)                    \
  V(S128Const)                   \
  V(S128Not)                     \
  V(S128And)                     \
  V(S128Or)                      \
  V(S128Xor)                     \
  V(S128Select)                  \
  V(S128AndNot)                  \
  V(I8x16Swizzle)                \
  V(I8x16RelaxedLaneSelect)      \
  V(I16x8RelaxedLaneSelect)      \
  V(I32x4RelaxedLaneSelect)      \
  V(I64x2RelaxedLaneSelect)      \
  V(F32x4RelaxedMin)             \
  V(F32x4RelaxedMax)             \
  V(F64x2RelaxedMin)             \
  V(F64x2RelaxedMax)             \
  V(I32x4RelaxedTruncF32x4S)     \
  V(I32x4RelaxedTruncF32x4U)     \
  V(I32x4RelaxedTruncF64x2SZero) \
  V(I32x4RelaxedTruncF64x2UZero) \
  V(I8x16Shuffle)                \
  V(V128AnyTrue)                 \
  V(I64x2AllTrue)                \
  V(I32x4AllTrue)                \
  V(I16x8AllTrue)                \
  V(I8x16AllTrue)                \
  V(LoadTransform)               \
  V(LoadLane)                    \
1006
  V(StoreLane)
1007 1008 1009 1010 1011 1012

#define VALUE_OP_LIST(V)  \
  COMMON_OP_LIST(V)       \
  SIMPLIFIED_OP_LIST(V)   \
  MACHINE_OP_LIST(V)      \
  MACHINE_SIMD_OP_LIST(V) \
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
  JS_OP_LIST(V)

// The combination of all operators at all levels and the common operators.
#define ALL_OP_LIST(V) \
  CONTROL_OP_LIST(V)   \
  VALUE_OP_LIST(V)

namespace v8 {
namespace internal {
namespace compiler {

// Declare an enumeration with all the opcodes at all levels so that they
// can be globally, uniquely numbered.
1026
class V8_EXPORT_PRIVATE IrOpcode {
1027 1028
 public:
  enum Value {
1029
#define DECLARE_OPCODE(x, ...) k##x,
1030 1031
    ALL_OP_LIST(DECLARE_OPCODE)
#undef DECLARE_OPCODE
1032 1033 1034
        kLast = -1
#define COUNT_OPCODE(...) +1
                ALL_OP_LIST(COUNT_OPCODE)
1035 1036 1037 1038
#undef COUNT_OPCODE
  };

  // Returns the mnemonic name of an opcode.
1039
  static char const* Mnemonic(Value value);
1040

1041 1042
  // Returns true if opcode for common operator.
  static bool IsCommonOpcode(Value value) {
1043
    return kStart <= value && value <= kStaticAssert;
1044 1045
  }

1046 1047
  // Returns true if opcode for control operator.
  static bool IsControlOpcode(Value value) {
1048
    return kStart <= value && value <= kEnd;
1049 1050
  }

1051 1052
  // Returns true if opcode for JavaScript operator.
  static bool IsJsOpcode(Value value) {
1053
    return kJSEqual <= value && value <= kJSDebugger;
1054 1055
  }

1056 1057
  // Returns true if opcode for constant operator.
  static bool IsConstantOpcode(Value value) {
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067
#define CASE(Name) \
  case k##Name:    \
    return true;
    switch (value) {
      CONSTANT_OP_LIST(CASE);
      default:
        return false;
    }
#undef CASE
    UNREACHABLE();
1068
  }
1069

1070 1071 1072 1073 1074 1075
  static bool IsPhiOpcode(Value value) {
    return value == kPhi || value == kEffectPhi;
  }

  static bool IsMergeOpcode(Value value) {
    return value == kMerge || value == kLoop;
1076
  }
1077

1078 1079 1080 1081
  static bool IsIfProjectionOpcode(Value value) {
    return kIfTrue <= value && value <= kIfDefault;
  }

1082 1083 1084
  // Returns true if opcode terminates control flow in a graph (i.e.
  // respective nodes are expected to have control uses by the graphs {End}
  // node only).
1085 1086 1087 1088 1089
  static bool IsGraphTerminator(Value value) {
    return value == kDeoptimize || value == kReturn || value == kTailCall ||
           value == kTerminate || value == kThrow;
  }

1090 1091
  // Returns true if opcode can be inlined.
  static bool IsInlineeOpcode(Value value) {
1092
    return value == kJSConstruct || value == kJSCall;
1093 1094
  }

1095 1096
  // Returns true if opcode for comparison operator.
  static bool IsComparisonOpcode(Value value) {
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
#define CASE(Name, ...) \
  case k##Name:         \
    return true;
    switch (value) {
      JS_COMPARE_BINOP_LIST(CASE);
      SIMPLIFIED_COMPARE_BINOP_LIST(CASE);
      MACHINE_COMPARE_BINOP_LIST(CASE);
      default:
        return false;
    }
#undef CASE
    UNREACHABLE();
1109
  }
1110 1111

  static bool IsContextChainExtendingOpcode(Value value) {
1112
    return kJSCreateFunctionContext <= value && value <= kJSCreateBlockContext;
1113
  }
1114 1115 1116 1117

  // These opcode take the feedback vector as an input, and implement
  // feedback-collecting logic in generic lowering.
  static bool IsFeedbackCollectingOpcode(Value value) {
1118 1119 1120
#define CASE(Name, ...) \
  case k##Name:         \
    return true;
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
    switch (value) {
      JS_ARITH_BINOP_LIST(CASE)
      JS_ARITH_UNOP_LIST(CASE)
      JS_BITWISE_BINOP_LIST(CASE)
      JS_BITWISE_UNOP_LIST(CASE)
      JS_COMPARE_BINOP_LIST(CASE)
      case kJSCall:
      case kJSCallWithArrayLike:
      case kJSCallWithSpread:
      case kJSCloneObject:
      case kJSConstruct:
      case kJSConstructWithArrayLike:
      case kJSConstructWithSpread:
      case kJSCreateEmptyLiteralArray:
      case kJSCreateLiteralArray:
      case kJSCreateLiteralObject:
      case kJSCreateLiteralRegExp:
1138
      case kJSDefineKeyedOwnProperty:
1139 1140
      case kJSForInNext:
      case kJSForInPrepare:
1141 1142 1143 1144 1145 1146
      case kJSGetIterator:
      case kJSGetTemplateObject:
      case kJSHasProperty:
      case kJSInstanceOf:
      case kJSLoadGlobal:
      case kJSLoadNamed:
1147
      case kJSLoadNamedFromSuper:
1148
      case kJSLoadProperty:
1149
      case kJSDefineKeyedOwnPropertyInLiteral:
1150 1151
      case kJSStoreGlobal:
      case kJSStoreInArrayLiteral:
1152 1153 1154
      case kJSSetNamedProperty:
      case kJSDefineNamedOwnProperty:
      case kJSSetKeyedProperty:
1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166
        return true;
      default:
        return false;
    }
#undef CASE
    UNREACHABLE();
  }

  static bool IsFeedbackCollectingOpcode(int16_t value) {
    DCHECK(0 <= value && value <= kLast);
    return IsFeedbackCollectingOpcode(static_cast<IrOpcode::Value>(value));
  }
1167 1168
};

1169
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, IrOpcode::Value);
1170

1171 1172 1173 1174 1175
}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_OPCODES_H_