1 // Copyright 2013 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 #ifndef V8_COMPILER_OPCODES_H_ 6 #define V8_COMPILER_OPCODES_H_ 7 8 #include <iosfwd> 9 10 #include "src/globals.h" 11 12 // Opcodes for control operators. 13 #define CONTROL_OP_LIST(V) \ 14 V(Start) \ 15 V(Loop) \ 16 V(Branch) \ 17 V(Switch) \ 18 V(IfTrue) \ 19 V(IfFalse) \ 20 V(IfSuccess) \ 21 V(IfException) \ 22 V(IfValue) \ 23 V(IfDefault) \ 24 V(Merge) \ 25 V(Deoptimize) \ 26 V(DeoptimizeIf) \ 27 V(DeoptimizeUnless) \ 28 V(TrapIf) \ 29 V(TrapUnless) \ 30 V(Return) \ 31 V(TailCall) \ 32 V(Terminate) \ 33 V(OsrNormalEntry) \ 34 V(OsrLoopEntry) \ 35 V(Throw) \ 36 V(End) 37 38 // Opcodes for constant operators. 39 #define CONSTANT_OP_LIST(V) \ 40 V(Int32Constant) \ 41 V(Int64Constant) \ 42 V(Float32Constant) \ 43 V(Float64Constant) \ 44 V(ExternalConstant) \ 45 V(NumberConstant) \ 46 V(PointerConstant) \ 47 V(HeapConstant) \ 48 V(RelocatableInt32Constant) \ 49 V(RelocatableInt64Constant) 50 51 #define INNER_OP_LIST(V) \ 52 V(Select) \ 53 V(Phi) \ 54 V(EffectPhi) \ 55 V(InductionVariablePhi) \ 56 V(Checkpoint) \ 57 V(BeginRegion) \ 58 V(FinishRegion) \ 59 V(FrameState) \ 60 V(StateValues) \ 61 V(TypedStateValues) \ 62 V(ArgumentsElementsState) \ 63 V(ArgumentsLengthState) \ 64 V(ObjectState) \ 65 V(ObjectId) \ 66 V(TypedObjectState) \ 67 V(Call) \ 68 V(CallWithCallerSavedRegisters) \ 69 V(Parameter) \ 70 V(OsrValue) \ 71 V(LoopExit) \ 72 V(LoopExitValue) \ 73 V(LoopExitEffect) \ 74 V(Projection) \ 75 V(Retain) \ 76 V(MapGuard) \ 77 V(TypeGuard) 78 79 #define COMMON_OP_LIST(V) \ 80 CONSTANT_OP_LIST(V) \ 81 INNER_OP_LIST(V) \ 82 V(Unreachable) \ 83 V(DeadValue) \ 84 V(Dead) 85 86 // Opcodes for JavaScript operators. 87 #define JS_COMPARE_BINOP_LIST(V) \ 88 V(JSEqual) \ 89 V(JSStrictEqual) \ 90 V(JSLessThan) \ 91 V(JSGreaterThan) \ 92 V(JSLessThanOrEqual) \ 93 V(JSGreaterThanOrEqual) 94 95 #define JS_BITWISE_BINOP_LIST(V) \ 96 V(JSBitwiseOr) \ 97 V(JSBitwiseXor) \ 98 V(JSBitwiseAnd) \ 99 V(JSShiftLeft) \ 100 V(JSShiftRight) \ 101 V(JSShiftRightLogical) 102 103 #define JS_ARITH_BINOP_LIST(V) \ 104 V(JSAdd) \ 105 V(JSSubtract) \ 106 V(JSMultiply) \ 107 V(JSDivide) \ 108 V(JSModulus) \ 109 V(JSExponentiate) 110 111 #define JS_SIMPLE_BINOP_LIST(V) \ 112 JS_COMPARE_BINOP_LIST(V) \ 113 JS_BITWISE_BINOP_LIST(V) \ 114 JS_ARITH_BINOP_LIST(V) \ 115 V(JSHasInPrototypeChain) \ 116 V(JSInstanceOf) \ 117 V(JSOrdinaryHasInstance) 118 119 #define JS_CONVERSION_UNOP_LIST(V) \ 120 V(JSToInteger) \ 121 V(JSToLength) \ 122 V(JSToName) \ 123 V(JSToNumber) \ 124 V(JSToNumberConvertBigInt) \ 125 V(JSToNumeric) \ 126 V(JSToObject) \ 127 V(JSToString) \ 128 V(JSParseInt) 129 130 #define JS_SIMPLE_UNOP_LIST(V) \ 131 JS_CONVERSION_UNOP_LIST(V) \ 132 V(JSBitwiseNot) \ 133 V(JSDecrement) \ 134 V(JSIncrement) \ 135 V(JSNegate) 136 137 #define JS_CREATE_OP_LIST(V) \ 138 V(JSCreate) \ 139 V(JSCreateArguments) \ 140 V(JSCreateArray) \ 141 V(JSCreateArrayIterator) \ 142 V(JSCreateBoundFunction) \ 143 V(JSCreateClosure) \ 144 V(JSCreateCollectionIterator) \ 145 V(JSCreateGeneratorObject) \ 146 V(JSCreateIterResultObject) \ 147 V(JSCreateStringIterator) \ 148 V(JSCreateKeyValueArray) \ 149 V(JSCreateObject) \ 150 V(JSCreatePromise) \ 151 V(JSCreateTypedArray) \ 152 V(JSCreateLiteralArray) \ 153 V(JSCreateEmptyLiteralArray) \ 154 V(JSCreateLiteralObject) \ 155 V(JSCreateEmptyLiteralObject) \ 156 V(JSCloneObject) \ 157 V(JSCreateLiteralRegExp) 158 159 #define JS_OBJECT_OP_LIST(V) \ 160 JS_CREATE_OP_LIST(V) \ 161 V(JSLoadProperty) \ 162 V(JSLoadNamed) \ 163 V(JSLoadGlobal) \ 164 V(JSStoreProperty) \ 165 V(JSStoreNamed) \ 166 V(JSStoreNamedOwn) \ 167 V(JSStoreGlobal) \ 168 V(JSStoreDataPropertyInLiteral) \ 169 V(JSStoreInArrayLiteral) \ 170 V(JSDeleteProperty) \ 171 V(JSHasProperty) \ 172 V(JSGetSuperConstructor) 173 174 #define JS_CONTEXT_OP_LIST(V) \ 175 V(JSLoadContext) \ 176 V(JSStoreContext) \ 177 V(JSCreateFunctionContext) \ 178 V(JSCreateCatchContext) \ 179 V(JSCreateWithContext) \ 180 V(JSCreateBlockContext) 181 182 #define JS_CONSTRUCT_OP_LIST(V) \ 183 V(JSConstructForwardVarargs) \ 184 V(JSConstruct) \ 185 V(JSConstructWithArrayLike) \ 186 V(JSConstructWithSpread) 187 188 #define JS_OTHER_OP_LIST(V) \ 189 JS_CONSTRUCT_OP_LIST(V) \ 190 V(JSCallForwardVarargs) \ 191 V(JSCall) \ 192 V(JSCallWithArrayLike) \ 193 V(JSCallWithSpread) \ 194 V(JSCallRuntime) \ 195 V(JSForInEnumerate) \ 196 V(JSForInNext) \ 197 V(JSForInPrepare) \ 198 V(JSLoadMessage) \ 199 V(JSStoreMessage) \ 200 V(JSLoadModule) \ 201 V(JSStoreModule) \ 202 V(JSGeneratorStore) \ 203 V(JSGeneratorRestoreContinuation) \ 204 V(JSGeneratorRestoreContext) \ 205 V(JSGeneratorRestoreRegister) \ 206 V(JSGeneratorRestoreInputOrDebugPos) \ 207 V(JSFulfillPromise) \ 208 V(JSPerformPromiseThen) \ 209 V(JSPromiseResolve) \ 210 V(JSRejectPromise) \ 211 V(JSResolvePromise) \ 212 V(JSStackCheck) \ 213 V(JSObjectIsArray) \ 214 V(JSRegExpTest) \ 215 V(JSDebugger) 216 217 #define JS_OP_LIST(V) \ 218 JS_SIMPLE_BINOP_LIST(V) \ 219 JS_SIMPLE_UNOP_LIST(V) \ 220 JS_OBJECT_OP_LIST(V) \ 221 JS_CONTEXT_OP_LIST(V) \ 222 JS_OTHER_OP_LIST(V) 223 224 // Opcodes for VirtuaMachine-level operators. 225 #define SIMPLIFIED_CHANGE_OP_LIST(V) \ 226 V(ChangeTaggedSignedToInt32) \ 227 V(ChangeTaggedToInt32) \ 228 V(ChangeTaggedToUint32) \ 229 V(ChangeTaggedToFloat64) \ 230 V(ChangeTaggedToTaggedSigned) \ 231 V(ChangeInt31ToTaggedSigned) \ 232 V(ChangeInt32ToTagged) \ 233 V(ChangeUint32ToTagged) \ 234 V(ChangeFloat64ToTagged) \ 235 V(ChangeFloat64ToTaggedPointer) \ 236 V(ChangeTaggedToBit) \ 237 V(ChangeBitToTagged) \ 238 V(TruncateTaggedToWord32) \ 239 V(TruncateTaggedToFloat64) \ 240 V(TruncateTaggedToBit) \ 241 V(TruncateTaggedPointerToBit) 242 243 #define SIMPLIFIED_CHECKED_OP_LIST(V) \ 244 V(CheckedInt32Add) \ 245 V(CheckedInt32Sub) \ 246 V(CheckedInt32Div) \ 247 V(CheckedInt32Mod) \ 248 V(CheckedUint32Div) \ 249 V(CheckedUint32Mod) \ 250 V(CheckedInt32Mul) \ 251 V(CheckedInt32ToTaggedSigned) \ 252 V(CheckedUint32ToInt32) \ 253 V(CheckedUint32ToTaggedSigned) \ 254 V(CheckedFloat64ToInt32) \ 255 V(CheckedTaggedSignedToInt32) \ 256 V(CheckedTaggedToInt32) \ 257 V(CheckedTruncateTaggedToWord32) \ 258 V(CheckedTaggedToFloat64) \ 259 V(CheckedTaggedToTaggedSigned) \ 260 V(CheckedTaggedToTaggedPointer) 261 262 #define SIMPLIFIED_COMPARE_BINOP_LIST(V) \ 263 V(NumberEqual) \ 264 V(NumberLessThan) \ 265 V(NumberLessThanOrEqual) \ 266 V(SpeculativeNumberEqual) \ 267 V(SpeculativeNumberLessThan) \ 268 V(SpeculativeNumberLessThanOrEqual) \ 269 V(ReferenceEqual) \ 270 V(SameValue) \ 271 V(StringEqual) \ 272 V(StringLessThan) \ 273 V(StringLessThanOrEqual) 274 275 #define SIMPLIFIED_NUMBER_BINOP_LIST(V) \ 276 V(NumberAdd) \ 277 V(NumberSubtract) \ 278 V(NumberMultiply) \ 279 V(NumberDivide) \ 280 V(NumberModulus) \ 281 V(NumberBitwiseOr) \ 282 V(NumberBitwiseXor) \ 283 V(NumberBitwiseAnd) \ 284 V(NumberShiftLeft) \ 285 V(NumberShiftRight) \ 286 V(NumberShiftRightLogical) \ 287 V(NumberAtan2) \ 288 V(NumberImul) \ 289 V(NumberMax) \ 290 V(NumberMin) \ 291 V(NumberPow) 292 293 #define SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \ 294 V(SpeculativeNumberAdd) \ 295 V(SpeculativeNumberSubtract) \ 296 V(SpeculativeNumberMultiply) \ 297 V(SpeculativeNumberDivide) \ 298 V(SpeculativeNumberModulus) \ 299 V(SpeculativeNumberBitwiseAnd) \ 300 V(SpeculativeNumberBitwiseOr) \ 301 V(SpeculativeNumberBitwiseXor) \ 302 V(SpeculativeNumberShiftLeft) \ 303 V(SpeculativeNumberShiftRight) \ 304 V(SpeculativeNumberShiftRightLogical) \ 305 V(SpeculativeSafeIntegerAdd) \ 306 V(SpeculativeSafeIntegerSubtract) 307 308 #define SIMPLIFIED_NUMBER_UNOP_LIST(V) \ 309 V(NumberAbs) \ 310 V(NumberAcos) \ 311 V(NumberAcosh) \ 312 V(NumberAsin) \ 313 V(NumberAsinh) \ 314 V(NumberAtan) \ 315 V(NumberAtanh) \ 316 V(NumberCbrt) \ 317 V(NumberCeil) \ 318 V(NumberClz32) \ 319 V(NumberCos) \ 320 V(NumberCosh) \ 321 V(NumberExp) \ 322 V(NumberExpm1) \ 323 V(NumberFloor) \ 324 V(NumberFround) \ 325 V(NumberLog) \ 326 V(NumberLog1p) \ 327 V(NumberLog2) \ 328 V(NumberLog10) \ 329 V(NumberRound) \ 330 V(NumberSign) \ 331 V(NumberSin) \ 332 V(NumberSinh) \ 333 V(NumberSqrt) \ 334 V(NumberTan) \ 335 V(NumberTanh) \ 336 V(NumberTrunc) \ 337 V(NumberToBoolean) \ 338 V(NumberToInt32) \ 339 V(NumberToString) \ 340 V(NumberToUint32) \ 341 V(NumberToUint8Clamped) \ 342 V(NumberSilenceNaN) 343 344 #define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) V(SpeculativeToNumber) 345 346 #define SIMPLIFIED_OTHER_OP_LIST(V) \ 347 V(PlainPrimitiveToNumber) \ 348 V(PlainPrimitiveToWord32) \ 349 V(PlainPrimitiveToFloat64) \ 350 V(BooleanNot) \ 351 V(StringToNumber) \ 352 V(StringCharCodeAt) \ 353 V(StringCodePointAt) \ 354 V(StringFromSingleCharCode) \ 355 V(StringFromSingleCodePoint) \ 356 V(StringIndexOf) \ 357 V(StringLength) \ 358 V(StringToLowerCaseIntl) \ 359 V(StringToUpperCaseIntl) \ 360 V(StringSubstring) \ 361 V(CheckBounds) \ 362 V(CheckIf) \ 363 V(CheckMaps) \ 364 V(CheckNumber) \ 365 V(CheckInternalizedString) \ 366 V(CheckReceiver) \ 367 V(CheckString) \ 368 V(CheckSymbol) \ 369 V(CheckSmi) \ 370 V(CheckHeapObject) \ 371 V(CheckFloat64Hole) \ 372 V(CheckNotTaggedHole) \ 373 V(CheckEqualsInternalizedString) \ 374 V(CheckEqualsSymbol) \ 375 V(CompareMaps) \ 376 V(ConvertReceiver) \ 377 V(ConvertTaggedHoleToUndefined) \ 378 V(TypeOf) \ 379 V(Allocate) \ 380 V(AllocateRaw) \ 381 V(LoadFieldByIndex) \ 382 V(LoadField) \ 383 V(LoadElement) \ 384 V(LoadTypedElement) \ 385 V(LoadDataViewElement) \ 386 V(StoreField) \ 387 V(StoreElement) \ 388 V(StoreTypedElement) \ 389 V(StoreDataViewElement) \ 390 V(StoreSignedSmallElement) \ 391 V(TransitionAndStoreElement) \ 392 V(TransitionAndStoreNumberElement) \ 393 V(TransitionAndStoreNonNumberElement) \ 394 V(ToBoolean) \ 395 V(NumberIsFloat64Hole) \ 396 V(NumberIsFinite) \ 397 V(ObjectIsFiniteNumber) \ 398 V(NumberIsInteger) \ 399 V(ObjectIsSafeInteger) \ 400 V(NumberIsSafeInteger) \ 401 V(ObjectIsInteger) \ 402 V(ObjectIsArrayBufferView) \ 403 V(ObjectIsBigInt) \ 404 V(ObjectIsCallable) \ 405 V(ObjectIsConstructor) \ 406 V(ObjectIsDetectableCallable) \ 407 V(ObjectIsMinusZero) \ 408 V(ObjectIsNaN) \ 409 V(NumberIsNaN) \ 410 V(ObjectIsNonCallable) \ 411 V(ObjectIsNumber) \ 412 V(ObjectIsReceiver) \ 413 V(ObjectIsSmi) \ 414 V(ObjectIsString) \ 415 V(ObjectIsSymbol) \ 416 V(ObjectIsUndetectable) \ 417 V(ArgumentsFrame) \ 418 V(ArgumentsLength) \ 419 V(NewDoubleElements) \ 420 V(NewSmiOrObjectElements) \ 421 V(NewArgumentsElements) \ 422 V(NewConsString) \ 423 V(ArrayBufferWasNeutered) \ 424 V(EnsureWritableFastElements) \ 425 V(MaybeGrowFastElements) \ 426 V(TransitionElementsKind) \ 427 V(FindOrderedHashMapEntry) \ 428 V(FindOrderedHashMapEntryForInt32Key) \ 429 V(PoisonIndex) \ 430 V(RuntimeAbort) \ 431 V(DateNow) 432 433 #define SIMPLIFIED_OP_LIST(V) \ 434 SIMPLIFIED_CHANGE_OP_LIST(V) \ 435 SIMPLIFIED_CHECKED_OP_LIST(V) \ 436 SIMPLIFIED_COMPARE_BINOP_LIST(V) \ 437 SIMPLIFIED_NUMBER_BINOP_LIST(V) \ 438 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V) \ 439 SIMPLIFIED_NUMBER_UNOP_LIST(V) \ 440 SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V) \ 441 SIMPLIFIED_OTHER_OP_LIST(V) 442 443 // Opcodes for Machine-level operators. 444 #define MACHINE_COMPARE_BINOP_LIST(V) \ 445 V(Word32Equal) \ 446 V(Word64Equal) \ 447 V(Int32LessThan) \ 448 V(Int32LessThanOrEqual) \ 449 V(Uint32LessThan) \ 450 V(Uint32LessThanOrEqual) \ 451 V(Int64LessThan) \ 452 V(Int64LessThanOrEqual) \ 453 V(Uint64LessThan) \ 454 V(Uint64LessThanOrEqual) \ 455 V(Float32Equal) \ 456 V(Float32LessThan) \ 457 V(Float32LessThanOrEqual) \ 458 V(Float64Equal) \ 459 V(Float64LessThan) \ 460 V(Float64LessThanOrEqual) 461 462 #define MACHINE_UNOP_32_LIST(V) \ 463 V(Word32Clz) \ 464 V(Word32Ctz) \ 465 V(Int32AbsWithOverflow) \ 466 V(Word32ReverseBits) \ 467 V(Word32ReverseBytes) 468 469 #define MACHINE_BINOP_32_LIST(V) \ 470 V(Word32And) \ 471 V(Word32Or) \ 472 V(Word32Xor) \ 473 V(Word32Shl) \ 474 V(Word32Shr) \ 475 V(Word32Sar) \ 476 V(Word32Ror) \ 477 V(Int32Add) \ 478 V(Int32AddWithOverflow) \ 479 V(Int32Sub) \ 480 V(Int32SubWithOverflow) \ 481 V(Int32Mul) \ 482 V(Int32MulWithOverflow) \ 483 V(Int32MulHigh) \ 484 V(Int32Div) \ 485 V(Int32Mod) \ 486 V(Uint32Div) \ 487 V(Uint32Mod) \ 488 V(Uint32MulHigh) 489 490 #define MACHINE_BINOP_64_LIST(V) \ 491 V(Word64And) \ 492 V(Word64Or) \ 493 V(Word64Xor) \ 494 V(Word64Shl) \ 495 V(Word64Shr) \ 496 V(Word64Sar) \ 497 V(Word64Ror) \ 498 V(Int64Add) \ 499 V(Int64AddWithOverflow) \ 500 V(Int64Sub) \ 501 V(Int64SubWithOverflow) \ 502 V(Int64Mul) \ 503 V(Int64Div) \ 504 V(Int64Mod) \ 505 V(Uint64Div) \ 506 V(Uint64Mod) 507 508 #define MACHINE_FLOAT32_UNOP_LIST(V) \ 509 V(Float32Abs) \ 510 V(Float32Neg) \ 511 V(Float32RoundDown) \ 512 V(Float32RoundTiesEven) \ 513 V(Float32RoundTruncate) \ 514 V(Float32RoundUp) \ 515 V(Float32Sqrt) 516 517 #define MACHINE_FLOAT32_BINOP_LIST(V) \ 518 V(Float32Add) \ 519 V(Float32Sub) \ 520 V(Float32Mul) \ 521 V(Float32Div) \ 522 V(Float32Max) \ 523 V(Float32Min) 524 525 #define MACHINE_FLOAT64_UNOP_LIST(V) \ 526 V(Float64Abs) \ 527 V(Float64Acos) \ 528 V(Float64Acosh) \ 529 V(Float64Asin) \ 530 V(Float64Asinh) \ 531 V(Float64Atan) \ 532 V(Float64Atanh) \ 533 V(Float64Cbrt) \ 534 V(Float64Cos) \ 535 V(Float64Cosh) \ 536 V(Float64Exp) \ 537 V(Float64Expm1) \ 538 V(Float64Log) \ 539 V(Float64Log1p) \ 540 V(Float64Log10) \ 541 V(Float64Log2) \ 542 V(Float64Neg) \ 543 V(Float64RoundDown) \ 544 V(Float64RoundTiesAway) \ 545 V(Float64RoundTiesEven) \ 546 V(Float64RoundTruncate) \ 547 V(Float64RoundUp) \ 548 V(Float64Sin) \ 549 V(Float64Sinh) \ 550 V(Float64Sqrt) \ 551 V(Float64Tan) \ 552 V(Float64Tanh) 553 554 #define MACHINE_FLOAT64_BINOP_LIST(V) \ 555 V(Float64Atan2) \ 556 V(Float64Max) \ 557 V(Float64Min) \ 558 V(Float64Add) \ 559 V(Float64Sub) \ 560 V(Float64Mul) \ 561 V(Float64Div) \ 562 V(Float64Mod) \ 563 V(Float64Pow) 564 565 #define MACHINE_WORD64_ATOMIC_OP_LIST(V) \ 566 V(Word64AtomicLoad) \ 567 V(Word64AtomicStore) \ 568 V(Word64AtomicAdd) \ 569 V(Word64AtomicSub) \ 570 V(Word64AtomicAnd) \ 571 V(Word64AtomicOr) \ 572 V(Word64AtomicXor) \ 573 V(Word64AtomicExchange) \ 574 V(Word64AtomicCompareExchange) \ 575 V(Word64AtomicNarrowAdd) \ 576 V(Word64AtomicNarrowSub) \ 577 V(Word64AtomicNarrowAnd) \ 578 V(Word64AtomicNarrowOr) \ 579 V(Word64AtomicNarrowXor) \ 580 V(Word64AtomicNarrowExchange) \ 581 V(Word64AtomicNarrowCompareExchange) 582 583 #define MACHINE_OP_LIST(V) \ 584 MACHINE_UNOP_32_LIST(V) \ 585 MACHINE_BINOP_32_LIST(V) \ 586 MACHINE_BINOP_64_LIST(V) \ 587 MACHINE_COMPARE_BINOP_LIST(V) \ 588 MACHINE_FLOAT32_BINOP_LIST(V) \ 589 MACHINE_FLOAT32_UNOP_LIST(V) \ 590 MACHINE_FLOAT64_BINOP_LIST(V) \ 591 MACHINE_FLOAT64_UNOP_LIST(V) \ 592 MACHINE_WORD64_ATOMIC_OP_LIST(V) \ 593 V(DebugAbort) \ 594 V(DebugBreak) \ 595 V(Comment) \ 596 V(Load) \ 597 V(PoisonedLoad) \ 598 V(Store) \ 599 V(StackSlot) \ 600 V(Word32Popcnt) \ 601 V(Word64Popcnt) \ 602 V(Word64Clz) \ 603 V(Word64Ctz) \ 604 V(Word64ReverseBits) \ 605 V(Word64ReverseBytes) \ 606 V(Int64AbsWithOverflow) \ 607 V(BitcastTaggedToWord) \ 608 V(BitcastWordToTagged) \ 609 V(BitcastWordToTaggedSigned) \ 610 V(TruncateFloat64ToWord32) \ 611 V(ChangeFloat32ToFloat64) \ 612 V(ChangeFloat64ToInt32) \ 613 V(ChangeFloat64ToUint32) \ 614 V(ChangeFloat64ToUint64) \ 615 V(Float64SilenceNaN) \ 616 V(TruncateFloat64ToUint32) \ 617 V(TruncateFloat32ToInt32) \ 618 V(TruncateFloat32ToUint32) \ 619 V(TryTruncateFloat32ToInt64) \ 620 V(TryTruncateFloat64ToInt64) \ 621 V(TryTruncateFloat32ToUint64) \ 622 V(TryTruncateFloat64ToUint64) \ 623 V(ChangeInt32ToFloat64) \ 624 V(ChangeInt32ToInt64) \ 625 V(ChangeUint32ToFloat64) \ 626 V(ChangeUint32ToUint64) \ 627 V(TruncateFloat64ToFloat32) \ 628 V(TruncateInt64ToInt32) \ 629 V(RoundFloat64ToInt32) \ 630 V(RoundInt32ToFloat32) \ 631 V(RoundInt64ToFloat32) \ 632 V(RoundInt64ToFloat64) \ 633 V(RoundUint32ToFloat32) \ 634 V(RoundUint64ToFloat32) \ 635 V(RoundUint64ToFloat64) \ 636 V(BitcastFloat32ToInt32) \ 637 V(BitcastFloat64ToInt64) \ 638 V(BitcastInt32ToFloat32) \ 639 V(BitcastInt64ToFloat64) \ 640 V(Float64ExtractLowWord32) \ 641 V(Float64ExtractHighWord32) \ 642 V(Float64InsertLowWord32) \ 643 V(Float64InsertHighWord32) \ 644 V(TaggedPoisonOnSpeculation) \ 645 V(Word32PoisonOnSpeculation) \ 646 V(Word64PoisonOnSpeculation) \ 647 V(LoadStackPointer) \ 648 V(LoadFramePointer) \ 649 V(LoadParentFramePointer) \ 650 V(UnalignedLoad) \ 651 V(UnalignedStore) \ 652 V(Int32PairAdd) \ 653 V(Int32PairSub) \ 654 V(Int32PairMul) \ 655 V(Word32PairShl) \ 656 V(Word32PairShr) \ 657 V(Word32PairSar) \ 658 V(ProtectedLoad) \ 659 V(ProtectedStore) \ 660 V(Word32AtomicLoad) \ 661 V(Word32AtomicStore) \ 662 V(Word32AtomicExchange) \ 663 V(Word32AtomicCompareExchange) \ 664 V(Word32AtomicAdd) \ 665 V(Word32AtomicSub) \ 666 V(Word32AtomicAnd) \ 667 V(Word32AtomicOr) \ 668 V(Word32AtomicXor) \ 669 V(Word32AtomicPairLoad) \ 670 V(Word32AtomicPairStore) \ 671 V(Word32AtomicPairAdd) \ 672 V(Word32AtomicPairSub) \ 673 V(Word32AtomicPairAnd) \ 674 V(Word32AtomicPairOr) \ 675 V(Word32AtomicPairXor) \ 676 V(Word32AtomicPairExchange) \ 677 V(Word32AtomicPairCompareExchange) \ 678 V(SpeculationFence) \ 679 V(SignExtendWord8ToInt32) \ 680 V(SignExtendWord16ToInt32) \ 681 V(SignExtendWord8ToInt64) \ 682 V(SignExtendWord16ToInt64) \ 683 V(SignExtendWord32ToInt64) \ 684 V(UnsafePointerAdd) 685 686 #define MACHINE_SIMD_OP_LIST(V) \ 687 V(F32x4Splat) \ 688 V(F32x4ExtractLane) \ 689 V(F32x4ReplaceLane) \ 690 V(F32x4SConvertI32x4) \ 691 V(F32x4UConvertI32x4) \ 692 V(F32x4Abs) \ 693 V(F32x4Neg) \ 694 V(F32x4RecipApprox) \ 695 V(F32x4RecipSqrtApprox) \ 696 V(F32x4Add) \ 697 V(F32x4AddHoriz) \ 698 V(F32x4Sub) \ 699 V(F32x4Mul) \ 700 V(F32x4Min) \ 701 V(F32x4Max) \ 702 V(F32x4Eq) \ 703 V(F32x4Ne) \ 704 V(F32x4Lt) \ 705 V(F32x4Le) \ 706 V(F32x4Gt) \ 707 V(F32x4Ge) \ 708 V(I32x4Splat) \ 709 V(I32x4ExtractLane) \ 710 V(I32x4ReplaceLane) \ 711 V(I32x4SConvertF32x4) \ 712 V(I32x4SConvertI16x8Low) \ 713 V(I32x4SConvertI16x8High) \ 714 V(I32x4Neg) \ 715 V(I32x4Shl) \ 716 V(I32x4ShrS) \ 717 V(I32x4Add) \ 718 V(I32x4AddHoriz) \ 719 V(I32x4Sub) \ 720 V(I32x4Mul) \ 721 V(I32x4MinS) \ 722 V(I32x4MaxS) \ 723 V(I32x4Eq) \ 724 V(I32x4Ne) \ 725 V(I32x4LtS) \ 726 V(I32x4LeS) \ 727 V(I32x4GtS) \ 728 V(I32x4GeS) \ 729 V(I32x4UConvertF32x4) \ 730 V(I32x4UConvertI16x8Low) \ 731 V(I32x4UConvertI16x8High) \ 732 V(I32x4ShrU) \ 733 V(I32x4MinU) \ 734 V(I32x4MaxU) \ 735 V(I32x4LtU) \ 736 V(I32x4LeU) \ 737 V(I32x4GtU) \ 738 V(I32x4GeU) \ 739 V(I16x8Splat) \ 740 V(I16x8ExtractLane) \ 741 V(I16x8ReplaceLane) \ 742 V(I16x8SConvertI8x16Low) \ 743 V(I16x8SConvertI8x16High) \ 744 V(I16x8Neg) \ 745 V(I16x8Shl) \ 746 V(I16x8ShrS) \ 747 V(I16x8SConvertI32x4) \ 748 V(I16x8Add) \ 749 V(I16x8AddSaturateS) \ 750 V(I16x8AddHoriz) \ 751 V(I16x8Sub) \ 752 V(I16x8SubSaturateS) \ 753 V(I16x8Mul) \ 754 V(I16x8MinS) \ 755 V(I16x8MaxS) \ 756 V(I16x8Eq) \ 757 V(I16x8Ne) \ 758 V(I16x8LtS) \ 759 V(I16x8LeS) \ 760 V(I16x8GtS) \ 761 V(I16x8GeS) \ 762 V(I16x8UConvertI8x16Low) \ 763 V(I16x8UConvertI8x16High) \ 764 V(I16x8ShrU) \ 765 V(I16x8UConvertI32x4) \ 766 V(I16x8AddSaturateU) \ 767 V(I16x8SubSaturateU) \ 768 V(I16x8MinU) \ 769 V(I16x8MaxU) \ 770 V(I16x8LtU) \ 771 V(I16x8LeU) \ 772 V(I16x8GtU) \ 773 V(I16x8GeU) \ 774 V(I8x16Splat) \ 775 V(I8x16ExtractLane) \ 776 V(I8x16ReplaceLane) \ 777 V(I8x16SConvertI16x8) \ 778 V(I8x16Neg) \ 779 V(I8x16Shl) \ 780 V(I8x16ShrS) \ 781 V(I8x16Add) \ 782 V(I8x16AddSaturateS) \ 783 V(I8x16Sub) \ 784 V(I8x16SubSaturateS) \ 785 V(I8x16Mul) \ 786 V(I8x16MinS) \ 787 V(I8x16MaxS) \ 788 V(I8x16Eq) \ 789 V(I8x16Ne) \ 790 V(I8x16LtS) \ 791 V(I8x16LeS) \ 792 V(I8x16GtS) \ 793 V(I8x16GeS) \ 794 V(I8x16UConvertI16x8) \ 795 V(I8x16AddSaturateU) \ 796 V(I8x16SubSaturateU) \ 797 V(I8x16ShrU) \ 798 V(I8x16MinU) \ 799 V(I8x16MaxU) \ 800 V(I8x16LtU) \ 801 V(I8x16LeU) \ 802 V(I8x16GtU) \ 803 V(I8x16GeU) \ 804 V(S128Load) \ 805 V(S128Store) \ 806 V(S128Zero) \ 807 V(S128Not) \ 808 V(S128And) \ 809 V(S128Or) \ 810 V(S128Xor) \ 811 V(S128Select) \ 812 V(S8x16Shuffle) \ 813 V(S1x4AnyTrue) \ 814 V(S1x4AllTrue) \ 815 V(S1x8AnyTrue) \ 816 V(S1x8AllTrue) \ 817 V(S1x16AnyTrue) \ 818 V(S1x16AllTrue) 819 820 #define VALUE_OP_LIST(V) \ 821 COMMON_OP_LIST(V) \ 822 SIMPLIFIED_OP_LIST(V) \ 823 MACHINE_OP_LIST(V) \ 824 MACHINE_SIMD_OP_LIST(V) \ 825 JS_OP_LIST(V) 826 827 // The combination of all operators at all levels and the common operators. 828 #define ALL_OP_LIST(V) \ 829 CONTROL_OP_LIST(V) \ 830 VALUE_OP_LIST(V) 831 832 namespace v8 { 833 namespace internal { 834 namespace compiler { 835 836 // Declare an enumeration with all the opcodes at all levels so that they 837 // can be globally, uniquely numbered. 838 class V8_EXPORT_PRIVATE IrOpcode { 839 public: 840 enum Value { 841 #define DECLARE_OPCODE(x) k##x, 842 ALL_OP_LIST(DECLARE_OPCODE) 843 #undef DECLARE_OPCODE 844 kLast = -1 845 #define COUNT_OPCODE(x) +1 846 ALL_OP_LIST(COUNT_OPCODE) 847 #undef COUNT_OPCODE 848 }; 849 850 // Returns the mnemonic name of an opcode. 851 static char const* Mnemonic(Value value); 852 853 // Returns true if opcode for common operator. IsCommonOpcode(Value value)854 static bool IsCommonOpcode(Value value) { 855 return kStart <= value && value <= kDead; 856 } 857 858 // Returns true if opcode for control operator. IsControlOpcode(Value value)859 static bool IsControlOpcode(Value value) { 860 return kStart <= value && value <= kEnd; 861 } 862 863 // Returns true if opcode for JavaScript operator. IsJsOpcode(Value value)864 static bool IsJsOpcode(Value value) { 865 return kJSEqual <= value && value <= kJSDebugger; 866 } 867 868 // Returns true if opcode for constant operator. IsConstantOpcode(Value value)869 static bool IsConstantOpcode(Value value) { 870 return kInt32Constant <= value && value <= kRelocatableInt64Constant; 871 } 872 IsPhiOpcode(Value value)873 static bool IsPhiOpcode(Value value) { 874 return value == kPhi || value == kEffectPhi; 875 } 876 IsMergeOpcode(Value value)877 static bool IsMergeOpcode(Value value) { 878 return value == kMerge || value == kLoop; 879 } 880 IsIfProjectionOpcode(Value value)881 static bool IsIfProjectionOpcode(Value value) { 882 return kIfTrue <= value && value <= kIfDefault; 883 } 884 885 // Returns true if opcode terminates control flow in a graph (i.e. respective 886 // nodes are expected to have control uses by the graphs {End} node only). IsGraphTerminator(Value value)887 static bool IsGraphTerminator(Value value) { 888 return value == kDeoptimize || value == kReturn || value == kTailCall || 889 value == kTerminate || value == kThrow; 890 } 891 892 // Returns true if opcode can be inlined. IsInlineeOpcode(Value value)893 static bool IsInlineeOpcode(Value value) { 894 return value == kJSConstruct || value == kJSCall; 895 } 896 897 // Returns true if opcode for comparison operator. IsComparisonOpcode(Value value)898 static bool IsComparisonOpcode(Value value) { 899 return (kJSEqual <= value && value <= kJSGreaterThanOrEqual) || 900 (kNumberEqual <= value && value <= kStringLessThanOrEqual) || 901 (kWord32Equal <= value && value <= kFloat64LessThanOrEqual); 902 } 903 IsContextChainExtendingOpcode(Value value)904 static bool IsContextChainExtendingOpcode(Value value) { 905 return kJSCreateFunctionContext <= value && value <= kJSCreateBlockContext; 906 } 907 }; 908 909 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, IrOpcode::Value); 910 911 } // namespace compiler 912 } // namespace internal 913 } // namespace v8 914 915 #endif // V8_COMPILER_OPCODES_H_ 916