| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERPRETER_BYTECODES_H_ | 5 #ifndef V8_INTERPRETER_BYTECODES_H_ |
| 6 #define V8_INTERPRETER_BYTECODES_H_ | 6 #define V8_INTERPRETER_BYTECODES_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 // Clients of this interface shouldn't depend on lots of interpreter internals. | 10 // Clients of this interface shouldn't depend on lots of interpreter internals. |
| 11 // Do not include anything from src/interpreter here! | 11 // Do not include anything from src/interpreter here! |
| 12 #include "src/utils.h" | 12 #include "src/utils.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace interpreter { | 16 namespace interpreter { |
| 17 | 17 |
| 18 #define INVALID_OPERAND_TYPE_LIST(V) \ | 18 #define INVALID_OPERAND_TYPE_LIST(V) V(None, OperandTypeInfo::kNone) |
| 19 V(None, OperandSize::kNone) | |
| 20 | 19 |
| 21 #define REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ | 20 #define REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ |
| 22 /* Byte operands. */ \ | 21 V(MaybeReg, OperandTypeInfo::kScalableSignedByte) \ |
| 23 V(MaybeReg8, OperandSize::kByte) \ | 22 V(Reg, OperandTypeInfo::kScalableSignedByte) \ |
| 24 V(Reg8, OperandSize::kByte) \ | 23 V(RegPair, OperandTypeInfo::kScalableSignedByte) |
| 25 V(RegPair8, OperandSize::kByte) \ | |
| 26 /* Short operands. */ \ | |
| 27 V(MaybeReg16, OperandSize::kShort) \ | |
| 28 V(Reg16, OperandSize::kShort) \ | |
| 29 V(RegPair16, OperandSize::kShort) | |
| 30 | 24 |
| 31 #define REGISTER_OUTPUT_OPERAND_TYPE_LIST(V) \ | 25 #define REGISTER_OUTPUT_OPERAND_TYPE_LIST(V) \ |
| 32 /* Byte operands. */ \ | 26 V(RegOut, OperandTypeInfo::kScalableSignedByte) \ |
| 33 V(RegOut8, OperandSize::kByte) \ | 27 V(RegOutPair, OperandTypeInfo::kScalableSignedByte) \ |
| 34 V(RegOutPair8, OperandSize::kByte) \ | 28 V(RegOutTriple, OperandTypeInfo::kScalableSignedByte) |
| 35 V(RegOutTriple8, OperandSize::kByte) \ | |
| 36 /* Short operands. */ \ | |
| 37 V(RegOut16, OperandSize::kShort) \ | |
| 38 V(RegOutPair16, OperandSize::kShort) \ | |
| 39 V(RegOutTriple16, OperandSize::kShort) | |
| 40 | 29 |
| 41 #define SCALAR_OPERAND_TYPE_LIST(V) \ | 30 #define SCALAR_OPERAND_TYPE_LIST(V) \ |
| 42 /* Byte operands. */ \ | 31 V(Flag8, OperandTypeInfo::kFixedUnsignedByte) \ |
| 43 V(Idx8, OperandSize::kByte) \ | 32 V(Idx, OperandTypeInfo::kScalableUnsignedByte) \ |
| 44 V(Imm8, OperandSize::kByte) \ | 33 V(Imm, OperandTypeInfo::kScalableSignedByte) \ |
| 45 V(RegCount8, OperandSize::kByte) \ | 34 V(RegCount, OperandTypeInfo::kScalableUnsignedByte) \ |
| 46 /* Short operands. */ \ | 35 V(RuntimeId, OperandTypeInfo::kFixedUnsignedShort) |
| 47 V(Idx16, OperandSize::kShort) \ | |
| 48 V(RegCount16, OperandSize::kShort) | |
| 49 | 36 |
| 50 #define REGISTER_OPERAND_TYPE_LIST(V) \ | 37 #define REGISTER_OPERAND_TYPE_LIST(V) \ |
| 51 REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ | 38 REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ |
| 52 REGISTER_OUTPUT_OPERAND_TYPE_LIST(V) | 39 REGISTER_OUTPUT_OPERAND_TYPE_LIST(V) |
| 53 | 40 |
| 54 #define NON_REGISTER_OPERAND_TYPE_LIST(V) \ | 41 #define NON_REGISTER_OPERAND_TYPE_LIST(V) \ |
| 55 INVALID_OPERAND_TYPE_LIST(V) \ | 42 INVALID_OPERAND_TYPE_LIST(V) \ |
| 56 SCALAR_OPERAND_TYPE_LIST(V) | 43 SCALAR_OPERAND_TYPE_LIST(V) |
| 57 | 44 |
| 58 // The list of operand types used by bytecodes. | 45 // The list of operand types used by bytecodes. |
| 59 #define OPERAND_TYPE_LIST(V) \ | 46 #define OPERAND_TYPE_LIST(V) \ |
| 60 NON_REGISTER_OPERAND_TYPE_LIST(V) \ | 47 NON_REGISTER_OPERAND_TYPE_LIST(V) \ |
| 61 REGISTER_OPERAND_TYPE_LIST(V) | 48 REGISTER_OPERAND_TYPE_LIST(V) |
| 62 | 49 |
| 63 // Define one debug break bytecode for each operands size. | 50 // Define one debug break bytecode for each possible size of unscaled |
| 64 #define DEBUG_BREAK_BYTECODE_LIST(V) \ | 51 // bytecodes. |
| 65 V(DebugBreak0, OperandType::kNone) \ | 52 #define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ |
| 66 V(DebugBreak1, OperandType::kReg8) \ | 53 V(DebugBreak0, OperandType::kNone) \ |
| 67 V(DebugBreak2, OperandType::kReg16) \ | 54 V(DebugBreak1, OperandType::kReg) \ |
| 68 V(DebugBreak3, OperandType::kReg16, OperandType::kReg8) \ | 55 V(DebugBreak2, OperandType::kReg, OperandType::kReg) \ |
| 69 V(DebugBreak4, OperandType::kReg16, OperandType::kReg16) \ | 56 V(DebugBreak3, OperandType::kReg, OperandType::kReg, OperandType::kReg) \ |
| 70 V(DebugBreak5, OperandType::kReg16, OperandType::kReg16, OperandType::kReg8) \ | 57 V(DebugBreak4, OperandType::kReg, OperandType::kReg, OperandType::kReg, \ |
| 71 V(DebugBreak6, OperandType::kReg16, OperandType::kReg16, \ | 58 OperandType::kReg) \ |
| 72 OperandType::kReg16) \ | 59 V(DebugBreak5, OperandType::kRuntimeId, OperandType::kReg, \ |
| 73 V(DebugBreak7, OperandType::kReg16, OperandType::kReg16, \ | 60 OperandType::kReg) \ |
| 74 OperandType::kReg16, OperandType::kReg8) \ | 61 V(DebugBreak6, OperandType::kRuntimeId, OperandType::kReg, \ |
| 75 V(DebugBreak8, OperandType::kReg16, OperandType::kReg16, \ | 62 OperandType::kReg, OperandType::kReg) |
| 76 OperandType::kReg16, OperandType::kReg16) | 63 |
| 64 // Define one debug break for each widening prefix. |
| 65 #define DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) \ |
| 66 V(DebugBreakWide, OperandType::kNone) \ |
| 67 V(DebugBreakExtraWide, OperandType::kNone) |
| 68 |
| 69 #define DEBUG_BREAK_BYTECODE_LIST(V) \ |
| 70 DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ |
| 71 DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) |
| 77 | 72 |
| 78 // The list of bytecodes which are interpreted by the interpreter. | 73 // The list of bytecodes which are interpreted by the interpreter. |
| 79 #define BYTECODE_LIST(V) \ | 74 #define BYTECODE_LIST(V) \ |
| 80 \ | 75 /* Extended width operands */ \ |
| 81 /* Loading the accumulator */ \ | 76 V(Wide, OperandType::kNone) \ |
| 82 V(LdaZero, OperandType::kNone) \ | 77 V(ExtraWide, OperandType::kNone) \ |
| 83 V(LdaSmi8, OperandType::kImm8) \ | 78 \ |
| 84 V(LdaUndefined, OperandType::kNone) \ | 79 /* Loading the accumulator */ \ |
| 85 V(LdaNull, OperandType::kNone) \ | 80 V(LdaZero, OperandType::kNone) \ |
| 86 V(LdaTheHole, OperandType::kNone) \ | 81 V(LdaSmi, OperandType::kImm) \ |
| 87 V(LdaTrue, OperandType::kNone) \ | 82 V(LdaUndefined, OperandType::kNone) \ |
| 88 V(LdaFalse, OperandType::kNone) \ | 83 V(LdaNull, OperandType::kNone) \ |
| 89 V(LdaConstant, OperandType::kIdx8) \ | 84 V(LdaTheHole, OperandType::kNone) \ |
| 90 V(LdaConstantWide, OperandType::kIdx16) \ | 85 V(LdaTrue, OperandType::kNone) \ |
| 91 \ | 86 V(LdaFalse, OperandType::kNone) \ |
| 92 /* Globals */ \ | 87 V(LdaConstant, OperandType::kIdx) \ |
| 93 V(LdaGlobal, OperandType::kIdx8, OperandType::kIdx8) \ | 88 \ |
| 94 V(LdaGlobalInsideTypeof, OperandType::kIdx8, OperandType::kIdx8) \ | 89 /* Globals */ \ |
| 95 V(LdaGlobalWide, OperandType::kIdx16, OperandType::kIdx16) \ | 90 V(LdaGlobal, OperandType::kIdx, OperandType::kIdx) \ |
| 96 V(LdaGlobalInsideTypeofWide, OperandType::kIdx16, OperandType::kIdx16) \ | 91 V(LdaGlobalInsideTypeof, OperandType::kIdx, OperandType::kIdx) \ |
| 97 V(StaGlobalSloppy, OperandType::kIdx8, OperandType::kIdx8) \ | 92 V(StaGlobalSloppy, OperandType::kIdx, OperandType::kIdx) \ |
| 98 V(StaGlobalStrict, OperandType::kIdx8, OperandType::kIdx8) \ | 93 V(StaGlobalStrict, OperandType::kIdx, OperandType::kIdx) \ |
| 99 V(StaGlobalSloppyWide, OperandType::kIdx16, OperandType::kIdx16) \ | 94 \ |
| 100 V(StaGlobalStrictWide, OperandType::kIdx16, OperandType::kIdx16) \ | 95 /* Context operations */ \ |
| 101 \ | 96 V(PushContext, OperandType::kReg) \ |
| 102 /* Context operations */ \ | 97 V(PopContext, OperandType::kReg) \ |
| 103 V(PushContext, OperandType::kReg8) \ | 98 V(LdaContextSlot, OperandType::kReg, OperandType::kIdx) \ |
| 104 V(PopContext, OperandType::kReg8) \ | 99 V(StaContextSlot, OperandType::kReg, OperandType::kIdx) \ |
| 105 V(LdaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ | 100 \ |
| 106 V(StaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ | 101 /* Load-Store lookup slots */ \ |
| 107 V(LdaContextSlotWide, OperandType::kReg8, OperandType::kIdx16) \ | 102 V(LdaLookupSlot, OperandType::kIdx) \ |
| 108 V(StaContextSlotWide, OperandType::kReg8, OperandType::kIdx16) \ | 103 V(LdaLookupSlotInsideTypeof, OperandType::kIdx) \ |
| 109 \ | 104 V(StaLookupSlotSloppy, OperandType::kIdx) \ |
| 110 /* Load-Store lookup slots */ \ | 105 V(StaLookupSlotStrict, OperandType::kIdx) \ |
| 111 V(LdaLookupSlot, OperandType::kIdx8) \ | 106 \ |
| 112 V(LdaLookupSlotInsideTypeof, OperandType::kIdx8) \ | 107 /* Register-accumulator transfers */ \ |
| 113 V(LdaLookupSlotWide, OperandType::kIdx16) \ | 108 V(Ldar, OperandType::kReg) \ |
| 114 V(LdaLookupSlotInsideTypeofWide, OperandType::kIdx16) \ | 109 V(Star, OperandType::kRegOut) \ |
| 115 V(StaLookupSlotSloppy, OperandType::kIdx8) \ | 110 \ |
| 116 V(StaLookupSlotStrict, OperandType::kIdx8) \ | 111 /* Register-register transfers */ \ |
| 117 V(StaLookupSlotSloppyWide, OperandType::kIdx16) \ | 112 V(Mov, OperandType::kReg, OperandType::kRegOut) \ |
| 118 V(StaLookupSlotStrictWide, OperandType::kIdx16) \ | 113 \ |
| 119 \ | 114 /* LoadIC operations */ \ |
| 120 /* Register-accumulator transfers */ \ | 115 V(LoadIC, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ |
| 121 V(Ldar, OperandType::kReg8) \ | 116 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ |
| 122 V(Star, OperandType::kRegOut8) \ | 117 \ |
| 123 \ | 118 /* StoreIC operations */ \ |
| 124 /* Register-register transfers */ \ | 119 V(StoreICSloppy, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ |
| 125 V(Mov, OperandType::kReg8, OperandType::kRegOut8) \ | 120 V(StoreICStrict, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ |
| 126 V(MovWide, OperandType::kReg16, OperandType::kRegOut16) \ | 121 V(KeyedStoreICSloppy, OperandType::kReg, OperandType::kReg, \ |
| 127 \ | 122 OperandType::kIdx) \ |
| 128 /* LoadIC operations */ \ | 123 V(KeyedStoreICStrict, OperandType::kReg, OperandType::kReg, \ |
| 129 V(LoadIC, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ | 124 OperandType::kIdx) \ |
| 130 V(KeyedLoadIC, OperandType::kReg8, OperandType::kIdx8) \ | 125 \ |
| 131 V(LoadICWide, OperandType::kReg8, OperandType::kIdx16, OperandType::kIdx16) \ | 126 /* Binary Operators */ \ |
| 132 V(KeyedLoadICWide, OperandType::kReg8, OperandType::kIdx16) \ | 127 V(Add, OperandType::kReg) \ |
| 133 \ | 128 V(Sub, OperandType::kReg) \ |
| 134 /* StoreIC operations */ \ | 129 V(Mul, OperandType::kReg) \ |
| 135 V(StoreICSloppy, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ | 130 V(Div, OperandType::kReg) \ |
| 136 V(StoreICStrict, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ | 131 V(Mod, OperandType::kReg) \ |
| 137 V(KeyedStoreICSloppy, OperandType::kReg8, OperandType::kReg8, \ | 132 V(BitwiseOr, OperandType::kReg) \ |
| 138 OperandType::kIdx8) \ | 133 V(BitwiseXor, OperandType::kReg) \ |
| 139 V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \ | 134 V(BitwiseAnd, OperandType::kReg) \ |
| 140 OperandType::kIdx8) \ | 135 V(ShiftLeft, OperandType::kReg) \ |
| 141 V(StoreICSloppyWide, OperandType::kReg8, OperandType::kIdx16, \ | 136 V(ShiftRight, OperandType::kReg) \ |
| 142 OperandType::kIdx16) \ | 137 V(ShiftRightLogical, OperandType::kReg) \ |
| 143 V(StoreICStrictWide, OperandType::kReg8, OperandType::kIdx16, \ | 138 \ |
| 144 OperandType::kIdx16) \ | 139 /* Unary Operators */ \ |
| 145 V(KeyedStoreICSloppyWide, OperandType::kReg8, OperandType::kReg8, \ | 140 V(Inc, OperandType::kNone) \ |
| 146 OperandType::kIdx16) \ | 141 V(Dec, OperandType::kNone) \ |
| 147 V(KeyedStoreICStrictWide, OperandType::kReg8, OperandType::kReg8, \ | 142 V(LogicalNot, OperandType::kNone) \ |
| 148 OperandType::kIdx16) \ | 143 V(TypeOf, OperandType::kNone) \ |
| 149 \ | 144 V(DeletePropertyStrict, OperandType::kReg) \ |
| 150 /* Binary Operators */ \ | 145 V(DeletePropertySloppy, OperandType::kReg) \ |
| 151 V(Add, OperandType::kReg8) \ | 146 \ |
| 152 V(Sub, OperandType::kReg8) \ | 147 /* Call operations */ \ |
| 153 V(Mul, OperandType::kReg8) \ | 148 V(Call, OperandType::kReg, OperandType::kReg, OperandType::kRegCount, \ |
| 154 V(Div, OperandType::kReg8) \ | 149 OperandType::kIdx) \ |
| 155 V(Mod, OperandType::kReg8) \ | 150 V(TailCall, OperandType::kReg, OperandType::kReg, OperandType::kRegCount, \ |
| 156 V(BitwiseOr, OperandType::kReg8) \ | 151 OperandType::kIdx) \ |
| 157 V(BitwiseXor, OperandType::kReg8) \ | 152 V(CallRuntime, OperandType::kRuntimeId, OperandType::kMaybeReg, \ |
| 158 V(BitwiseAnd, OperandType::kReg8) \ | 153 OperandType::kRegCount) \ |
| 159 V(ShiftLeft, OperandType::kReg8) \ | 154 V(CallRuntimeForPair, OperandType::kRuntimeId, OperandType::kMaybeReg, \ |
| 160 V(ShiftRight, OperandType::kReg8) \ | 155 OperandType::kRegCount, OperandType::kRegOutPair) \ |
| 161 V(ShiftRightLogical, OperandType::kReg8) \ | 156 V(CallJSRuntime, OperandType::kIdx, OperandType::kReg, \ |
| 162 \ | 157 OperandType::kRegCount) \ |
| 163 /* Unary Operators */ \ | 158 \ |
| 164 V(Inc, OperandType::kNone) \ | 159 /* New operator */ \ |
| 165 V(Dec, OperandType::kNone) \ | 160 V(New, OperandType::kReg, OperandType::kMaybeReg, OperandType::kRegCount) \ |
| 166 V(LogicalNot, OperandType::kNone) \ | 161 \ |
| 167 V(TypeOf, OperandType::kNone) \ | 162 /* Test Operators */ \ |
| 168 V(DeletePropertyStrict, OperandType::kReg8) \ | 163 V(TestEqual, OperandType::kReg) \ |
| 169 V(DeletePropertySloppy, OperandType::kReg8) \ | 164 V(TestNotEqual, OperandType::kReg) \ |
| 170 \ | 165 V(TestEqualStrict, OperandType::kReg) \ |
| 171 /* Call operations */ \ | 166 V(TestLessThan, OperandType::kReg) \ |
| 172 V(Call, OperandType::kReg8, OperandType::kReg8, OperandType::kRegCount8, \ | 167 V(TestGreaterThan, OperandType::kReg) \ |
| 173 OperandType::kIdx8) \ | 168 V(TestLessThanOrEqual, OperandType::kReg) \ |
| 174 V(CallWide, OperandType::kReg16, OperandType::kReg16, \ | 169 V(TestGreaterThanOrEqual, OperandType::kReg) \ |
| 175 OperandType::kRegCount16, OperandType::kIdx16) \ | 170 V(TestInstanceOf, OperandType::kReg) \ |
| 176 V(TailCall, OperandType::kReg8, OperandType::kReg8, OperandType::kRegCount8, \ | 171 V(TestIn, OperandType::kReg) \ |
| 177 OperandType::kIdx8) \ | 172 \ |
| 178 V(TailCallWide, OperandType::kReg16, OperandType::kReg16, \ | 173 /* Cast operators */ \ |
| 179 OperandType::kRegCount16, OperandType::kIdx16) \ | 174 V(ToName, OperandType::kNone) \ |
| 180 V(CallRuntime, OperandType::kIdx16, OperandType::kMaybeReg8, \ | 175 V(ToNumber, OperandType::kNone) \ |
| 181 OperandType::kRegCount8) \ | 176 V(ToObject, OperandType::kNone) \ |
| 182 V(CallRuntimeWide, OperandType::kIdx16, OperandType::kMaybeReg16, \ | 177 \ |
| 183 OperandType::kRegCount8) \ | 178 /* Literals */ \ |
| 184 V(CallRuntimeForPair, OperandType::kIdx16, OperandType::kMaybeReg8, \ | 179 V(CreateRegExpLiteral, OperandType::kIdx, OperandType::kIdx, \ |
| 185 OperandType::kRegCount8, OperandType::kRegOutPair8) \ | 180 OperandType::kFlag8) \ |
| 186 V(CallRuntimeForPairWide, OperandType::kIdx16, OperandType::kMaybeReg16, \ | 181 V(CreateArrayLiteral, OperandType::kIdx, OperandType::kIdx, \ |
| 187 OperandType::kRegCount8, OperandType::kRegOutPair16) \ | 182 OperandType::kFlag8) \ |
| 188 V(CallJSRuntime, OperandType::kIdx16, OperandType::kReg8, \ | 183 V(CreateObjectLiteral, OperandType::kIdx, OperandType::kIdx, \ |
| 189 OperandType::kRegCount8) \ | 184 OperandType::kFlag8) \ |
| 190 V(CallJSRuntimeWide, OperandType::kIdx16, OperandType::kReg16, \ | 185 \ |
| 191 OperandType::kRegCount16) \ | 186 /* Closure allocation */ \ |
| 192 \ | 187 V(CreateClosure, OperandType::kIdx, OperandType::kFlag8) \ |
| 193 /* New operator */ \ | 188 \ |
| 194 V(New, OperandType::kReg8, OperandType::kMaybeReg8, OperandType::kRegCount8) \ | 189 /* Arguments allocation */ \ |
| 195 V(NewWide, OperandType::kReg16, OperandType::kMaybeReg16, \ | 190 V(CreateMappedArguments, OperandType::kNone) \ |
| 196 OperandType::kRegCount16) \ | 191 V(CreateUnmappedArguments, OperandType::kNone) \ |
| 197 \ | 192 V(CreateRestParameter, OperandType::kNone) \ |
| 198 /* Test Operators */ \ | 193 \ |
| 199 V(TestEqual, OperandType::kReg8) \ | 194 /* Control Flow */ \ |
| 200 V(TestNotEqual, OperandType::kReg8) \ | 195 V(Jump, OperandType::kImm) \ |
| 201 V(TestEqualStrict, OperandType::kReg8) \ | 196 V(JumpConstant, OperandType::kIdx) \ |
| 202 V(TestLessThan, OperandType::kReg8) \ | 197 V(JumpIfTrue, OperandType::kImm) \ |
| 203 V(TestGreaterThan, OperandType::kReg8) \ | 198 V(JumpIfTrueConstant, OperandType::kIdx) \ |
| 204 V(TestLessThanOrEqual, OperandType::kReg8) \ | 199 V(JumpIfFalse, OperandType::kImm) \ |
| 205 V(TestGreaterThanOrEqual, OperandType::kReg8) \ | 200 V(JumpIfFalseConstant, OperandType::kIdx) \ |
| 206 V(TestInstanceOf, OperandType::kReg8) \ | 201 V(JumpIfToBooleanTrue, OperandType::kImm) \ |
| 207 V(TestIn, OperandType::kReg8) \ | 202 V(JumpIfToBooleanTrueConstant, OperandType::kIdx) \ |
| 208 \ | 203 V(JumpIfToBooleanFalse, OperandType::kImm) \ |
| 209 /* Cast operators */ \ | 204 V(JumpIfToBooleanFalseConstant, OperandType::kIdx) \ |
| 210 V(ToName, OperandType::kNone) \ | 205 V(JumpIfNull, OperandType::kImm) \ |
| 211 V(ToNumber, OperandType::kNone) \ | 206 V(JumpIfNullConstant, OperandType::kIdx) \ |
| 212 V(ToObject, OperandType::kNone) \ | 207 V(JumpIfUndefined, OperandType::kImm) \ |
| 213 \ | 208 V(JumpIfUndefinedConstant, OperandType::kIdx) \ |
| 214 /* Literals */ \ | 209 V(JumpIfNotHole, OperandType::kImm) \ |
| 215 V(CreateRegExpLiteral, OperandType::kIdx8, OperandType::kIdx8, \ | 210 V(JumpIfNotHoleConstant, OperandType::kIdx) \ |
| 216 OperandType::kImm8) \ | 211 \ |
| 217 V(CreateArrayLiteral, OperandType::kIdx8, OperandType::kIdx8, \ | 212 /* Complex flow control For..in */ \ |
| 218 OperandType::kImm8) \ | 213 V(ForInPrepare, OperandType::kRegOutTriple) \ |
| 219 V(CreateObjectLiteral, OperandType::kIdx8, OperandType::kIdx8, \ | 214 V(ForInDone, OperandType::kReg, OperandType::kReg) \ |
| 220 OperandType::kImm8) \ | 215 V(ForInNext, OperandType::kReg, OperandType::kReg, OperandType::kRegPair, \ |
| 221 V(CreateRegExpLiteralWide, OperandType::kIdx16, OperandType::kIdx16, \ | 216 OperandType::kIdx) \ |
| 222 OperandType::kImm8) \ | 217 V(ForInStep, OperandType::kReg) \ |
| 223 V(CreateArrayLiteralWide, OperandType::kIdx16, OperandType::kIdx16, \ | 218 \ |
| 224 OperandType::kImm8) \ | 219 /* Perform a stack guard check */ \ |
| 225 V(CreateObjectLiteralWide, OperandType::kIdx16, OperandType::kIdx16, \ | 220 V(StackCheck, OperandType::kNone) \ |
| 226 OperandType::kImm8) \ | 221 \ |
| 227 \ | 222 /* Non-local flow control */ \ |
| 228 /* Closure allocation */ \ | 223 V(Throw, OperandType::kNone) \ |
| 229 V(CreateClosure, OperandType::kIdx8, OperandType::kImm8) \ | 224 V(ReThrow, OperandType::kNone) \ |
| 230 V(CreateClosureWide, OperandType::kIdx16, OperandType::kImm8) \ | 225 V(Return, OperandType::kNone) \ |
| 231 \ | 226 \ |
| 232 /* Arguments allocation */ \ | 227 /* Debugger */ \ |
| 233 V(CreateMappedArguments, OperandType::kNone) \ | 228 V(Debugger, OperandType::kNone) \ |
| 234 V(CreateUnmappedArguments, OperandType::kNone) \ | 229 DEBUG_BREAK_BYTECODE_LIST(V) \ |
| 235 V(CreateRestParameter, OperandType::kNone) \ | 230 \ |
| 236 \ | 231 /* Illegal bytecode (terminates execution) */ \ |
| 237 /* Control Flow */ \ | 232 V(Illegal, OperandType::kNone) |
| 238 V(Jump, OperandType::kImm8) \ | 233 |
| 239 V(JumpConstant, OperandType::kIdx8) \ | 234 // Enumeration of scaling factors applicable to scalable operands. Code |
| 240 V(JumpConstantWide, OperandType::kIdx16) \ | 235 // relies on being able to cast values to integer scaling values. |
| 241 V(JumpIfTrue, OperandType::kImm8) \ | 236 enum class OperandScale : uint8_t { |
| 242 V(JumpIfTrueConstant, OperandType::kIdx8) \ | 237 kSingle = 1, |
| 243 V(JumpIfTrueConstantWide, OperandType::kIdx16) \ | 238 kDouble = 2, |
| 244 V(JumpIfFalse, OperandType::kImm8) \ | 239 kQuadruple = 4, |
| 245 V(JumpIfFalseConstant, OperandType::kIdx8) \ | 240 kMaxValid = kQuadruple, |
| 246 V(JumpIfFalseConstantWide, OperandType::kIdx16) \ | 241 kInvalid = 8, |
| 247 V(JumpIfToBooleanTrue, OperandType::kImm8) \ | 242 }; |
| 248 V(JumpIfToBooleanTrueConstant, OperandType::kIdx8) \ | 243 |
| 249 V(JumpIfToBooleanTrueConstantWide, OperandType::kIdx16) \ | 244 // Enumeration of the size classes of operand types used by |
| 250 V(JumpIfToBooleanFalse, OperandType::kImm8) \ | 245 // bytecodes. Code relies on being able to cast values to integer |
| 251 V(JumpIfToBooleanFalseConstant, OperandType::kIdx8) \ | 246 // types to get the size in bytes. |
| 252 V(JumpIfToBooleanFalseConstantWide, OperandType::kIdx16) \ | |
| 253 V(JumpIfNull, OperandType::kImm8) \ | |
| 254 V(JumpIfNullConstant, OperandType::kIdx8) \ | |
| 255 V(JumpIfNullConstantWide, OperandType::kIdx16) \ | |
| 256 V(JumpIfUndefined, OperandType::kImm8) \ | |
| 257 V(JumpIfUndefinedConstant, OperandType::kIdx8) \ | |
| 258 V(JumpIfUndefinedConstantWide, OperandType::kIdx16) \ | |
| 259 V(JumpIfNotHole, OperandType::kImm8) \ | |
| 260 V(JumpIfNotHoleConstant, OperandType::kIdx8) \ | |
| 261 V(JumpIfNotHoleConstantWide, OperandType::kIdx16) \ | |
| 262 \ | |
| 263 /* Complex flow control For..in */ \ | |
| 264 V(ForInPrepare, OperandType::kRegOutTriple8) \ | |
| 265 V(ForInPrepareWide, OperandType::kRegOutTriple16) \ | |
| 266 V(ForInDone, OperandType::kReg8, OperandType::kReg8) \ | |
| 267 V(ForInNext, OperandType::kReg8, OperandType::kReg8, OperandType::kRegPair8, \ | |
| 268 OperandType::kIdx8) \ | |
| 269 V(ForInNextWide, OperandType::kReg16, OperandType::kReg16, \ | |
| 270 OperandType::kRegPair16, OperandType::kIdx16) \ | |
| 271 V(ForInStep, OperandType::kReg8) \ | |
| 272 \ | |
| 273 /* Perform a stack guard check */ \ | |
| 274 V(StackCheck, OperandType::kNone) \ | |
| 275 \ | |
| 276 /* Non-local flow control */ \ | |
| 277 V(Throw, OperandType::kNone) \ | |
| 278 V(ReThrow, OperandType::kNone) \ | |
| 279 V(Return, OperandType::kNone) \ | |
| 280 \ | |
| 281 /* Debugger */ \ | |
| 282 V(Debugger, OperandType::kNone) \ | |
| 283 DEBUG_BREAK_BYTECODE_LIST(V) | |
| 284 | |
| 285 // Enumeration of the size classes of operand types used by bytecodes. | |
| 286 enum class OperandSize : uint8_t { | 247 enum class OperandSize : uint8_t { |
| 287 kNone = 0, | 248 kNone = 0, |
| 288 kByte = 1, | 249 kByte = 1, |
| 289 kShort = 2, | 250 kShort = 2, |
| 251 kQuad = 4, |
| 252 kLast = kQuad |
| 290 }; | 253 }; |
| 291 | 254 |
| 255 // Primitive operand info used that summarize properties of operands. |
| 256 // Columns are Name, IsScalable, IsUnsigned, UnscaledSize. |
| 257 #define OPERAND_TYPE_INFO_LIST(V) \ |
| 258 V(None, false, false, OperandSize::kNone) \ |
| 259 V(ScalableSignedByte, true, false, OperandSize::kByte) \ |
| 260 V(ScalableUnsignedByte, true, true, OperandSize::kByte) \ |
| 261 V(FixedUnsignedByte, false, true, OperandSize::kByte) \ |
| 262 V(FixedUnsignedShort, false, true, OperandSize::kShort) |
| 263 |
| 264 enum class OperandTypeInfo : uint8_t { |
| 265 #define DECLARE_OPERAND_TYPE_INFO(Name, ...) k##Name, |
| 266 OPERAND_TYPE_INFO_LIST(DECLARE_OPERAND_TYPE_INFO) |
| 267 #undef DECLARE_OPERAND_TYPE_INFO |
| 268 }; |
| 292 | 269 |
| 293 // Enumeration of operand types used by bytecodes. | 270 // Enumeration of operand types used by bytecodes. |
| 294 enum class OperandType : uint8_t { | 271 enum class OperandType : uint8_t { |
| 295 #define DECLARE_OPERAND_TYPE(Name, _) k##Name, | 272 #define DECLARE_OPERAND_TYPE(Name, _) k##Name, |
| 296 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) | 273 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) |
| 297 #undef DECLARE_OPERAND_TYPE | 274 #undef DECLARE_OPERAND_TYPE |
| 298 #define COUNT_OPERAND_TYPES(x, _) +1 | 275 #define COUNT_OPERAND_TYPES(x, _) +1 |
| 299 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will | 276 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will |
| 300 // evaluate to the same value as the last operand. | 277 // evaluate to the same value as the last operand. |
| 301 kLast = -1 OPERAND_TYPE_LIST(COUNT_OPERAND_TYPES) | 278 kLast = -1 OPERAND_TYPE_LIST(COUNT_OPERAND_TYPES) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 323 explicit Register(int index = kInvalidIndex) : index_(index) {} | 300 explicit Register(int index = kInvalidIndex) : index_(index) {} |
| 324 | 301 |
| 325 int index() const { return index_; } | 302 int index() const { return index_; } |
| 326 bool is_parameter() const { return index() < 0; } | 303 bool is_parameter() const { return index() < 0; } |
| 327 bool is_valid() const { return index_ != kInvalidIndex; } | 304 bool is_valid() const { return index_ != kInvalidIndex; } |
| 328 bool is_byte_operand() const; | 305 bool is_byte_operand() const; |
| 329 bool is_short_operand() const; | 306 bool is_short_operand() const; |
| 330 | 307 |
| 331 static Register FromParameterIndex(int index, int parameter_count); | 308 static Register FromParameterIndex(int index, int parameter_count); |
| 332 int ToParameterIndex(int parameter_count) const; | 309 int ToParameterIndex(int parameter_count) const; |
| 333 static int MaxParameterIndex(); | |
| 334 static int MaxRegisterIndex(); | |
| 335 static int MaxRegisterIndexForByteOperand(); | |
| 336 | 310 |
| 337 // Returns an invalid register. | 311 // Returns an invalid register. |
| 338 static Register invalid_value() { return Register(); } | 312 static Register invalid_value() { return Register(); } |
| 339 | 313 |
| 340 // Returns the register for the function's closure object. | 314 // Returns the register for the function's closure object. |
| 341 static Register function_closure(); | 315 static Register function_closure(); |
| 342 bool is_function_closure() const; | 316 bool is_function_closure() const; |
| 343 | 317 |
| 344 // Returns the register which holds the current context object. | 318 // Returns the register which holds the current context object. |
| 345 static Register current_context(); | 319 static Register current_context(); |
| 346 bool is_current_context() const; | 320 bool is_current_context() const; |
| 347 | 321 |
| 348 // Returns the register for the incoming new target value. | 322 // Returns the register for the incoming new target value. |
| 349 static Register new_target(); | 323 static Register new_target(); |
| 350 bool is_new_target() const; | 324 bool is_new_target() const; |
| 351 | 325 |
| 352 static Register FromOperand(uint8_t operand); | 326 int32_t ToOperand() const { return -index_; } |
| 353 uint8_t ToOperand() const; | 327 static Register FromOperand(int32_t operand) { return Register(-operand); } |
| 354 | |
| 355 static Register FromWideOperand(uint16_t operand); | |
| 356 uint16_t ToWideOperand() const; | |
| 357 | |
| 358 static Register FromRawOperand(uint32_t raw_operand); | |
| 359 uint32_t ToRawOperand() const; | |
| 360 | 328 |
| 361 static bool AreContiguous(Register reg1, Register reg2, | 329 static bool AreContiguous(Register reg1, Register reg2, |
| 362 Register reg3 = Register(), | 330 Register reg3 = Register(), |
| 363 Register reg4 = Register(), | 331 Register reg4 = Register(), |
| 364 Register reg5 = Register()); | 332 Register reg5 = Register()); |
| 365 | 333 |
| 366 std::string ToString(int parameter_count); | 334 std::string ToString(int parameter_count); |
| 367 | 335 |
| 368 bool operator==(const Register& other) const { | 336 bool operator==(const Register& other) const { |
| 369 return index() == other.index(); | 337 return index() == other.index(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 392 | 360 |
| 393 int index_; | 361 int index_; |
| 394 }; | 362 }; |
| 395 | 363 |
| 396 | 364 |
| 397 class Bytecodes { | 365 class Bytecodes { |
| 398 public: | 366 public: |
| 399 // Returns string representation of |bytecode|. | 367 // Returns string representation of |bytecode|. |
| 400 static const char* ToString(Bytecode bytecode); | 368 static const char* ToString(Bytecode bytecode); |
| 401 | 369 |
| 370 // Returns string representation of |bytecode|. |
| 371 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); |
| 372 |
| 402 // Returns string representation of |operand_type|. | 373 // Returns string representation of |operand_type|. |
| 403 static const char* OperandTypeToString(OperandType operand_type); | 374 static const char* OperandTypeToString(OperandType operand_type); |
| 404 | 375 |
| 376 // Returns string representation of |operand_scale|. |
| 377 static const char* OperandScaleToString(OperandScale operand_scale); |
| 378 |
| 405 // Returns string representation of |operand_size|. | 379 // Returns string representation of |operand_size|. |
| 406 static const char* OperandSizeToString(OperandSize operand_size); | 380 static const char* OperandSizeToString(OperandSize operand_size); |
| 407 | 381 |
| 408 // Returns byte value of bytecode. | 382 // Returns byte value of bytecode. |
| 409 static uint8_t ToByte(Bytecode bytecode); | 383 static uint8_t ToByte(Bytecode bytecode); |
| 410 | 384 |
| 411 // Returns bytecode for |value|. | 385 // Returns bytecode for |value|. |
| 412 static Bytecode FromByte(uint8_t value); | 386 static Bytecode FromByte(uint8_t value); |
| 413 | 387 |
| 414 // Returns the number of operands expected by |bytecode|. | 388 // Returns the number of operands expected by |bytecode|. |
| 415 static int NumberOfOperands(Bytecode bytecode); | 389 static int NumberOfOperands(Bytecode bytecode); |
| 416 | 390 |
| 417 // Returns the number of register operands expected by |bytecode|. | 391 // Returns the number of register operands expected by |bytecode|. |
| 418 static int NumberOfRegisterOperands(Bytecode bytecode); | 392 static int NumberOfRegisterOperands(Bytecode bytecode); |
| 419 | 393 |
| 394 // Returns the prefix bytecode representing an operand scale to be |
| 395 // applied to a a bytecode. |
| 396 static Bytecode OperandScaleToPrefixBytecode(OperandScale operand_scale); |
| 397 |
| 398 // Returns true if the operand scale requires a prefix bytecode. |
| 399 static bool OperandScaleRequiresPrefixBytecode(OperandScale operand_scale); |
| 400 |
| 401 // Returns the scaling applied to scalable operands if bytecode is |
| 402 // is a scaling prefix. |
| 403 static OperandScale PrefixBytecodeToOperandScale(Bytecode bytecode); |
| 404 |
| 420 // Returns the i-th operand of |bytecode|. | 405 // Returns the i-th operand of |bytecode|. |
| 421 static OperandType GetOperandType(Bytecode bytecode, int i); | 406 static OperandType GetOperandType(Bytecode bytecode, int i); |
| 422 | 407 |
| 423 // Returns the size of the i-th operand of |bytecode|. | 408 // Returns the size of the i-th operand of |bytecode|. |
| 424 static OperandSize GetOperandSize(Bytecode bytecode, int i); | 409 static OperandSize GetOperandSize(Bytecode bytecode, int i, |
| 410 OperandScale operand_scale); |
| 425 | 411 |
| 426 // Returns the offset of the i-th operand of |bytecode| relative to the start | 412 // Returns the offset of the i-th operand of |bytecode| relative to the start |
| 427 // of the bytecode. | 413 // of the bytecode. |
| 428 static int GetOperandOffset(Bytecode bytecode, int i); | 414 static int GetOperandOffset(Bytecode bytecode, int i, |
| 415 OperandScale operand_scale); |
| 429 | 416 |
| 430 // Returns a zero-based bitmap of the register operand positions of | 417 // Returns a zero-based bitmap of the register operand positions of |
| 431 // |bytecode|. | 418 // |bytecode|. |
| 432 static int GetRegisterOperandBitmap(Bytecode bytecode); | 419 static int GetRegisterOperandBitmap(Bytecode bytecode); |
| 433 | 420 |
| 434 // Returns a debug break bytecode with a matching operand size. | 421 // Returns a debug break bytecode to replace |bytecode|. |
| 435 static Bytecode GetDebugBreak(Bytecode bytecode); | 422 static Bytecode GetDebugBreak(Bytecode bytecode); |
| 436 | 423 |
| 437 // Returns the size of the bytecode including its operands. | 424 // Returns the size of the bytecode including its operands for the |
| 438 static int Size(Bytecode bytecode); | 425 // given |operand_scale|. |
| 426 static int Size(Bytecode bytecode, OperandScale operand_scale); |
| 439 | 427 |
| 440 // Returns the size of |operand|. | 428 // Returns the size of |operand|. |
| 441 static OperandSize SizeOfOperand(OperandType operand); | 429 static OperandSize SizeOfOperand(OperandType operand, OperandScale scale); |
| 442 | 430 |
| 443 // Returns true if the bytecode is a conditional jump taking | 431 // Returns true if the bytecode is a conditional jump taking |
| 444 // an immediate byte operand (OperandType::kImm8). | 432 // an immediate byte operand (OperandType::kImm). |
| 445 static bool IsConditionalJumpImmediate(Bytecode bytecode); | 433 static bool IsConditionalJumpImmediate(Bytecode bytecode); |
| 446 | 434 |
| 447 // Returns true if the bytecode is a conditional jump taking | 435 // Returns true if the bytecode is a conditional jump taking |
| 448 // a constant pool entry (OperandType::kIdx8). | 436 // a constant pool entry (OperandType::kIdx). |
| 449 static bool IsConditionalJumpConstant(Bytecode bytecode); | 437 static bool IsConditionalJumpConstant(Bytecode bytecode); |
| 450 | 438 |
| 451 // Returns true if the bytecode is a conditional jump taking | 439 // Returns true if the bytecode is a conditional jump taking |
| 452 // a constant pool entry (OperandType::kIdx16). | |
| 453 static bool IsConditionalJumpConstantWide(Bytecode bytecode); | |
| 454 | |
| 455 // Returns true if the bytecode is a conditional jump taking | |
| 456 // any kind of operand. | 440 // any kind of operand. |
| 457 static bool IsConditionalJump(Bytecode bytecode); | 441 static bool IsConditionalJump(Bytecode bytecode); |
| 458 | 442 |
| 459 // Returns true if the bytecode is a jump or a conditional jump taking | 443 // Returns true if the bytecode is a jump or a conditional jump taking |
| 460 // an immediate byte operand (OperandType::kImm8). | 444 // an immediate byte operand (OperandType::kImm). |
| 461 static bool IsJumpImmediate(Bytecode bytecode); | 445 static bool IsJumpImmediate(Bytecode bytecode); |
| 462 | 446 |
| 463 // Returns true if the bytecode is a jump or conditional jump taking a | 447 // Returns true if the bytecode is a jump or conditional jump taking a |
| 464 // constant pool entry (OperandType::kIdx8). | 448 // constant pool entry (OperandType::kIdx). |
| 465 static bool IsJumpConstant(Bytecode bytecode); | 449 static bool IsJumpConstant(Bytecode bytecode); |
| 466 | 450 |
| 467 // Returns true if the bytecode is a jump or conditional jump taking a | |
| 468 // constant pool entry (OperandType::kIdx16). | |
| 469 static bool IsJumpConstantWide(Bytecode bytecode); | |
| 470 | |
| 471 // Returns true if the bytecode is a jump or conditional jump taking | 451 // Returns true if the bytecode is a jump or conditional jump taking |
| 472 // any kind of operand. | 452 // any kind of operand. |
| 473 static bool IsJump(Bytecode bytecode); | 453 static bool IsJump(Bytecode bytecode); |
| 474 | 454 |
| 475 // Returns true if the bytecode is a conditional jump, a jump, or a return. | 455 // Returns true if the bytecode is a conditional jump, a jump, or a return. |
| 476 static bool IsJumpOrReturn(Bytecode bytecode); | 456 static bool IsJumpOrReturn(Bytecode bytecode); |
| 477 | 457 |
| 478 // Returns true if the bytecode is a call or a constructor call. | 458 // Returns true if the bytecode is a call or a constructor call. |
| 479 static bool IsCallOrNew(Bytecode bytecode); | 459 static bool IsCallOrNew(Bytecode bytecode); |
| 480 | 460 |
| 481 // Returns true if the bytecode is a call to the runtime. | 461 // Returns true if the bytecode is a call to the runtime. |
| 482 static bool IsCallRuntime(Bytecode bytecode); | 462 static bool IsCallRuntime(Bytecode bytecode); |
| 483 | 463 |
| 484 // Returns true if the bytecode is a debug break. | 464 // Returns true if the bytecode is a debug break. |
| 485 static bool IsDebugBreak(Bytecode bytecode); | 465 static bool IsDebugBreak(Bytecode bytecode); |
| 486 | 466 |
| 487 // Returns true if |operand_type| is a register index operand (kIdx8/kIdx16). | 467 // Returns true if the bytecode has wider operand forms. |
| 488 static bool IsIndexOperandType(OperandType operand_type); | 468 static bool IsBytecodeWithScalableOperands(Bytecode bytecode); |
| 489 | 469 |
| 490 // Returns true if |operand_type| represents an immediate. | 470 // Returns true if the bytecode is a scaling prefix bytecode. |
| 491 static bool IsImmediateOperandType(OperandType operand_type); | 471 static bool IsPrefixScalingBytecode(Bytecode bytecode); |
| 492 | |
| 493 // Returns true if |operand_type| is a register count operand | |
| 494 // (kRegCount8/kRegCount16). | |
| 495 static bool IsRegisterCountOperandType(OperandType operand_type); | |
| 496 | 472 |
| 497 // Returns true if |operand_type| is any type of register operand. | 473 // Returns true if |operand_type| is any type of register operand. |
| 498 static bool IsRegisterOperandType(OperandType operand_type); | 474 static bool IsRegisterOperandType(OperandType operand_type); |
| 499 | 475 |
| 500 // Returns true if |operand_type| represents a register used as an input. | 476 // Returns true if |operand_type| represents a register used as an input. |
| 501 static bool IsRegisterInputOperandType(OperandType operand_type); | 477 static bool IsRegisterInputOperandType(OperandType operand_type); |
| 502 | 478 |
| 503 // Returns true if |operand_type| represents a register used as an output. | 479 // Returns true if |operand_type| represents a register used as an output. |
| 504 static bool IsRegisterOutputOperandType(OperandType operand_type); | 480 static bool IsRegisterOutputOperandType(OperandType operand_type); |
| 505 | 481 |
| 506 // Returns true if |operand_type| is a maybe register operand | 482 // Returns true if |operand_type| is a maybe register operand |
| 507 // (kMaybeReg8/kMaybeReg16). | 483 // (kMaybeReg). |
| 508 static bool IsMaybeRegisterOperandType(OperandType operand_type); | 484 static bool IsMaybeRegisterOperandType(OperandType operand_type); |
| 509 | 485 |
| 486 // Returns true if |operand_type| is a runtime-id operand (kRuntimeId). |
| 487 static bool IsRuntimeIdOperandType(OperandType operand_type); |
| 488 |
| 489 // Returns true if |operand_type| is unsigned, false if signed. |
| 490 static bool IsUnsignedOperandType(OperandType operand_type); |
| 491 |
| 492 // Decodes a register operand in a byte array. |
| 493 static Register DecodeRegisterOperand(const uint8_t* operand_start, |
| 494 OperandType operand_type, |
| 495 OperandScale operand_scale); |
| 496 |
| 497 // Decodes a signed operand in a byte array. |
| 498 static int32_t DecodeSignedOperand(const uint8_t* operand_start, |
| 499 OperandType operand_type, |
| 500 OperandScale operand_scale); |
| 501 |
| 502 // Decodes an unsigned operand in a byte array. |
| 503 static uint32_t DecodeUnsignedOperand(const uint8_t* operand_start, |
| 504 OperandType operand_type, |
| 505 OperandScale operand_scale); |
| 506 |
| 510 // Decode a single bytecode and operands to |os|. | 507 // Decode a single bytecode and operands to |os|. |
| 511 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 508 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
| 512 int number_of_parameters); | 509 int number_of_parameters); |
| 513 | 510 |
| 511 // Return the next larger operand scale. |
| 512 static OperandScale NextOperandScale(OperandScale operand_scale); |
| 513 |
| 514 private: | 514 private: |
| 515 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 515 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
| 516 }; | 516 }; |
| 517 | 517 |
| 518 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 518 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
| 519 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
| 520 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
| 519 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 521 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
| 520 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | |
| 521 | 522 |
| 522 } // namespace interpreter | 523 } // namespace interpreter |
| 523 } // namespace internal | 524 } // namespace internal |
| 524 } // namespace v8 | 525 } // namespace v8 |
| 525 | 526 |
| 526 #endif // V8_INTERPRETER_BYTECODES_H_ | 527 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |