11cb0ef41Sopenharmony_ci// Copyright 2015 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_INTERPRETER_BYTECODES_H_
61cb0ef41Sopenharmony_ci#define V8_INTERPRETER_BYTECODES_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include <cstdint>
91cb0ef41Sopenharmony_ci#include <iosfwd>
101cb0ef41Sopenharmony_ci#include <string>
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci#include "src/common/globals.h"
131cb0ef41Sopenharmony_ci#include "src/interpreter/bytecode-operands.h"
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci// This interface and it's implementation are independent of the
161cb0ef41Sopenharmony_ci// libv8_base library as they are used by the interpreter and the
171cb0ef41Sopenharmony_ci// standalone mkpeephole table generator program.
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_cinamespace v8 {
201cb0ef41Sopenharmony_cinamespace internal {
211cb0ef41Sopenharmony_cinamespace interpreter {
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci// The list of single-byte Star variants, in the format of BYTECODE_LIST.
241cb0ef41Sopenharmony_ci#define SHORT_STAR_BYTECODE_LIST(V)                              \
251cb0ef41Sopenharmony_ci  V(Star15, ImplicitRegisterUse::kReadAccumulatorWriteShortStar) \
261cb0ef41Sopenharmony_ci  V(Star14, ImplicitRegisterUse::kReadAccumulatorWriteShortStar) \
271cb0ef41Sopenharmony_ci  V(Star13, ImplicitRegisterUse::kReadAccumulatorWriteShortStar) \
281cb0ef41Sopenharmony_ci  V(Star12, ImplicitRegisterUse::kReadAccumulatorWriteShortStar) \
291cb0ef41Sopenharmony_ci  V(Star11, ImplicitRegisterUse::kReadAccumulatorWriteShortStar) \
301cb0ef41Sopenharmony_ci  V(Star10, ImplicitRegisterUse::kReadAccumulatorWriteShortStar) \
311cb0ef41Sopenharmony_ci  V(Star9, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
321cb0ef41Sopenharmony_ci  V(Star8, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
331cb0ef41Sopenharmony_ci  V(Star7, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
341cb0ef41Sopenharmony_ci  V(Star6, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
351cb0ef41Sopenharmony_ci  V(Star5, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
361cb0ef41Sopenharmony_ci  V(Star4, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
371cb0ef41Sopenharmony_ci  V(Star3, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
381cb0ef41Sopenharmony_ci  V(Star2, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
391cb0ef41Sopenharmony_ci  V(Star1, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)  \
401cb0ef41Sopenharmony_ci  V(Star0, ImplicitRegisterUse::kReadAccumulatorWriteShortStar)
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci// The list of bytecodes which have unique handlers (no other bytecode is
431cb0ef41Sopenharmony_ci// executed using identical code).
441cb0ef41Sopenharmony_ci// Format is V(<bytecode>, <implicit_register_use>, <operands>).
451cb0ef41Sopenharmony_ci#define BYTECODE_LIST_WITH_UNIQUE_HANDLERS(V)                                  \
461cb0ef41Sopenharmony_ci  /* Extended width operands */                                                \
471cb0ef41Sopenharmony_ci  V(Wide, ImplicitRegisterUse::kNone)                                          \
481cb0ef41Sopenharmony_ci  V(ExtraWide, ImplicitRegisterUse::kNone)                                     \
491cb0ef41Sopenharmony_ci                                                                               \
501cb0ef41Sopenharmony_ci  /* Debug Breakpoints - one for each possible size of unscaled bytecodes */   \
511cb0ef41Sopenharmony_ci  /* and one for each operand widening prefix bytecode                    */   \
521cb0ef41Sopenharmony_ci  V(DebugBreakWide, ImplicitRegisterUse::kReadWriteAccumulator)                \
531cb0ef41Sopenharmony_ci  V(DebugBreakExtraWide, ImplicitRegisterUse::kReadWriteAccumulator)           \
541cb0ef41Sopenharmony_ci  V(DebugBreak0, ImplicitRegisterUse::kReadWriteAccumulator)                   \
551cb0ef41Sopenharmony_ci  V(DebugBreak1, ImplicitRegisterUse::kReadWriteAccumulator,                   \
561cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
571cb0ef41Sopenharmony_ci  V(DebugBreak2, ImplicitRegisterUse::kReadWriteAccumulator,                   \
581cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg)                                      \
591cb0ef41Sopenharmony_ci  V(DebugBreak3, ImplicitRegisterUse::kReadWriteAccumulator,                   \
601cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kReg)                   \
611cb0ef41Sopenharmony_ci  V(DebugBreak4, ImplicitRegisterUse::kReadWriteAccumulator,                   \
621cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kReg,                   \
631cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
641cb0ef41Sopenharmony_ci  V(DebugBreak5, ImplicitRegisterUse::kReadWriteAccumulator,                   \
651cb0ef41Sopenharmony_ci    OperandType::kRuntimeId, OperandType::kReg, OperandType::kReg)             \
661cb0ef41Sopenharmony_ci  V(DebugBreak6, ImplicitRegisterUse::kReadWriteAccumulator,                   \
671cb0ef41Sopenharmony_ci    OperandType::kRuntimeId, OperandType::kReg, OperandType::kReg,             \
681cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
691cb0ef41Sopenharmony_ci                                                                               \
701cb0ef41Sopenharmony_ci  /* Side-effect-free bytecodes -- carefully ordered for efficient checks */   \
711cb0ef41Sopenharmony_ci  /* - [Loading the accumulator] */                                            \
721cb0ef41Sopenharmony_ci  V(Ldar, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg)           \
731cb0ef41Sopenharmony_ci  V(LdaZero, ImplicitRegisterUse::kWriteAccumulator)                           \
741cb0ef41Sopenharmony_ci  V(LdaSmi, ImplicitRegisterUse::kWriteAccumulator, OperandType::kImm)         \
751cb0ef41Sopenharmony_ci  V(LdaUndefined, ImplicitRegisterUse::kWriteAccumulator)                      \
761cb0ef41Sopenharmony_ci  V(LdaNull, ImplicitRegisterUse::kWriteAccumulator)                           \
771cb0ef41Sopenharmony_ci  V(LdaTheHole, ImplicitRegisterUse::kWriteAccumulator)                        \
781cb0ef41Sopenharmony_ci  V(LdaTrue, ImplicitRegisterUse::kWriteAccumulator)                           \
791cb0ef41Sopenharmony_ci  V(LdaFalse, ImplicitRegisterUse::kWriteAccumulator)                          \
801cb0ef41Sopenharmony_ci  V(LdaConstant, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx)    \
811cb0ef41Sopenharmony_ci  V(LdaContextSlot, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
821cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kUImm)                                     \
831cb0ef41Sopenharmony_ci  V(LdaImmutableContextSlot, ImplicitRegisterUse::kWriteAccumulator,           \
841cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx, OperandType::kUImm)                  \
851cb0ef41Sopenharmony_ci  V(LdaCurrentContextSlot, ImplicitRegisterUse::kWriteAccumulator,             \
861cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
871cb0ef41Sopenharmony_ci  V(LdaImmutableCurrentContextSlot, ImplicitRegisterUse::kWriteAccumulator,    \
881cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
891cb0ef41Sopenharmony_ci  /* - [Register Loads ] */                                                    \
901cb0ef41Sopenharmony_ci  V(Star, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut)         \
911cb0ef41Sopenharmony_ci  V(Mov, ImplicitRegisterUse::kNone, OperandType::kReg, OperandType::kRegOut)  \
921cb0ef41Sopenharmony_ci  V(PushContext, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut)  \
931cb0ef41Sopenharmony_ci  V(PopContext, ImplicitRegisterUse::kNone, OperandType::kReg)                 \
941cb0ef41Sopenharmony_ci  /* - [Test Operations ] */                                                   \
951cb0ef41Sopenharmony_ci  V(TestReferenceEqual, ImplicitRegisterUse::kReadWriteAccumulator,            \
961cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
971cb0ef41Sopenharmony_ci  V(TestUndetectable, ImplicitRegisterUse::kReadWriteAccumulator)              \
981cb0ef41Sopenharmony_ci  V(TestNull, ImplicitRegisterUse::kReadWriteAccumulator)                      \
991cb0ef41Sopenharmony_ci  V(TestUndefined, ImplicitRegisterUse::kReadWriteAccumulator)                 \
1001cb0ef41Sopenharmony_ci  V(TestTypeOf, ImplicitRegisterUse::kReadWriteAccumulator,                    \
1011cb0ef41Sopenharmony_ci    OperandType::kFlag8)                                                       \
1021cb0ef41Sopenharmony_ci                                                                               \
1031cb0ef41Sopenharmony_ci  /* Globals */                                                                \
1041cb0ef41Sopenharmony_ci  V(LdaGlobal, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx,      \
1051cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1061cb0ef41Sopenharmony_ci  V(LdaGlobalInsideTypeof, ImplicitRegisterUse::kWriteAccumulator,             \
1071cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx)                                      \
1081cb0ef41Sopenharmony_ci  V(StaGlobal, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx,  \
1091cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1101cb0ef41Sopenharmony_ci                                                                               \
1111cb0ef41Sopenharmony_ci  /* Context operations */                                                     \
1121cb0ef41Sopenharmony_ci  V(StaContextSlot, ImplicitRegisterUse::kReadAccumulator, OperandType::kReg,  \
1131cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kUImm)                                     \
1141cb0ef41Sopenharmony_ci  V(StaCurrentContextSlot, ImplicitRegisterUse::kReadAccumulator,              \
1151cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1161cb0ef41Sopenharmony_ci                                                                               \
1171cb0ef41Sopenharmony_ci  /* Load-Store lookup slots */                                                \
1181cb0ef41Sopenharmony_ci  V(LdaLookupSlot, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx)  \
1191cb0ef41Sopenharmony_ci  V(LdaLookupContextSlot, ImplicitRegisterUse::kWriteAccumulator,              \
1201cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kUImm)                  \
1211cb0ef41Sopenharmony_ci  V(LdaLookupGlobalSlot, ImplicitRegisterUse::kWriteAccumulator,               \
1221cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kUImm)                  \
1231cb0ef41Sopenharmony_ci  V(LdaLookupSlotInsideTypeof, ImplicitRegisterUse::kWriteAccumulator,         \
1241cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1251cb0ef41Sopenharmony_ci  V(LdaLookupContextSlotInsideTypeof, ImplicitRegisterUse::kWriteAccumulator,  \
1261cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kUImm)                  \
1271cb0ef41Sopenharmony_ci  V(LdaLookupGlobalSlotInsideTypeof, ImplicitRegisterUse::kWriteAccumulator,   \
1281cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kUImm)                  \
1291cb0ef41Sopenharmony_ci  V(StaLookupSlot, ImplicitRegisterUse::kReadWriteAccumulator,                 \
1301cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kFlag8)                                    \
1311cb0ef41Sopenharmony_ci                                                                               \
1321cb0ef41Sopenharmony_ci  /* Property loads (LoadIC) operations */                                     \
1331cb0ef41Sopenharmony_ci  V(GetNamedProperty, ImplicitRegisterUse::kWriteAccumulator,                  \
1341cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx, OperandType::kIdx)                   \
1351cb0ef41Sopenharmony_ci  V(GetNamedPropertyFromSuper, ImplicitRegisterUse::kReadWriteAccumulator,     \
1361cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx, OperandType::kIdx)                   \
1371cb0ef41Sopenharmony_ci  V(GetKeyedProperty, ImplicitRegisterUse::kReadWriteAccumulator,              \
1381cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
1391cb0ef41Sopenharmony_ci                                                                               \
1401cb0ef41Sopenharmony_ci  /* Operations on module variables */                                         \
1411cb0ef41Sopenharmony_ci  V(LdaModuleVariable, ImplicitRegisterUse::kWriteAccumulator,                 \
1421cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kUImm)                                     \
1431cb0ef41Sopenharmony_ci  V(StaModuleVariable, ImplicitRegisterUse::kReadAccumulator,                  \
1441cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kUImm)                                     \
1451cb0ef41Sopenharmony_ci                                                                               \
1461cb0ef41Sopenharmony_ci  /* Propery stores (StoreIC) operations */                                    \
1471cb0ef41Sopenharmony_ci  V(SetNamedProperty, ImplicitRegisterUse::kReadWriteAccumulator,              \
1481cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx, OperandType::kIdx)                   \
1491cb0ef41Sopenharmony_ci  V(DefineNamedOwnProperty, ImplicitRegisterUse::kReadWriteAccumulator,        \
1501cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx, OperandType::kIdx)                   \
1511cb0ef41Sopenharmony_ci  V(SetKeyedProperty, ImplicitRegisterUse::kReadWriteAccumulator,              \
1521cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kIdx)                   \
1531cb0ef41Sopenharmony_ci  V(DefineKeyedOwnProperty, ImplicitRegisterUse::kReadWriteAccumulator,        \
1541cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kIdx)                   \
1551cb0ef41Sopenharmony_ci  V(StaInArrayLiteral, ImplicitRegisterUse::kReadWriteAccumulator,             \
1561cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kIdx)                   \
1571cb0ef41Sopenharmony_ci  V(DefineKeyedOwnPropertyInLiteral, ImplicitRegisterUse::kReadAccumulator,    \
1581cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kFlag8,                 \
1591cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1601cb0ef41Sopenharmony_ci  V(CollectTypeProfile, ImplicitRegisterUse::kReadAccumulator,                 \
1611cb0ef41Sopenharmony_ci    OperandType::kImm)                                                         \
1621cb0ef41Sopenharmony_ci                                                                               \
1631cb0ef41Sopenharmony_ci  /* Binary Operators */                                                       \
1641cb0ef41Sopenharmony_ci  V(Add, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,        \
1651cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1661cb0ef41Sopenharmony_ci  V(Sub, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,        \
1671cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1681cb0ef41Sopenharmony_ci  V(Mul, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,        \
1691cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1701cb0ef41Sopenharmony_ci  V(Div, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,        \
1711cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1721cb0ef41Sopenharmony_ci  V(Mod, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,        \
1731cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1741cb0ef41Sopenharmony_ci  V(Exp, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,        \
1751cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1761cb0ef41Sopenharmony_ci  V(BitwiseOr, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,  \
1771cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1781cb0ef41Sopenharmony_ci  V(BitwiseXor, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
1791cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1801cb0ef41Sopenharmony_ci  V(BitwiseAnd, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
1811cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1821cb0ef41Sopenharmony_ci  V(ShiftLeft, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,  \
1831cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1841cb0ef41Sopenharmony_ci  V(ShiftRight, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg, \
1851cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1861cb0ef41Sopenharmony_ci  V(ShiftRightLogical, ImplicitRegisterUse::kReadWriteAccumulator,             \
1871cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
1881cb0ef41Sopenharmony_ci                                                                               \
1891cb0ef41Sopenharmony_ci  /* Binary operators with immediate operands */                               \
1901cb0ef41Sopenharmony_ci  V(AddSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm,     \
1911cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1921cb0ef41Sopenharmony_ci  V(SubSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm,     \
1931cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1941cb0ef41Sopenharmony_ci  V(MulSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm,     \
1951cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1961cb0ef41Sopenharmony_ci  V(DivSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm,     \
1971cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
1981cb0ef41Sopenharmony_ci  V(ModSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm,     \
1991cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2001cb0ef41Sopenharmony_ci  V(ExpSmi, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kImm,     \
2011cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2021cb0ef41Sopenharmony_ci  V(BitwiseOrSmi, ImplicitRegisterUse::kReadWriteAccumulator,                  \
2031cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kIdx)                                      \
2041cb0ef41Sopenharmony_ci  V(BitwiseXorSmi, ImplicitRegisterUse::kReadWriteAccumulator,                 \
2051cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kIdx)                                      \
2061cb0ef41Sopenharmony_ci  V(BitwiseAndSmi, ImplicitRegisterUse::kReadWriteAccumulator,                 \
2071cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kIdx)                                      \
2081cb0ef41Sopenharmony_ci  V(ShiftLeftSmi, ImplicitRegisterUse::kReadWriteAccumulator,                  \
2091cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kIdx)                                      \
2101cb0ef41Sopenharmony_ci  V(ShiftRightSmi, ImplicitRegisterUse::kReadWriteAccumulator,                 \
2111cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kIdx)                                      \
2121cb0ef41Sopenharmony_ci  V(ShiftRightLogicalSmi, ImplicitRegisterUse::kReadWriteAccumulator,          \
2131cb0ef41Sopenharmony_ci    OperandType::kImm, OperandType::kIdx)                                      \
2141cb0ef41Sopenharmony_ci                                                                               \
2151cb0ef41Sopenharmony_ci  /* Unary Operators */                                                        \
2161cb0ef41Sopenharmony_ci  V(Inc, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx)        \
2171cb0ef41Sopenharmony_ci  V(Dec, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx)        \
2181cb0ef41Sopenharmony_ci  V(Negate, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx)     \
2191cb0ef41Sopenharmony_ci  V(BitwiseNot, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx) \
2201cb0ef41Sopenharmony_ci  V(ToBooleanLogicalNot, ImplicitRegisterUse::kReadWriteAccumulator)           \
2211cb0ef41Sopenharmony_ci  V(LogicalNot, ImplicitRegisterUse::kReadWriteAccumulator)                    \
2221cb0ef41Sopenharmony_ci  V(TypeOf, ImplicitRegisterUse::kReadWriteAccumulator)                        \
2231cb0ef41Sopenharmony_ci  V(DeletePropertyStrict, ImplicitRegisterUse::kReadWriteAccumulator,          \
2241cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
2251cb0ef41Sopenharmony_ci  V(DeletePropertySloppy, ImplicitRegisterUse::kReadWriteAccumulator,          \
2261cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
2271cb0ef41Sopenharmony_ci                                                                               \
2281cb0ef41Sopenharmony_ci  /* GetSuperConstructor operator */                                           \
2291cb0ef41Sopenharmony_ci  V(GetSuperConstructor, ImplicitRegisterUse::kReadAccumulator,                \
2301cb0ef41Sopenharmony_ci    OperandType::kRegOut)                                                      \
2311cb0ef41Sopenharmony_ci                                                                               \
2321cb0ef41Sopenharmony_ci  /* Call operations */                                                        \
2331cb0ef41Sopenharmony_ci  V(CallAnyReceiver, ImplicitRegisterUse::kWriteAccumulator,                   \
2341cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kRegList, OperandType::kRegCount,          \
2351cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2361cb0ef41Sopenharmony_ci  V(CallProperty, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,   \
2371cb0ef41Sopenharmony_ci    OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx)          \
2381cb0ef41Sopenharmony_ci  V(CallProperty0, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,  \
2391cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2401cb0ef41Sopenharmony_ci  V(CallProperty1, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,  \
2411cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kIdx)                   \
2421cb0ef41Sopenharmony_ci  V(CallProperty2, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,  \
2431cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kReg,                   \
2441cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2451cb0ef41Sopenharmony_ci  V(CallUndefinedReceiver, ImplicitRegisterUse::kWriteAccumulator,             \
2461cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kRegList, OperandType::kRegCount,          \
2471cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2481cb0ef41Sopenharmony_ci  V(CallUndefinedReceiver0, ImplicitRegisterUse::kWriteAccumulator,            \
2491cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2501cb0ef41Sopenharmony_ci  V(CallUndefinedReceiver1, ImplicitRegisterUse::kWriteAccumulator,            \
2511cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kIdx)                   \
2521cb0ef41Sopenharmony_ci  V(CallUndefinedReceiver2, ImplicitRegisterUse::kWriteAccumulator,            \
2531cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kReg, OperandType::kReg,                   \
2541cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2551cb0ef41Sopenharmony_ci  V(CallWithSpread, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg, \
2561cb0ef41Sopenharmony_ci    OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx)          \
2571cb0ef41Sopenharmony_ci  V(CallRuntime, ImplicitRegisterUse::kWriteAccumulator,                       \
2581cb0ef41Sopenharmony_ci    OperandType::kRuntimeId, OperandType::kRegList, OperandType::kRegCount)    \
2591cb0ef41Sopenharmony_ci  V(CallRuntimeForPair, ImplicitRegisterUse::kNone, OperandType::kRuntimeId,   \
2601cb0ef41Sopenharmony_ci    OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair)   \
2611cb0ef41Sopenharmony_ci  V(CallJSRuntime, ImplicitRegisterUse::kWriteAccumulator,                     \
2621cb0ef41Sopenharmony_ci    OperandType::kNativeContextIndex, OperandType::kRegList,                   \
2631cb0ef41Sopenharmony_ci    OperandType::kRegCount)                                                    \
2641cb0ef41Sopenharmony_ci                                                                               \
2651cb0ef41Sopenharmony_ci  /* Intrinsics */                                                             \
2661cb0ef41Sopenharmony_ci  V(InvokeIntrinsic, ImplicitRegisterUse::kWriteAccumulator,                   \
2671cb0ef41Sopenharmony_ci    OperandType::kIntrinsicId, OperandType::kRegList, OperandType::kRegCount)  \
2681cb0ef41Sopenharmony_ci                                                                               \
2691cb0ef41Sopenharmony_ci  /* Construct operators */                                                    \
2701cb0ef41Sopenharmony_ci  V(Construct, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,  \
2711cb0ef41Sopenharmony_ci    OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx)          \
2721cb0ef41Sopenharmony_ci  V(ConstructWithSpread, ImplicitRegisterUse::kReadWriteAccumulator,           \
2731cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kRegList, OperandType::kRegCount,          \
2741cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2751cb0ef41Sopenharmony_ci                                                                               \
2761cb0ef41Sopenharmony_ci  /* Effectful Test Operators */                                               \
2771cb0ef41Sopenharmony_ci  V(TestEqual, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,  \
2781cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2791cb0ef41Sopenharmony_ci  V(TestEqualStrict, ImplicitRegisterUse::kReadWriteAccumulator,               \
2801cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2811cb0ef41Sopenharmony_ci  V(TestLessThan, ImplicitRegisterUse::kReadWriteAccumulator,                  \
2821cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2831cb0ef41Sopenharmony_ci  V(TestGreaterThan, ImplicitRegisterUse::kReadWriteAccumulator,               \
2841cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2851cb0ef41Sopenharmony_ci  V(TestLessThanOrEqual, ImplicitRegisterUse::kReadWriteAccumulator,           \
2861cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2871cb0ef41Sopenharmony_ci  V(TestGreaterThanOrEqual, ImplicitRegisterUse::kReadWriteAccumulator,        \
2881cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2891cb0ef41Sopenharmony_ci  V(TestInstanceOf, ImplicitRegisterUse::kReadWriteAccumulator,                \
2901cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
2911cb0ef41Sopenharmony_ci  V(TestIn, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kReg,     \
2921cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
2931cb0ef41Sopenharmony_ci                                                                               \
2941cb0ef41Sopenharmony_ci  /* Cast operators */                                                         \
2951cb0ef41Sopenharmony_ci  V(ToName, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut)       \
2961cb0ef41Sopenharmony_ci  V(ToNumber, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx)   \
2971cb0ef41Sopenharmony_ci  V(ToNumeric, ImplicitRegisterUse::kReadWriteAccumulator, OperandType::kIdx)  \
2981cb0ef41Sopenharmony_ci  V(ToObject, ImplicitRegisterUse::kReadAccumulator, OperandType::kRegOut)     \
2991cb0ef41Sopenharmony_ci  V(ToString, ImplicitRegisterUse::kReadWriteAccumulator)                      \
3001cb0ef41Sopenharmony_ci                                                                               \
3011cb0ef41Sopenharmony_ci  /* Literals */                                                               \
3021cb0ef41Sopenharmony_ci  V(CreateRegExpLiteral, ImplicitRegisterUse::kWriteAccumulator,               \
3031cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8)                 \
3041cb0ef41Sopenharmony_ci  V(CreateArrayLiteral, ImplicitRegisterUse::kWriteAccumulator,                \
3051cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8)                 \
3061cb0ef41Sopenharmony_ci  V(CreateArrayFromIterable, ImplicitRegisterUse::kReadWriteAccumulator)       \
3071cb0ef41Sopenharmony_ci  V(CreateEmptyArrayLiteral, ImplicitRegisterUse::kWriteAccumulator,           \
3081cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3091cb0ef41Sopenharmony_ci  V(CreateObjectLiteral, ImplicitRegisterUse::kWriteAccumulator,               \
3101cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8)                 \
3111cb0ef41Sopenharmony_ci  V(CreateEmptyObjectLiteral, ImplicitRegisterUse::kWriteAccumulator)          \
3121cb0ef41Sopenharmony_ci  V(CloneObject, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,    \
3131cb0ef41Sopenharmony_ci    OperandType::kFlag8, OperandType::kIdx)                                    \
3141cb0ef41Sopenharmony_ci                                                                               \
3151cb0ef41Sopenharmony_ci  /* Tagged templates */                                                       \
3161cb0ef41Sopenharmony_ci  V(GetTemplateObject, ImplicitRegisterUse::kWriteAccumulator,                 \
3171cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx)                                      \
3181cb0ef41Sopenharmony_ci                                                                               \
3191cb0ef41Sopenharmony_ci  /* Closure allocation */                                                     \
3201cb0ef41Sopenharmony_ci  V(CreateClosure, ImplicitRegisterUse::kWriteAccumulator, OperandType::kIdx,  \
3211cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kFlag8)                                    \
3221cb0ef41Sopenharmony_ci                                                                               \
3231cb0ef41Sopenharmony_ci  /* Context allocation */                                                     \
3241cb0ef41Sopenharmony_ci  V(CreateBlockContext, ImplicitRegisterUse::kWriteAccumulator,                \
3251cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3261cb0ef41Sopenharmony_ci  V(CreateCatchContext, ImplicitRegisterUse::kWriteAccumulator,                \
3271cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
3281cb0ef41Sopenharmony_ci  V(CreateFunctionContext, ImplicitRegisterUse::kWriteAccumulator,             \
3291cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kUImm)                                     \
3301cb0ef41Sopenharmony_ci  V(CreateEvalContext, ImplicitRegisterUse::kWriteAccumulator,                 \
3311cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kUImm)                                     \
3321cb0ef41Sopenharmony_ci  V(CreateWithContext, ImplicitRegisterUse::kWriteAccumulator,                 \
3331cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kIdx)                                      \
3341cb0ef41Sopenharmony_ci                                                                               \
3351cb0ef41Sopenharmony_ci  /* Arguments allocation */                                                   \
3361cb0ef41Sopenharmony_ci  V(CreateMappedArguments, ImplicitRegisterUse::kWriteAccumulator)             \
3371cb0ef41Sopenharmony_ci  V(CreateUnmappedArguments, ImplicitRegisterUse::kWriteAccumulator)           \
3381cb0ef41Sopenharmony_ci  V(CreateRestParameter, ImplicitRegisterUse::kWriteAccumulator)               \
3391cb0ef41Sopenharmony_ci                                                                               \
3401cb0ef41Sopenharmony_ci  /* Control Flow -- carefully ordered for efficient checks */                 \
3411cb0ef41Sopenharmony_ci  /* - [Unconditional jumps] */                                                \
3421cb0ef41Sopenharmony_ci  V(JumpLoop, ImplicitRegisterUse::kNone, OperandType::kUImm,                  \
3431cb0ef41Sopenharmony_ci    OperandType::kImm)                                                         \
3441cb0ef41Sopenharmony_ci  /* - [Forward jumps] */                                                      \
3451cb0ef41Sopenharmony_ci  V(Jump, ImplicitRegisterUse::kNone, OperandType::kUImm)                      \
3461cb0ef41Sopenharmony_ci  /* - [Start constant jumps] */                                               \
3471cb0ef41Sopenharmony_ci  V(JumpConstant, ImplicitRegisterUse::kNone, OperandType::kIdx)               \
3481cb0ef41Sopenharmony_ci  /* - [Conditional jumps] */                                                  \
3491cb0ef41Sopenharmony_ci  /* - [Conditional constant jumps] */                                         \
3501cb0ef41Sopenharmony_ci  V(JumpIfNullConstant, ImplicitRegisterUse::kReadAccumulator,                 \
3511cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3521cb0ef41Sopenharmony_ci  V(JumpIfNotNullConstant, ImplicitRegisterUse::kReadAccumulator,              \
3531cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3541cb0ef41Sopenharmony_ci  V(JumpIfUndefinedConstant, ImplicitRegisterUse::kReadAccumulator,            \
3551cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3561cb0ef41Sopenharmony_ci  V(JumpIfNotUndefinedConstant, ImplicitRegisterUse::kReadAccumulator,         \
3571cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3581cb0ef41Sopenharmony_ci  V(JumpIfUndefinedOrNullConstant, ImplicitRegisterUse::kReadAccumulator,      \
3591cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3601cb0ef41Sopenharmony_ci  V(JumpIfTrueConstant, ImplicitRegisterUse::kReadAccumulator,                 \
3611cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3621cb0ef41Sopenharmony_ci  V(JumpIfFalseConstant, ImplicitRegisterUse::kReadAccumulator,                \
3631cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3641cb0ef41Sopenharmony_ci  V(JumpIfJSReceiverConstant, ImplicitRegisterUse::kReadAccumulator,           \
3651cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3661cb0ef41Sopenharmony_ci  /* - [Start ToBoolean jumps] */                                              \
3671cb0ef41Sopenharmony_ci  V(JumpIfToBooleanTrueConstant, ImplicitRegisterUse::kReadAccumulator,        \
3681cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3691cb0ef41Sopenharmony_ci  V(JumpIfToBooleanFalseConstant, ImplicitRegisterUse::kReadAccumulator,       \
3701cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
3711cb0ef41Sopenharmony_ci  /* - [End constant jumps] */                                                 \
3721cb0ef41Sopenharmony_ci  /* - [Conditional immediate jumps] */                                        \
3731cb0ef41Sopenharmony_ci  V(JumpIfToBooleanTrue, ImplicitRegisterUse::kReadAccumulator,                \
3741cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
3751cb0ef41Sopenharmony_ci  V(JumpIfToBooleanFalse, ImplicitRegisterUse::kReadAccumulator,               \
3761cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
3771cb0ef41Sopenharmony_ci  /* - [End ToBoolean jumps] */                                                \
3781cb0ef41Sopenharmony_ci  V(JumpIfTrue, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm)     \
3791cb0ef41Sopenharmony_ci  V(JumpIfFalse, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm)    \
3801cb0ef41Sopenharmony_ci  V(JumpIfNull, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm)     \
3811cb0ef41Sopenharmony_ci  V(JumpIfNotNull, ImplicitRegisterUse::kReadAccumulator, OperandType::kUImm)  \
3821cb0ef41Sopenharmony_ci  V(JumpIfUndefined, ImplicitRegisterUse::kReadAccumulator,                    \
3831cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
3841cb0ef41Sopenharmony_ci  V(JumpIfNotUndefined, ImplicitRegisterUse::kReadAccumulator,                 \
3851cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
3861cb0ef41Sopenharmony_ci  V(JumpIfUndefinedOrNull, ImplicitRegisterUse::kReadAccumulator,              \
3871cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
3881cb0ef41Sopenharmony_ci  V(JumpIfJSReceiver, ImplicitRegisterUse::kReadAccumulator,                   \
3891cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
3901cb0ef41Sopenharmony_ci                                                                               \
3911cb0ef41Sopenharmony_ci  /* Smi-table lookup for switch statements */                                 \
3921cb0ef41Sopenharmony_ci  V(SwitchOnSmiNoFeedback, ImplicitRegisterUse::kReadAccumulator,              \
3931cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kUImm, OperandType::kImm)                  \
3941cb0ef41Sopenharmony_ci                                                                               \
3951cb0ef41Sopenharmony_ci  /* Complex flow control For..in */                                           \
3961cb0ef41Sopenharmony_ci  V(ForInEnumerate, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg) \
3971cb0ef41Sopenharmony_ci  V(ForInPrepare, ImplicitRegisterUse::kReadWriteAccumulator,                  \
3981cb0ef41Sopenharmony_ci    OperandType::kRegOutTriple, OperandType::kIdx)                             \
3991cb0ef41Sopenharmony_ci  V(ForInContinue, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,  \
4001cb0ef41Sopenharmony_ci    OperandType::kReg)                                                         \
4011cb0ef41Sopenharmony_ci  V(ForInNext, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,      \
4021cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kRegPair, OperandType::kIdx)               \
4031cb0ef41Sopenharmony_ci  V(ForInStep, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg)      \
4041cb0ef41Sopenharmony_ci                                                                               \
4051cb0ef41Sopenharmony_ci  /* Update the pending message */                                             \
4061cb0ef41Sopenharmony_ci  V(SetPendingMessage, ImplicitRegisterUse::kReadWriteAccumulator)             \
4071cb0ef41Sopenharmony_ci                                                                               \
4081cb0ef41Sopenharmony_ci  /* Non-local flow control */                                                 \
4091cb0ef41Sopenharmony_ci  V(Throw, ImplicitRegisterUse::kReadAccumulator)                              \
4101cb0ef41Sopenharmony_ci  V(ReThrow, ImplicitRegisterUse::kReadAccumulator)                            \
4111cb0ef41Sopenharmony_ci  V(Return, ImplicitRegisterUse::kReadAccumulator)                             \
4121cb0ef41Sopenharmony_ci  V(ThrowReferenceErrorIfHole, ImplicitRegisterUse::kReadAccumulator,          \
4131cb0ef41Sopenharmony_ci    OperandType::kIdx)                                                         \
4141cb0ef41Sopenharmony_ci  V(ThrowSuperNotCalledIfHole, ImplicitRegisterUse::kReadAccumulator)          \
4151cb0ef41Sopenharmony_ci  V(ThrowSuperAlreadyCalledIfNotHole, ImplicitRegisterUse::kReadAccumulator)   \
4161cb0ef41Sopenharmony_ci  V(ThrowIfNotSuperConstructor, ImplicitRegisterUse::kNone, OperandType::kReg) \
4171cb0ef41Sopenharmony_ci                                                                               \
4181cb0ef41Sopenharmony_ci  /* Generators */                                                             \
4191cb0ef41Sopenharmony_ci  V(SwitchOnGeneratorState, ImplicitRegisterUse::kNone, OperandType::kReg,     \
4201cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kUImm)                                     \
4211cb0ef41Sopenharmony_ci  V(SuspendGenerator, ImplicitRegisterUse::kReadAccumulator,                   \
4221cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kRegList, OperandType::kRegCount,          \
4231cb0ef41Sopenharmony_ci    OperandType::kUImm)                                                        \
4241cb0ef41Sopenharmony_ci  V(ResumeGenerator, ImplicitRegisterUse::kWriteAccumulator,                   \
4251cb0ef41Sopenharmony_ci    OperandType::kReg, OperandType::kRegOutList, OperandType::kRegCount)       \
4261cb0ef41Sopenharmony_ci                                                                               \
4271cb0ef41Sopenharmony_ci  /* Iterator protocol operations */                                           \
4281cb0ef41Sopenharmony_ci  V(GetIterator, ImplicitRegisterUse::kWriteAccumulator, OperandType::kReg,    \
4291cb0ef41Sopenharmony_ci    OperandType::kIdx, OperandType::kIdx)                                      \
4301cb0ef41Sopenharmony_ci                                                                               \
4311cb0ef41Sopenharmony_ci  /* Debugger */                                                               \
4321cb0ef41Sopenharmony_ci  V(Debugger, ImplicitRegisterUse::kNone)                                      \
4331cb0ef41Sopenharmony_ci                                                                               \
4341cb0ef41Sopenharmony_ci  /* Block Coverage */                                                         \
4351cb0ef41Sopenharmony_ci  V(IncBlockCounter, ImplicitRegisterUse::kNone, OperandType::kIdx)            \
4361cb0ef41Sopenharmony_ci                                                                               \
4371cb0ef41Sopenharmony_ci  /* Execution Abort (internal error) */                                       \
4381cb0ef41Sopenharmony_ci  V(Abort, ImplicitRegisterUse::kNone, OperandType::kIdx)
4391cb0ef41Sopenharmony_ci
4401cb0ef41Sopenharmony_ci// The list of bytecodes which are interpreted by the interpreter.
4411cb0ef41Sopenharmony_ci// Format is V(<bytecode>, <implicit_register_use>, <operands>).
4421cb0ef41Sopenharmony_ci#define BYTECODE_LIST(V)                                             \
4431cb0ef41Sopenharmony_ci  BYTECODE_LIST_WITH_UNIQUE_HANDLERS(V)                              \
4441cb0ef41Sopenharmony_ci                                                                     \
4451cb0ef41Sopenharmony_ci  /* Special-case Star for common register numbers, to save space */ \
4461cb0ef41Sopenharmony_ci  SHORT_STAR_BYTECODE_LIST(V)                                        \
4471cb0ef41Sopenharmony_ci                                                                     \
4481cb0ef41Sopenharmony_ci  /* Illegal bytecode  */                                            \
4491cb0ef41Sopenharmony_ci  V(Illegal, ImplicitRegisterUse::kNone)
4501cb0ef41Sopenharmony_ci
4511cb0ef41Sopenharmony_ci// List of debug break bytecodes.
4521cb0ef41Sopenharmony_ci#define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \
4531cb0ef41Sopenharmony_ci  V(DebugBreak0)                           \
4541cb0ef41Sopenharmony_ci  V(DebugBreak1)                           \
4551cb0ef41Sopenharmony_ci  V(DebugBreak2)                           \
4561cb0ef41Sopenharmony_ci  V(DebugBreak3)                           \
4571cb0ef41Sopenharmony_ci  V(DebugBreak4)                           \
4581cb0ef41Sopenharmony_ci  V(DebugBreak5)                           \
4591cb0ef41Sopenharmony_ci  V(DebugBreak6)
4601cb0ef41Sopenharmony_ci
4611cb0ef41Sopenharmony_ci#define DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) \
4621cb0ef41Sopenharmony_ci  V(DebugBreakWide)                         \
4631cb0ef41Sopenharmony_ci  V(DebugBreakExtraWide)
4641cb0ef41Sopenharmony_ci
4651cb0ef41Sopenharmony_ci#define DEBUG_BREAK_BYTECODE_LIST(V) \
4661cb0ef41Sopenharmony_ci  DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \
4671cb0ef41Sopenharmony_ci  DEBUG_BREAK_PREFIX_BYTECODE_LIST(V)
4681cb0ef41Sopenharmony_ci
4691cb0ef41Sopenharmony_ci// Lists of jump bytecodes.
4701cb0ef41Sopenharmony_ci
4711cb0ef41Sopenharmony_ci#define JUMP_UNCONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
4721cb0ef41Sopenharmony_ci  V(JumpLoop)                                         \
4731cb0ef41Sopenharmony_ci  V(Jump)
4741cb0ef41Sopenharmony_ci
4751cb0ef41Sopenharmony_ci#define JUMP_UNCONDITIONAL_CONSTANT_BYTECODE_LIST(V) V(JumpConstant)
4761cb0ef41Sopenharmony_ci
4771cb0ef41Sopenharmony_ci#define JUMP_TOBOOLEAN_CONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
4781cb0ef41Sopenharmony_ci  V(JumpIfToBooleanTrue)                                      \
4791cb0ef41Sopenharmony_ci  V(JumpIfToBooleanFalse)
4801cb0ef41Sopenharmony_ci
4811cb0ef41Sopenharmony_ci#define JUMP_TOBOOLEAN_CONDITIONAL_CONSTANT_BYTECODE_LIST(V) \
4821cb0ef41Sopenharmony_ci  V(JumpIfToBooleanTrueConstant)                             \
4831cb0ef41Sopenharmony_ci  V(JumpIfToBooleanFalseConstant)
4841cb0ef41Sopenharmony_ci
4851cb0ef41Sopenharmony_ci#define JUMP_CONDITIONAL_IMMEDIATE_BYTECODE_LIST(V)     \
4861cb0ef41Sopenharmony_ci  JUMP_TOBOOLEAN_CONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
4871cb0ef41Sopenharmony_ci  V(JumpIfTrue)                                         \
4881cb0ef41Sopenharmony_ci  V(JumpIfFalse)                                        \
4891cb0ef41Sopenharmony_ci  V(JumpIfNull)                                         \
4901cb0ef41Sopenharmony_ci  V(JumpIfNotNull)                                      \
4911cb0ef41Sopenharmony_ci  V(JumpIfUndefined)                                    \
4921cb0ef41Sopenharmony_ci  V(JumpIfNotUndefined)                                 \
4931cb0ef41Sopenharmony_ci  V(JumpIfUndefinedOrNull)                              \
4941cb0ef41Sopenharmony_ci  V(JumpIfJSReceiver)
4951cb0ef41Sopenharmony_ci
4961cb0ef41Sopenharmony_ci#define JUMP_CONDITIONAL_CONSTANT_BYTECODE_LIST(V)     \
4971cb0ef41Sopenharmony_ci  JUMP_TOBOOLEAN_CONDITIONAL_CONSTANT_BYTECODE_LIST(V) \
4981cb0ef41Sopenharmony_ci  V(JumpIfNullConstant)                                \
4991cb0ef41Sopenharmony_ci  V(JumpIfNotNullConstant)                             \
5001cb0ef41Sopenharmony_ci  V(JumpIfUndefinedConstant)                           \
5011cb0ef41Sopenharmony_ci  V(JumpIfNotUndefinedConstant)                        \
5021cb0ef41Sopenharmony_ci  V(JumpIfUndefinedOrNullConstant)                     \
5031cb0ef41Sopenharmony_ci  V(JumpIfTrueConstant)                                \
5041cb0ef41Sopenharmony_ci  V(JumpIfFalseConstant)                               \
5051cb0ef41Sopenharmony_ci  V(JumpIfJSReceiverConstant)
5061cb0ef41Sopenharmony_ci
5071cb0ef41Sopenharmony_ci#define JUMP_CONSTANT_BYTECODE_LIST(V)         \
5081cb0ef41Sopenharmony_ci  JUMP_UNCONDITIONAL_CONSTANT_BYTECODE_LIST(V) \
5091cb0ef41Sopenharmony_ci  JUMP_CONDITIONAL_CONSTANT_BYTECODE_LIST(V)
5101cb0ef41Sopenharmony_ci
5111cb0ef41Sopenharmony_ci#define JUMP_IMMEDIATE_BYTECODE_LIST(V)         \
5121cb0ef41Sopenharmony_ci  JUMP_UNCONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
5131cb0ef41Sopenharmony_ci  JUMP_CONDITIONAL_IMMEDIATE_BYTECODE_LIST(V)
5141cb0ef41Sopenharmony_ci
5151cb0ef41Sopenharmony_ci#define JUMP_TO_BOOLEAN_BYTECODE_LIST(V)                \
5161cb0ef41Sopenharmony_ci  JUMP_TOBOOLEAN_CONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
5171cb0ef41Sopenharmony_ci  JUMP_TOBOOLEAN_CONDITIONAL_CONSTANT_BYTECODE_LIST(V)
5181cb0ef41Sopenharmony_ci
5191cb0ef41Sopenharmony_ci#define JUMP_UNCONDITIONAL_BYTECODE_LIST(V)     \
5201cb0ef41Sopenharmony_ci  JUMP_UNCONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
5211cb0ef41Sopenharmony_ci  JUMP_UNCONDITIONAL_CONSTANT_BYTECODE_LIST(V)
5221cb0ef41Sopenharmony_ci
5231cb0ef41Sopenharmony_ci#define JUMP_CONDITIONAL_BYTECODE_LIST(V)     \
5241cb0ef41Sopenharmony_ci  JUMP_CONDITIONAL_IMMEDIATE_BYTECODE_LIST(V) \
5251cb0ef41Sopenharmony_ci  JUMP_CONDITIONAL_CONSTANT_BYTECODE_LIST(V)
5261cb0ef41Sopenharmony_ci
5271cb0ef41Sopenharmony_ci#define JUMP_FORWARD_BYTECODE_LIST(V) \
5281cb0ef41Sopenharmony_ci  V(Jump)                             \
5291cb0ef41Sopenharmony_ci  V(JumpConstant)                     \
5301cb0ef41Sopenharmony_ci  JUMP_CONDITIONAL_BYTECODE_LIST(V)
5311cb0ef41Sopenharmony_ci
5321cb0ef41Sopenharmony_ci#define JUMP_BYTECODE_LIST(V)   \
5331cb0ef41Sopenharmony_ci  JUMP_FORWARD_BYTECODE_LIST(V) \
5341cb0ef41Sopenharmony_ci  V(JumpLoop)
5351cb0ef41Sopenharmony_ci
5361cb0ef41Sopenharmony_ci#define RETURN_BYTECODE_LIST(V) \
5371cb0ef41Sopenharmony_ci  V(Return)                     \
5381cb0ef41Sopenharmony_ci  V(SuspendGenerator)
5391cb0ef41Sopenharmony_ci
5401cb0ef41Sopenharmony_ci#define UNCONDITIONAL_THROW_BYTECODE_LIST(V) \
5411cb0ef41Sopenharmony_ci  V(Throw)                                   \
5421cb0ef41Sopenharmony_ci  V(ReThrow)
5431cb0ef41Sopenharmony_ci
5441cb0ef41Sopenharmony_ci// Enumeration of interpreter bytecodes.
5451cb0ef41Sopenharmony_cienum class Bytecode : uint8_t {
5461cb0ef41Sopenharmony_ci#define DECLARE_BYTECODE(Name, ...) k##Name,
5471cb0ef41Sopenharmony_ci  BYTECODE_LIST(DECLARE_BYTECODE)
5481cb0ef41Sopenharmony_ci#undef DECLARE_BYTECODE
5491cb0ef41Sopenharmony_ci#define COUNT_BYTECODE(x, ...) +1
5501cb0ef41Sopenharmony_ci  // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will
5511cb0ef41Sopenharmony_ci  // evaluate to the same value as the last real bytecode.
5521cb0ef41Sopenharmony_ci  kLast = -1 BYTECODE_LIST(COUNT_BYTECODE),
5531cb0ef41Sopenharmony_ci  kFirstShortStar = kStar15,
5541cb0ef41Sopenharmony_ci  kLastShortStar = kStar0
5551cb0ef41Sopenharmony_ci#undef COUNT_BYTECODE
5561cb0ef41Sopenharmony_ci};
5571cb0ef41Sopenharmony_ci
5581cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
5591cb0ef41Sopenharmony_ci public:
5601cb0ef41Sopenharmony_ci  // The maximum number of operands a bytecode may have.
5611cb0ef41Sopenharmony_ci  static const int kMaxOperands = 5;
5621cb0ef41Sopenharmony_ci
5631cb0ef41Sopenharmony_ci  // The total number of bytecodes used.
5641cb0ef41Sopenharmony_ci  static const int kBytecodeCount = static_cast<int>(Bytecode::kLast) + 1;
5651cb0ef41Sopenharmony_ci
5661cb0ef41Sopenharmony_ci  static const int kShortStarCount =
5671cb0ef41Sopenharmony_ci      static_cast<int>(Bytecode::kLastShortStar) -
5681cb0ef41Sopenharmony_ci      static_cast<int>(Bytecode::kFirstShortStar) + 1;
5691cb0ef41Sopenharmony_ci
5701cb0ef41Sopenharmony_ci  // Returns string representation of |bytecode|.
5711cb0ef41Sopenharmony_ci  static const char* ToString(Bytecode bytecode);
5721cb0ef41Sopenharmony_ci
5731cb0ef41Sopenharmony_ci  // Returns string representation of |bytecode| combined with |operand_scale|
5741cb0ef41Sopenharmony_ci  // using the optionally provided |separator|.
5751cb0ef41Sopenharmony_ci  static std::string ToString(Bytecode bytecode, OperandScale operand_scale,
5761cb0ef41Sopenharmony_ci                              const char* separator = ".");
5771cb0ef41Sopenharmony_ci
5781cb0ef41Sopenharmony_ci  // Returns byte value of bytecode.
5791cb0ef41Sopenharmony_ci  static uint8_t ToByte(Bytecode bytecode) {
5801cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
5811cb0ef41Sopenharmony_ci    return static_cast<uint8_t>(bytecode);
5821cb0ef41Sopenharmony_ci  }
5831cb0ef41Sopenharmony_ci
5841cb0ef41Sopenharmony_ci  // Returns bytecode for |value|.
5851cb0ef41Sopenharmony_ci  static Bytecode FromByte(uint8_t value) {
5861cb0ef41Sopenharmony_ci    Bytecode bytecode = static_cast<Bytecode>(value);
5871cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
5881cb0ef41Sopenharmony_ci    return bytecode;
5891cb0ef41Sopenharmony_ci  }
5901cb0ef41Sopenharmony_ci
5911cb0ef41Sopenharmony_ci  // Returns the prefix bytecode representing an operand scale to be
5921cb0ef41Sopenharmony_ci  // applied to a a bytecode.
5931cb0ef41Sopenharmony_ci  static Bytecode OperandScaleToPrefixBytecode(OperandScale operand_scale) {
5941cb0ef41Sopenharmony_ci    switch (operand_scale) {
5951cb0ef41Sopenharmony_ci      case OperandScale::kQuadruple:
5961cb0ef41Sopenharmony_ci        return Bytecode::kExtraWide;
5971cb0ef41Sopenharmony_ci      case OperandScale::kDouble:
5981cb0ef41Sopenharmony_ci        return Bytecode::kWide;
5991cb0ef41Sopenharmony_ci      default:
6001cb0ef41Sopenharmony_ci        UNREACHABLE();
6011cb0ef41Sopenharmony_ci    }
6021cb0ef41Sopenharmony_ci  }
6031cb0ef41Sopenharmony_ci
6041cb0ef41Sopenharmony_ci  // Returns true if the operand scale requires a prefix bytecode.
6051cb0ef41Sopenharmony_ci  static bool OperandScaleRequiresPrefixBytecode(OperandScale operand_scale) {
6061cb0ef41Sopenharmony_ci    return operand_scale != OperandScale::kSingle;
6071cb0ef41Sopenharmony_ci  }
6081cb0ef41Sopenharmony_ci
6091cb0ef41Sopenharmony_ci  // Returns the scaling applied to scalable operands if bytecode is
6101cb0ef41Sopenharmony_ci  // is a scaling prefix.
6111cb0ef41Sopenharmony_ci  static OperandScale PrefixBytecodeToOperandScale(Bytecode bytecode) {
6121cb0ef41Sopenharmony_ci    switch (bytecode) {
6131cb0ef41Sopenharmony_ci      case Bytecode::kExtraWide:
6141cb0ef41Sopenharmony_ci      case Bytecode::kDebugBreakExtraWide:
6151cb0ef41Sopenharmony_ci        return OperandScale::kQuadruple;
6161cb0ef41Sopenharmony_ci      case Bytecode::kWide:
6171cb0ef41Sopenharmony_ci      case Bytecode::kDebugBreakWide:
6181cb0ef41Sopenharmony_ci        return OperandScale::kDouble;
6191cb0ef41Sopenharmony_ci      default:
6201cb0ef41Sopenharmony_ci        UNREACHABLE();
6211cb0ef41Sopenharmony_ci    }
6221cb0ef41Sopenharmony_ci  }
6231cb0ef41Sopenharmony_ci
6241cb0ef41Sopenharmony_ci  // Returns how accumulator is used by |bytecode|.
6251cb0ef41Sopenharmony_ci  static ImplicitRegisterUse GetImplicitRegisterUse(Bytecode bytecode) {
6261cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
6271cb0ef41Sopenharmony_ci    return kImplicitRegisterUse[static_cast<size_t>(bytecode)];
6281cb0ef41Sopenharmony_ci  }
6291cb0ef41Sopenharmony_ci
6301cb0ef41Sopenharmony_ci  // Returns true if |bytecode| reads the accumulator.
6311cb0ef41Sopenharmony_ci  static bool ReadsAccumulator(Bytecode bytecode) {
6321cb0ef41Sopenharmony_ci    return BytecodeOperands::ReadsAccumulator(GetImplicitRegisterUse(bytecode));
6331cb0ef41Sopenharmony_ci  }
6341cb0ef41Sopenharmony_ci
6351cb0ef41Sopenharmony_ci  // Returns true if |bytecode| writes the accumulator.
6361cb0ef41Sopenharmony_ci  static bool WritesAccumulator(Bytecode bytecode) {
6371cb0ef41Sopenharmony_ci    return BytecodeOperands::WritesAccumulator(
6381cb0ef41Sopenharmony_ci        GetImplicitRegisterUse(bytecode));
6391cb0ef41Sopenharmony_ci  }
6401cb0ef41Sopenharmony_ci
6411cb0ef41Sopenharmony_ci  // Returns true if |bytecode| writes to a register not specified by an
6421cb0ef41Sopenharmony_ci  // operand.
6431cb0ef41Sopenharmony_ci  static bool WritesImplicitRegister(Bytecode bytecode) {
6441cb0ef41Sopenharmony_ci    return BytecodeOperands::WritesImplicitRegister(
6451cb0ef41Sopenharmony_ci        GetImplicitRegisterUse(bytecode));
6461cb0ef41Sopenharmony_ci  }
6471cb0ef41Sopenharmony_ci
6481cb0ef41Sopenharmony_ci  // Return true if |bytecode| is an accumulator load without effects,
6491cb0ef41Sopenharmony_ci  // e.g. LdaConstant, LdaTrue, Ldar.
6501cb0ef41Sopenharmony_ci  static constexpr bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) {
6511cb0ef41Sopenharmony_ci    STATIC_ASSERT(Bytecode::kLdar < Bytecode::kLdaImmutableCurrentContextSlot);
6521cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kLdar &&
6531cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kLdaImmutableCurrentContextSlot;
6541cb0ef41Sopenharmony_ci  }
6551cb0ef41Sopenharmony_ci
6561cb0ef41Sopenharmony_ci  // Returns true if |bytecode| is a compare operation without external effects
6571cb0ef41Sopenharmony_ci  // (e.g., Type cooersion).
6581cb0ef41Sopenharmony_ci  static constexpr bool IsCompareWithoutEffects(Bytecode bytecode) {
6591cb0ef41Sopenharmony_ci    STATIC_ASSERT(Bytecode::kTestReferenceEqual < Bytecode::kTestTypeOf);
6601cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kTestReferenceEqual &&
6611cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kTestTypeOf;
6621cb0ef41Sopenharmony_ci  }
6631cb0ef41Sopenharmony_ci
6641cb0ef41Sopenharmony_ci  static constexpr bool IsShortStar(Bytecode bytecode) {
6651cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kFirstShortStar &&
6661cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kLastShortStar;
6671cb0ef41Sopenharmony_ci  }
6681cb0ef41Sopenharmony_ci
6691cb0ef41Sopenharmony_ci  static constexpr bool IsAnyStar(Bytecode bytecode) {
6701cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kStar || IsShortStar(bytecode);
6711cb0ef41Sopenharmony_ci  }
6721cb0ef41Sopenharmony_ci
6731cb0ef41Sopenharmony_ci  // Return true if |bytecode| is a register load without effects,
6741cb0ef41Sopenharmony_ci  // e.g. Mov, Star.
6751cb0ef41Sopenharmony_ci  static constexpr bool IsRegisterLoadWithoutEffects(Bytecode bytecode) {
6761cb0ef41Sopenharmony_ci    return IsShortStar(bytecode) ||
6771cb0ef41Sopenharmony_ci           (bytecode >= Bytecode::kStar && bytecode <= Bytecode::kPopContext);
6781cb0ef41Sopenharmony_ci  }
6791cb0ef41Sopenharmony_ci
6801cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a conditional jump taking
6811cb0ef41Sopenharmony_ci  // an immediate byte operand (OperandType::kImm).
6821cb0ef41Sopenharmony_ci  static constexpr bool IsConditionalJumpImmediate(Bytecode bytecode) {
6831cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpIfToBooleanTrue &&
6841cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfJSReceiver;
6851cb0ef41Sopenharmony_ci  }
6861cb0ef41Sopenharmony_ci
6871cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a conditional jump taking
6881cb0ef41Sopenharmony_ci  // a constant pool entry (OperandType::kIdx).
6891cb0ef41Sopenharmony_ci  static constexpr bool IsConditionalJumpConstant(Bytecode bytecode) {
6901cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpIfNullConstant &&
6911cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfToBooleanFalseConstant;
6921cb0ef41Sopenharmony_ci  }
6931cb0ef41Sopenharmony_ci
6941cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a conditional jump taking
6951cb0ef41Sopenharmony_ci  // any kind of operand.
6961cb0ef41Sopenharmony_ci  static constexpr bool IsConditionalJump(Bytecode bytecode) {
6971cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpIfNullConstant &&
6981cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfJSReceiver;
6991cb0ef41Sopenharmony_ci  }
7001cb0ef41Sopenharmony_ci
7011cb0ef41Sopenharmony_ci  // Returns true if the bytecode is an unconditional jump.
7021cb0ef41Sopenharmony_ci  static constexpr bool IsUnconditionalJump(Bytecode bytecode) {
7031cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpLoop &&
7041cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpConstant;
7051cb0ef41Sopenharmony_ci  }
7061cb0ef41Sopenharmony_ci
7071cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a jump or a conditional jump taking
7081cb0ef41Sopenharmony_ci  // an immediate byte operand (OperandType::kImm).
7091cb0ef41Sopenharmony_ci  static constexpr bool IsJumpImmediate(Bytecode bytecode) {
7101cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kJump || bytecode == Bytecode::kJumpLoop ||
7111cb0ef41Sopenharmony_ci           IsConditionalJumpImmediate(bytecode);
7121cb0ef41Sopenharmony_ci  }
7131cb0ef41Sopenharmony_ci
7141cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a jump or conditional jump taking a
7151cb0ef41Sopenharmony_ci  // constant pool entry (OperandType::kIdx).
7161cb0ef41Sopenharmony_ci  static constexpr bool IsJumpConstant(Bytecode bytecode) {
7171cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpConstant &&
7181cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfToBooleanFalseConstant;
7191cb0ef41Sopenharmony_ci  }
7201cb0ef41Sopenharmony_ci
7211cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a jump that internally coerces the
7221cb0ef41Sopenharmony_ci  // accumulator to a boolean.
7231cb0ef41Sopenharmony_ci  static constexpr bool IsJumpIfToBoolean(Bytecode bytecode) {
7241cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpIfToBooleanTrueConstant &&
7251cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfToBooleanFalse;
7261cb0ef41Sopenharmony_ci  }
7271cb0ef41Sopenharmony_ci
7281cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a jump or conditional jump taking
7291cb0ef41Sopenharmony_ci  // any kind of operand.
7301cb0ef41Sopenharmony_ci  static constexpr bool IsJump(Bytecode bytecode) {
7311cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJumpLoop &&
7321cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfJSReceiver;
7331cb0ef41Sopenharmony_ci  }
7341cb0ef41Sopenharmony_ci
7351cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a forward jump or conditional jump taking
7361cb0ef41Sopenharmony_ci  // any kind of operand.
7371cb0ef41Sopenharmony_ci  static constexpr bool IsForwardJump(Bytecode bytecode) {
7381cb0ef41Sopenharmony_ci    return bytecode >= Bytecode::kJump &&
7391cb0ef41Sopenharmony_ci           bytecode <= Bytecode::kJumpIfJSReceiver;
7401cb0ef41Sopenharmony_ci  }
7411cb0ef41Sopenharmony_ci
7421cb0ef41Sopenharmony_ci  // Return true if |bytecode| is a jump without effects,
7431cb0ef41Sopenharmony_ci  // e.g. any jump excluding those that include type coercion like
7441cb0ef41Sopenharmony_ci  // JumpIfTrueToBoolean, and JumpLoop due to having an implicit StackCheck.
7451cb0ef41Sopenharmony_ci  static constexpr bool IsJumpWithoutEffects(Bytecode bytecode) {
7461cb0ef41Sopenharmony_ci    return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode) &&
7471cb0ef41Sopenharmony_ci           bytecode != Bytecode::kJumpLoop;
7481cb0ef41Sopenharmony_ci  }
7491cb0ef41Sopenharmony_ci
7501cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a switch.
7511cb0ef41Sopenharmony_ci  static constexpr bool IsSwitch(Bytecode bytecode) {
7521cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kSwitchOnSmiNoFeedback ||
7531cb0ef41Sopenharmony_ci           bytecode == Bytecode::kSwitchOnGeneratorState;
7541cb0ef41Sopenharmony_ci  }
7551cb0ef41Sopenharmony_ci
7561cb0ef41Sopenharmony_ci  // Returns true if |bytecode| has no effects. These bytecodes only manipulate
7571cb0ef41Sopenharmony_ci  // interpreter frame state and will never throw.
7581cb0ef41Sopenharmony_ci  static constexpr bool IsWithoutExternalSideEffects(Bytecode bytecode) {
7591cb0ef41Sopenharmony_ci    return (IsAccumulatorLoadWithoutEffects(bytecode) ||
7601cb0ef41Sopenharmony_ci            IsRegisterLoadWithoutEffects(bytecode) ||
7611cb0ef41Sopenharmony_ci            IsCompareWithoutEffects(bytecode) ||
7621cb0ef41Sopenharmony_ci            IsJumpWithoutEffects(bytecode) || IsSwitch(bytecode));
7631cb0ef41Sopenharmony_ci  }
7641cb0ef41Sopenharmony_ci
7651cb0ef41Sopenharmony_ci  // Returns true if the bytecode is Ldar or Star.
7661cb0ef41Sopenharmony_ci  static constexpr bool IsLdarOrStar(Bytecode bytecode) {
7671cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kLdar || IsAnyStar(bytecode);
7681cb0ef41Sopenharmony_ci  }
7691cb0ef41Sopenharmony_ci
7701cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a call or a constructor call.
7711cb0ef41Sopenharmony_ci  static constexpr bool IsCallOrConstruct(Bytecode bytecode) {
7721cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kCallAnyReceiver ||
7731cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallProperty ||
7741cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallProperty0 ||
7751cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallProperty1 ||
7761cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallProperty2 ||
7771cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallUndefinedReceiver ||
7781cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallUndefinedReceiver0 ||
7791cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallUndefinedReceiver1 ||
7801cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallUndefinedReceiver2 ||
7811cb0ef41Sopenharmony_ci           bytecode == Bytecode::kConstruct ||
7821cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallWithSpread ||
7831cb0ef41Sopenharmony_ci           bytecode == Bytecode::kConstructWithSpread ||
7841cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallJSRuntime;
7851cb0ef41Sopenharmony_ci  }
7861cb0ef41Sopenharmony_ci
7871cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a call to the runtime.
7881cb0ef41Sopenharmony_ci  static constexpr bool IsCallRuntime(Bytecode bytecode) {
7891cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kCallRuntime ||
7901cb0ef41Sopenharmony_ci           bytecode == Bytecode::kCallRuntimeForPair ||
7911cb0ef41Sopenharmony_ci           bytecode == Bytecode::kInvokeIntrinsic;
7921cb0ef41Sopenharmony_ci  }
7931cb0ef41Sopenharmony_ci
7941cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a scaling prefix bytecode.
7951cb0ef41Sopenharmony_ci  static constexpr bool IsPrefixScalingBytecode(Bytecode bytecode) {
7961cb0ef41Sopenharmony_ci    return bytecode == Bytecode::kExtraWide || bytecode == Bytecode::kWide ||
7971cb0ef41Sopenharmony_ci           bytecode == Bytecode::kDebugBreakExtraWide ||
7981cb0ef41Sopenharmony_ci           bytecode == Bytecode::kDebugBreakWide;
7991cb0ef41Sopenharmony_ci  }
8001cb0ef41Sopenharmony_ci
8011cb0ef41Sopenharmony_ci  // Returns true if the bytecode returns.
8021cb0ef41Sopenharmony_ci  static constexpr bool Returns(Bytecode bytecode) {
8031cb0ef41Sopenharmony_ci#define OR_BYTECODE(NAME) || bytecode == Bytecode::k##NAME
8041cb0ef41Sopenharmony_ci    return false RETURN_BYTECODE_LIST(OR_BYTECODE);
8051cb0ef41Sopenharmony_ci#undef OR_BYTECODE
8061cb0ef41Sopenharmony_ci  }
8071cb0ef41Sopenharmony_ci
8081cb0ef41Sopenharmony_ci  // Returns true if the bytecode unconditionally throws.
8091cb0ef41Sopenharmony_ci  static constexpr bool UnconditionallyThrows(Bytecode bytecode) {
8101cb0ef41Sopenharmony_ci#define OR_BYTECODE(NAME) || bytecode == Bytecode::k##NAME
8111cb0ef41Sopenharmony_ci    return false UNCONDITIONAL_THROW_BYTECODE_LIST(OR_BYTECODE);
8121cb0ef41Sopenharmony_ci#undef OR_BYTECODE
8131cb0ef41Sopenharmony_ci  }
8141cb0ef41Sopenharmony_ci
8151cb0ef41Sopenharmony_ci  // Returns the number of operands expected by |bytecode|.
8161cb0ef41Sopenharmony_ci  static int NumberOfOperands(Bytecode bytecode) {
8171cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8181cb0ef41Sopenharmony_ci    return kOperandCount[static_cast<size_t>(bytecode)];
8191cb0ef41Sopenharmony_ci  }
8201cb0ef41Sopenharmony_ci
8211cb0ef41Sopenharmony_ci  // Returns the i-th operand of |bytecode|.
8221cb0ef41Sopenharmony_ci  static OperandType GetOperandType(Bytecode bytecode, int i) {
8231cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8241cb0ef41Sopenharmony_ci    DCHECK_LT(i, NumberOfOperands(bytecode));
8251cb0ef41Sopenharmony_ci    DCHECK_GE(i, 0);
8261cb0ef41Sopenharmony_ci    return GetOperandTypes(bytecode)[i];
8271cb0ef41Sopenharmony_ci  }
8281cb0ef41Sopenharmony_ci
8291cb0ef41Sopenharmony_ci  // Returns a pointer to an array of operand types terminated in
8301cb0ef41Sopenharmony_ci  // OperandType::kNone.
8311cb0ef41Sopenharmony_ci  static const OperandType* GetOperandTypes(Bytecode bytecode) {
8321cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8331cb0ef41Sopenharmony_ci    return kOperandTypes[static_cast<size_t>(bytecode)];
8341cb0ef41Sopenharmony_ci  }
8351cb0ef41Sopenharmony_ci
8361cb0ef41Sopenharmony_ci  static bool OperandIsScalableSignedByte(Bytecode bytecode,
8371cb0ef41Sopenharmony_ci                                          int operand_index) {
8381cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8391cb0ef41Sopenharmony_ci    return kOperandTypeInfos[static_cast<size_t>(bytecode)][operand_index] ==
8401cb0ef41Sopenharmony_ci           OperandTypeInfo::kScalableSignedByte;
8411cb0ef41Sopenharmony_ci  }
8421cb0ef41Sopenharmony_ci
8431cb0ef41Sopenharmony_ci  static bool OperandIsScalableUnsignedByte(Bytecode bytecode,
8441cb0ef41Sopenharmony_ci                                            int operand_index) {
8451cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8461cb0ef41Sopenharmony_ci    return kOperandTypeInfos[static_cast<size_t>(bytecode)][operand_index] ==
8471cb0ef41Sopenharmony_ci           OperandTypeInfo::kScalableUnsignedByte;
8481cb0ef41Sopenharmony_ci  }
8491cb0ef41Sopenharmony_ci
8501cb0ef41Sopenharmony_ci  static bool OperandIsScalable(Bytecode bytecode, int operand_index) {
8511cb0ef41Sopenharmony_ci    return OperandIsScalableSignedByte(bytecode, operand_index) ||
8521cb0ef41Sopenharmony_ci           OperandIsScalableUnsignedByte(bytecode, operand_index);
8531cb0ef41Sopenharmony_ci  }
8541cb0ef41Sopenharmony_ci
8551cb0ef41Sopenharmony_ci  // Returns true if the bytecode has wider operand forms.
8561cb0ef41Sopenharmony_ci  static bool IsBytecodeWithScalableOperands(Bytecode bytecode);
8571cb0ef41Sopenharmony_ci
8581cb0ef41Sopenharmony_ci  // Returns the size of the i-th operand of |bytecode|.
8591cb0ef41Sopenharmony_ci  static OperandSize GetOperandSize(Bytecode bytecode, int i,
8601cb0ef41Sopenharmony_ci                                    OperandScale operand_scale) {
8611cb0ef41Sopenharmony_ci    CHECK_LT(i, NumberOfOperands(bytecode));
8621cb0ef41Sopenharmony_ci    return GetOperandSizes(bytecode, operand_scale)[i];
8631cb0ef41Sopenharmony_ci  }
8641cb0ef41Sopenharmony_ci
8651cb0ef41Sopenharmony_ci  // Returns the operand sizes of |bytecode| with scale |operand_scale|.
8661cb0ef41Sopenharmony_ci  static const OperandSize* GetOperandSizes(Bytecode bytecode,
8671cb0ef41Sopenharmony_ci                                            OperandScale operand_scale) {
8681cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8691cb0ef41Sopenharmony_ci    DCHECK_GE(operand_scale, OperandScale::kSingle);
8701cb0ef41Sopenharmony_ci    DCHECK_LE(operand_scale, OperandScale::kLast);
8711cb0ef41Sopenharmony_ci    STATIC_ASSERT(static_cast<int>(OperandScale::kQuadruple) == 4 &&
8721cb0ef41Sopenharmony_ci                  OperandScale::kLast == OperandScale::kQuadruple);
8731cb0ef41Sopenharmony_ci    int scale_index = static_cast<int>(operand_scale) >> 1;
8741cb0ef41Sopenharmony_ci    return kOperandSizes[scale_index][static_cast<size_t>(bytecode)];
8751cb0ef41Sopenharmony_ci  }
8761cb0ef41Sopenharmony_ci
8771cb0ef41Sopenharmony_ci  // Returns the offset of the i-th operand of |bytecode| relative to the start
8781cb0ef41Sopenharmony_ci  // of the bytecode.
8791cb0ef41Sopenharmony_ci  static int GetOperandOffset(Bytecode bytecode, int i,
8801cb0ef41Sopenharmony_ci                              OperandScale operand_scale);
8811cb0ef41Sopenharmony_ci
8821cb0ef41Sopenharmony_ci  // Returns the size of the bytecode including its operands for the
8831cb0ef41Sopenharmony_ci  // given |operand_scale|.
8841cb0ef41Sopenharmony_ci  static int Size(Bytecode bytecode, OperandScale operand_scale) {
8851cb0ef41Sopenharmony_ci    DCHECK_LE(bytecode, Bytecode::kLast);
8861cb0ef41Sopenharmony_ci    STATIC_ASSERT(static_cast<int>(OperandScale::kQuadruple) == 4 &&
8871cb0ef41Sopenharmony_ci                  OperandScale::kLast == OperandScale::kQuadruple);
8881cb0ef41Sopenharmony_ci    int scale_index = static_cast<int>(operand_scale) >> 1;
8891cb0ef41Sopenharmony_ci    return kBytecodeSizes[scale_index][static_cast<size_t>(bytecode)];
8901cb0ef41Sopenharmony_ci  }
8911cb0ef41Sopenharmony_ci
8921cb0ef41Sopenharmony_ci  // Returns a debug break bytecode to replace |bytecode|.
8931cb0ef41Sopenharmony_ci  static Bytecode GetDebugBreak(Bytecode bytecode);
8941cb0ef41Sopenharmony_ci
8951cb0ef41Sopenharmony_ci  // Returns the equivalent jump bytecode without the accumulator coercion.
8961cb0ef41Sopenharmony_ci  static Bytecode GetJumpWithoutToBoolean(Bytecode bytecode);
8971cb0ef41Sopenharmony_ci
8981cb0ef41Sopenharmony_ci  // Returns true if there is a call in the most-frequently executed path
8991cb0ef41Sopenharmony_ci  // through the bytecode's handler.
9001cb0ef41Sopenharmony_ci  static bool MakesCallAlongCriticalPath(Bytecode bytecode);
9011cb0ef41Sopenharmony_ci
9021cb0ef41Sopenharmony_ci  // Returns the receiver mode of the given call bytecode.
9031cb0ef41Sopenharmony_ci  static ConvertReceiverMode GetReceiverMode(Bytecode bytecode) {
9041cb0ef41Sopenharmony_ci    DCHECK(IsCallOrConstruct(bytecode) ||
9051cb0ef41Sopenharmony_ci           bytecode == Bytecode::kInvokeIntrinsic);
9061cb0ef41Sopenharmony_ci    switch (bytecode) {
9071cb0ef41Sopenharmony_ci      case Bytecode::kCallProperty:
9081cb0ef41Sopenharmony_ci      case Bytecode::kCallProperty0:
9091cb0ef41Sopenharmony_ci      case Bytecode::kCallProperty1:
9101cb0ef41Sopenharmony_ci      case Bytecode::kCallProperty2:
9111cb0ef41Sopenharmony_ci        return ConvertReceiverMode::kNotNullOrUndefined;
9121cb0ef41Sopenharmony_ci      case Bytecode::kCallUndefinedReceiver:
9131cb0ef41Sopenharmony_ci      case Bytecode::kCallUndefinedReceiver0:
9141cb0ef41Sopenharmony_ci      case Bytecode::kCallUndefinedReceiver1:
9151cb0ef41Sopenharmony_ci      case Bytecode::kCallUndefinedReceiver2:
9161cb0ef41Sopenharmony_ci      case Bytecode::kCallJSRuntime:
9171cb0ef41Sopenharmony_ci        return ConvertReceiverMode::kNullOrUndefined;
9181cb0ef41Sopenharmony_ci      case Bytecode::kCallAnyReceiver:
9191cb0ef41Sopenharmony_ci      case Bytecode::kConstruct:
9201cb0ef41Sopenharmony_ci      case Bytecode::kCallWithSpread:
9211cb0ef41Sopenharmony_ci      case Bytecode::kConstructWithSpread:
9221cb0ef41Sopenharmony_ci      case Bytecode::kInvokeIntrinsic:
9231cb0ef41Sopenharmony_ci        return ConvertReceiverMode::kAny;
9241cb0ef41Sopenharmony_ci      default:
9251cb0ef41Sopenharmony_ci        UNREACHABLE();
9261cb0ef41Sopenharmony_ci    }
9271cb0ef41Sopenharmony_ci  }
9281cb0ef41Sopenharmony_ci
9291cb0ef41Sopenharmony_ci  // Returns true if the bytecode is a debug break.
9301cb0ef41Sopenharmony_ci  static bool IsDebugBreak(Bytecode bytecode);
9311cb0ef41Sopenharmony_ci
9321cb0ef41Sopenharmony_ci  // Returns true if |operand_type| is any type of register operand.
9331cb0ef41Sopenharmony_ci  static bool IsRegisterOperandType(OperandType operand_type);
9341cb0ef41Sopenharmony_ci
9351cb0ef41Sopenharmony_ci  // Returns true if |operand_type| represents a register used as an input.
9361cb0ef41Sopenharmony_ci  static bool IsRegisterInputOperandType(OperandType operand_type);
9371cb0ef41Sopenharmony_ci
9381cb0ef41Sopenharmony_ci  // Returns true if |operand_type| represents a register used as an output.
9391cb0ef41Sopenharmony_ci  static bool IsRegisterOutputOperandType(OperandType operand_type);
9401cb0ef41Sopenharmony_ci
9411cb0ef41Sopenharmony_ci  // Returns true if |operand_type| represents a register list operand.
9421cb0ef41Sopenharmony_ci  static bool IsRegisterListOperandType(OperandType operand_type);
9431cb0ef41Sopenharmony_ci
9441cb0ef41Sopenharmony_ci  // Returns true if the handler for |bytecode| should look ahead and inline a
9451cb0ef41Sopenharmony_ci  // dispatch to a Star bytecode.
9461cb0ef41Sopenharmony_ci  static bool IsStarLookahead(Bytecode bytecode, OperandScale operand_scale);
9471cb0ef41Sopenharmony_ci
9481cb0ef41Sopenharmony_ci  // Returns the number of registers represented by a register operand. For
9491cb0ef41Sopenharmony_ci  // instance, a RegPair represents two registers. Should not be called for
9501cb0ef41Sopenharmony_ci  // kRegList which has a variable number of registers based on the following
9511cb0ef41Sopenharmony_ci  // kRegCount operand.
9521cb0ef41Sopenharmony_ci  static int GetNumberOfRegistersRepresentedBy(OperandType operand_type) {
9531cb0ef41Sopenharmony_ci    switch (operand_type) {
9541cb0ef41Sopenharmony_ci      case OperandType::kReg:
9551cb0ef41Sopenharmony_ci      case OperandType::kRegOut:
9561cb0ef41Sopenharmony_ci        return 1;
9571cb0ef41Sopenharmony_ci      case OperandType::kRegPair:
9581cb0ef41Sopenharmony_ci      case OperandType::kRegOutPair:
9591cb0ef41Sopenharmony_ci        return 2;
9601cb0ef41Sopenharmony_ci      case OperandType::kRegOutTriple:
9611cb0ef41Sopenharmony_ci        return 3;
9621cb0ef41Sopenharmony_ci      case OperandType::kRegList:
9631cb0ef41Sopenharmony_ci      case OperandType::kRegOutList:
9641cb0ef41Sopenharmony_ci        UNREACHABLE();
9651cb0ef41Sopenharmony_ci      default:
9661cb0ef41Sopenharmony_ci        return 0;
9671cb0ef41Sopenharmony_ci    }
9681cb0ef41Sopenharmony_ci    UNREACHABLE();
9691cb0ef41Sopenharmony_ci  }
9701cb0ef41Sopenharmony_ci
9711cb0ef41Sopenharmony_ci  // Returns the size of |operand_type| for |operand_scale|.
9721cb0ef41Sopenharmony_ci  static OperandSize SizeOfOperand(OperandType operand_type,
9731cb0ef41Sopenharmony_ci                                   OperandScale operand_scale) {
9741cb0ef41Sopenharmony_ci    DCHECK_LE(operand_type, OperandType::kLast);
9751cb0ef41Sopenharmony_ci    DCHECK_GE(operand_scale, OperandScale::kSingle);
9761cb0ef41Sopenharmony_ci    DCHECK_LE(operand_scale, OperandScale::kLast);
9771cb0ef41Sopenharmony_ci    STATIC_ASSERT(static_cast<int>(OperandScale::kQuadruple) == 4 &&
9781cb0ef41Sopenharmony_ci                  OperandScale::kLast == OperandScale::kQuadruple);
9791cb0ef41Sopenharmony_ci    int scale_index = static_cast<int>(operand_scale) >> 1;
9801cb0ef41Sopenharmony_ci    return kOperandKindSizes[scale_index][static_cast<size_t>(operand_type)];
9811cb0ef41Sopenharmony_ci  }
9821cb0ef41Sopenharmony_ci
9831cb0ef41Sopenharmony_ci  // Returns true if |operand_type| is a runtime-id operand (kRuntimeId).
9841cb0ef41Sopenharmony_ci  static bool IsRuntimeIdOperandType(OperandType operand_type);
9851cb0ef41Sopenharmony_ci
9861cb0ef41Sopenharmony_ci  // Returns true if |operand_type| is unsigned, false if signed.
9871cb0ef41Sopenharmony_ci  static bool IsUnsignedOperandType(OperandType operand_type);
9881cb0ef41Sopenharmony_ci
9891cb0ef41Sopenharmony_ci  // Returns true if a handler is generated for a bytecode at a given
9901cb0ef41Sopenharmony_ci  // operand scale. All bytecodes have handlers at OperandScale::kSingle,
9911cb0ef41Sopenharmony_ci  // but only bytecodes with scalable operands have handlers with larger
9921cb0ef41Sopenharmony_ci  // OperandScale values.
9931cb0ef41Sopenharmony_ci  static bool BytecodeHasHandler(Bytecode bytecode, OperandScale operand_scale);
9941cb0ef41Sopenharmony_ci
9951cb0ef41Sopenharmony_ci  // Return the operand scale required to hold a signed operand with |value|.
9961cb0ef41Sopenharmony_ci  static OperandScale ScaleForSignedOperand(int32_t value) {
9971cb0ef41Sopenharmony_ci    if (value >= kMinInt8 && value <= kMaxInt8) {
9981cb0ef41Sopenharmony_ci      return OperandScale::kSingle;
9991cb0ef41Sopenharmony_ci    } else if (value >= kMinInt16 && value <= kMaxInt16) {
10001cb0ef41Sopenharmony_ci      return OperandScale::kDouble;
10011cb0ef41Sopenharmony_ci    } else {
10021cb0ef41Sopenharmony_ci      return OperandScale::kQuadruple;
10031cb0ef41Sopenharmony_ci    }
10041cb0ef41Sopenharmony_ci  }
10051cb0ef41Sopenharmony_ci
10061cb0ef41Sopenharmony_ci  // Return the operand scale required to hold an unsigned operand with |value|.
10071cb0ef41Sopenharmony_ci  static OperandScale ScaleForUnsignedOperand(uint32_t value) {
10081cb0ef41Sopenharmony_ci    if (value <= kMaxUInt8) {
10091cb0ef41Sopenharmony_ci      return OperandScale::kSingle;
10101cb0ef41Sopenharmony_ci    } else if (value <= kMaxUInt16) {
10111cb0ef41Sopenharmony_ci      return OperandScale::kDouble;
10121cb0ef41Sopenharmony_ci    } else {
10131cb0ef41Sopenharmony_ci      return OperandScale::kQuadruple;
10141cb0ef41Sopenharmony_ci    }
10151cb0ef41Sopenharmony_ci  }
10161cb0ef41Sopenharmony_ci
10171cb0ef41Sopenharmony_ci  // Return the operand size required to hold an unsigned operand with |value|.
10181cb0ef41Sopenharmony_ci  static OperandSize SizeForUnsignedOperand(uint32_t value) {
10191cb0ef41Sopenharmony_ci    if (value <= kMaxUInt8) {
10201cb0ef41Sopenharmony_ci      return OperandSize::kByte;
10211cb0ef41Sopenharmony_ci    } else if (value <= kMaxUInt16) {
10221cb0ef41Sopenharmony_ci      return OperandSize::kShort;
10231cb0ef41Sopenharmony_ci    } else {
10241cb0ef41Sopenharmony_ci      return OperandSize::kQuad;
10251cb0ef41Sopenharmony_ci    }
10261cb0ef41Sopenharmony_ci  }
10271cb0ef41Sopenharmony_ci
10281cb0ef41Sopenharmony_ci  static Address bytecode_size_table_address() {
10291cb0ef41Sopenharmony_ci    return reinterpret_cast<Address>(
10301cb0ef41Sopenharmony_ci        const_cast<uint8_t*>(&kBytecodeSizes[0][0]));
10311cb0ef41Sopenharmony_ci  }
10321cb0ef41Sopenharmony_ci
10331cb0ef41Sopenharmony_ci private:
10341cb0ef41Sopenharmony_ci  static const OperandType* const kOperandTypes[];
10351cb0ef41Sopenharmony_ci  static const OperandTypeInfo* const kOperandTypeInfos[];
10361cb0ef41Sopenharmony_ci  static const int kOperandCount[];
10371cb0ef41Sopenharmony_ci  static const int kNumberOfRegisterOperands[];
10381cb0ef41Sopenharmony_ci  static const ImplicitRegisterUse kImplicitRegisterUse[];
10391cb0ef41Sopenharmony_ci  static const bool kIsScalable[];
10401cb0ef41Sopenharmony_ci  static const uint8_t kBytecodeSizes[3][kBytecodeCount];
10411cb0ef41Sopenharmony_ci  static const OperandSize* const kOperandSizes[3][kBytecodeCount];
10421cb0ef41Sopenharmony_ci  static OperandSize const
10431cb0ef41Sopenharmony_ci      kOperandKindSizes[3][BytecodeOperands::kOperandTypeCount];
10441cb0ef41Sopenharmony_ci};
10451cb0ef41Sopenharmony_ci
10461cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
10471cb0ef41Sopenharmony_ci                                           const Bytecode& bytecode);
10481cb0ef41Sopenharmony_ci
10491cb0ef41Sopenharmony_ci}  // namespace interpreter
10501cb0ef41Sopenharmony_ci}  // namespace internal
10511cb0ef41Sopenharmony_ci}  // namespace v8
10521cb0ef41Sopenharmony_ci
10531cb0ef41Sopenharmony_ci#endif  // V8_INTERPRETER_BYTECODES_H_
1054