Chromium Code Reviews| 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. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 #define NON_REGISTER_OPERAND_TYPE_LIST(V) \ | 41 #define NON_REGISTER_OPERAND_TYPE_LIST(V) \ |
| 42 INVALID_OPERAND_TYPE_LIST(V) \ | 42 INVALID_OPERAND_TYPE_LIST(V) \ |
| 43 SCALAR_OPERAND_TYPE_LIST(V) | 43 SCALAR_OPERAND_TYPE_LIST(V) |
| 44 | 44 |
| 45 // The list of operand types used by bytecodes. | 45 // The list of operand types used by bytecodes. |
| 46 #define OPERAND_TYPE_LIST(V) \ | 46 #define OPERAND_TYPE_LIST(V) \ |
| 47 NON_REGISTER_OPERAND_TYPE_LIST(V) \ | 47 NON_REGISTER_OPERAND_TYPE_LIST(V) \ |
| 48 REGISTER_OPERAND_TYPE_LIST(V) | 48 REGISTER_OPERAND_TYPE_LIST(V) |
| 49 | 49 |
| 50 // Define one debug break bytecode for each possible size of unscaled | 50 // Define one debug break bytecode for each possible size of unscaled |
| 51 // bytecodes. | 51 // bytecodes. Format is V(<bytecode>, <accumulator_use>, <operands>). |
| 52 #define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ | 52 #define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ |
| 53 V(DebugBreak0, OperandType::kNone) \ | 53 V(DebugBreak0, AccumulatorUse::kRead) \ |
| 54 V(DebugBreak1, OperandType::kReg) \ | 54 V(DebugBreak1, AccumulatorUse::kRead, OperandType::kReg) \ |
| 55 V(DebugBreak2, OperandType::kReg, OperandType::kReg) \ | 55 V(DebugBreak2, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg) \ |
| 56 V(DebugBreak3, OperandType::kReg, OperandType::kReg, OperandType::kReg) \ | 56 V(DebugBreak3, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg, \ |
| 57 V(DebugBreak4, OperandType::kReg, OperandType::kReg, OperandType::kReg, \ | 57 OperandType::kReg) \ |
| 58 OperandType::kReg) \ | 58 V(DebugBreak4, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg, \ |
| 59 V(DebugBreak5, OperandType::kRuntimeId, OperandType::kReg, \ | 59 OperandType::kReg, OperandType::kReg) \ |
| 60 OperandType::kReg) \ | 60 V(DebugBreak5, AccumulatorUse::kRead, OperandType::kRuntimeId, \ |
| 61 V(DebugBreak6, OperandType::kRuntimeId, OperandType::kReg, \ | 61 OperandType::kReg, OperandType::kReg) \ |
| 62 OperandType::kReg, OperandType::kReg) | 62 V(DebugBreak6, AccumulatorUse::kRead, OperandType::kRuntimeId, \ |
| 63 OperandType::kReg, OperandType::kReg, OperandType::kReg) | |
| 63 | 64 |
| 64 // Define one debug break for each widening prefix. | 65 // Define one debug break for each widening prefix. |
| 65 #define DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) \ | 66 #define DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) \ |
| 66 V(DebugBreakWide, OperandType::kNone) \ | 67 V(DebugBreakWide, AccumulatorUse::kRead) \ |
| 67 V(DebugBreakExtraWide, OperandType::kNone) | 68 V(DebugBreakExtraWide, AccumulatorUse::kRead) |
| 68 | 69 |
| 69 #define DEBUG_BREAK_BYTECODE_LIST(V) \ | 70 #define DEBUG_BREAK_BYTECODE_LIST(V) \ |
| 70 DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ | 71 DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ |
| 71 DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) | 72 DEBUG_BREAK_PREFIX_BYTECODE_LIST(V) |
| 72 | 73 |
| 73 // The list of bytecodes which are interpreted by the interpreter. | 74 // The list of bytecodes which are interpreted by the interpreter. |
| 74 #define BYTECODE_LIST(V) \ | 75 #define BYTECODE_LIST(V) \ |
| 75 /* Extended width operands */ \ | 76 /* Extended width operands */ \ |
| 76 V(Wide, OperandType::kNone) \ | 77 V(Wide, AccumulatorUse::kNone) \ |
| 77 V(ExtraWide, OperandType::kNone) \ | 78 V(ExtraWide, AccumulatorUse::kNone) \ |
| 78 \ | 79 \ |
| 79 /* Loading the accumulator */ \ | 80 /* Loading the accumulator */ \ |
| 80 V(LdaZero, OperandType::kNone) \ | 81 V(LdaZero, AccumulatorUse::kWrite) \ |
| 81 V(LdaSmi, OperandType::kImm) \ | 82 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ |
| 82 V(LdaUndefined, OperandType::kNone) \ | 83 V(LdaUndefined, AccumulatorUse::kWrite) \ |
| 83 V(LdaNull, OperandType::kNone) \ | 84 V(LdaNull, AccumulatorUse::kWrite) \ |
| 84 V(LdaTheHole, OperandType::kNone) \ | 85 V(LdaTheHole, AccumulatorUse::kWrite) \ |
| 85 V(LdaTrue, OperandType::kNone) \ | 86 V(LdaTrue, AccumulatorUse::kWrite) \ |
| 86 V(LdaFalse, OperandType::kNone) \ | 87 V(LdaFalse, AccumulatorUse::kWrite) \ |
| 87 V(LdaConstant, OperandType::kIdx) \ | 88 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 88 \ | 89 \ |
| 89 /* Globals */ \ | 90 /* Globals */ \ |
| 90 V(LdaGlobal, OperandType::kIdx, OperandType::kIdx) \ | 91 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \ |
| 91 V(LdaGlobalInsideTypeof, OperandType::kIdx, OperandType::kIdx) \ | 92 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 92 V(StaGlobalSloppy, OperandType::kIdx, OperandType::kIdx) \ | 93 OperandType::kIdx) \ |
| 93 V(StaGlobalStrict, OperandType::kIdx, OperandType::kIdx) \ | 94 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ |
| 94 \ | 95 OperandType::kIdx) \ |
| 95 /* Context operations */ \ | 96 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ |
| 96 V(PushContext, OperandType::kReg) \ | 97 OperandType::kIdx) \ |
| 97 V(PopContext, OperandType::kReg) \ | 98 \ |
| 98 V(LdaContextSlot, OperandType::kReg, OperandType::kIdx) \ | 99 /* Context operations */ \ |
| 99 V(StaContextSlot, OperandType::kReg, OperandType::kIdx) \ | 100 V(PushContext, AccumulatorUse::kRead, OperandType::kReg) \ |
| 100 \ | 101 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ |
| 101 /* Load-Store lookup slots */ \ | 102 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 102 V(LdaLookupSlot, OperandType::kIdx) \ | 103 OperandType::kIdx) \ |
| 103 V(LdaLookupSlotInsideTypeof, OperandType::kIdx) \ | 104 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ |
| 104 V(StaLookupSlotSloppy, OperandType::kIdx) \ | 105 OperandType::kIdx) \ |
| 105 V(StaLookupSlotStrict, OperandType::kIdx) \ | 106 \ |
| 106 \ | 107 /* Load-Store lookup slots */ \ |
| 107 /* Register-accumulator transfers */ \ | 108 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 108 V(Ldar, OperandType::kReg) \ | 109 V(LdaLookupSlotInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 109 V(Star, OperandType::kRegOut) \ | 110 V(StaLookupSlotSloppy, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 110 \ | 111 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 111 /* Register-register transfers */ \ | 112 \ |
| 112 V(Mov, OperandType::kReg, OperandType::kRegOut) \ | 113 /* Register-accumulator transfers */ \ |
| 113 \ | 114 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 114 /* LoadIC operations */ \ | 115 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 115 V(LoadIC, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ | 116 \ |
| 116 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ | 117 /* Register-register transfers */ \ |
| 117 \ | 118 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ |
| 118 /* StoreIC operations */ \ | 119 \ |
| 119 V(StoreICSloppy, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ | 120 /* LoadIC operations */ \ |
| 120 V(StoreICStrict, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ | 121 V(LoadIC, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kIdx, \ |
| 121 V(KeyedStoreICSloppy, OperandType::kReg, OperandType::kReg, \ | 122 OperandType::kIdx) \ |
| 122 OperandType::kIdx) \ | 123 V(KeyedLoadIC, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 123 V(KeyedStoreICStrict, OperandType::kReg, OperandType::kReg, \ | 124 OperandType::kIdx) \ |
| 124 OperandType::kIdx) \ | 125 \ |
| 125 \ | 126 /* StoreIC operations */ \ |
| 126 /* Binary Operators */ \ | 127 V(StoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 127 V(Add, OperandType::kReg) \ | 128 OperandType::kIdx, OperandType::kIdx) \ |
| 128 V(Sub, OperandType::kReg) \ | 129 V(StoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 129 V(Mul, OperandType::kReg) \ | 130 OperandType::kIdx, OperandType::kIdx) \ |
| 130 V(Div, OperandType::kReg) \ | 131 V(KeyedStoreICSloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 131 V(Mod, OperandType::kReg) \ | 132 OperandType::kReg, OperandType::kIdx) \ |
| 132 V(BitwiseOr, OperandType::kReg) \ | 133 V(KeyedStoreICStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 133 V(BitwiseXor, OperandType::kReg) \ | 134 OperandType::kReg, OperandType::kIdx) \ |
| 134 V(BitwiseAnd, OperandType::kReg) \ | 135 \ |
| 135 V(ShiftLeft, OperandType::kReg) \ | 136 /* Binary Operators */ \ |
| 136 V(ShiftRight, OperandType::kReg) \ | 137 V(Add, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 137 V(ShiftRightLogical, OperandType::kReg) \ | 138 V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 138 \ | 139 V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 139 /* Unary Operators */ \ | 140 V(Div, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 140 V(Inc, OperandType::kNone) \ | 141 V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 141 V(Dec, OperandType::kNone) \ | 142 V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 142 V(LogicalNot, OperandType::kNone) \ | 143 V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 143 V(TypeOf, OperandType::kNone) \ | 144 V(BitwiseAnd, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 144 V(DeletePropertyStrict, OperandType::kReg) \ | 145 V(ShiftLeft, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 145 V(DeletePropertySloppy, OperandType::kReg) \ | 146 V(ShiftRight, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 146 \ | 147 V(ShiftRightLogical, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 147 /* Call operations */ \ | 148 \ |
| 148 V(Call, OperandType::kReg, OperandType::kReg, OperandType::kRegCount, \ | 149 /* Unary Operators */ \ |
| 149 OperandType::kIdx) \ | 150 V(Inc, AccumulatorUse::kReadWrite) \ |
| 150 V(TailCall, OperandType::kReg, OperandType::kReg, OperandType::kRegCount, \ | 151 V(Dec, AccumulatorUse::kReadWrite) \ |
| 151 OperandType::kIdx) \ | 152 V(LogicalNot, AccumulatorUse::kReadWrite) \ |
| 152 V(CallRuntime, OperandType::kRuntimeId, OperandType::kMaybeReg, \ | 153 V(TypeOf, AccumulatorUse::kReadWrite) \ |
| 153 OperandType::kRegCount) \ | 154 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 154 V(CallRuntimeForPair, OperandType::kRuntimeId, OperandType::kMaybeReg, \ | 155 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 155 OperandType::kRegCount, OperandType::kRegOutPair) \ | 156 \ |
| 156 V(CallJSRuntime, OperandType::kIdx, OperandType::kReg, \ | 157 /* Call operations */ \ |
| 157 OperandType::kRegCount) \ | 158 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 158 \ | 159 OperandType::kRegCount, OperandType::kIdx) \ |
| 159 /* Intrinsics */ \ | 160 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 160 V(InvokeIntrinsic, OperandType::kRuntimeId, OperandType::kMaybeReg, \ | 161 OperandType::kRegCount, OperandType::kIdx) \ |
| 161 OperandType::kRegCount) \ | 162 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ |
| 162 \ | 163 OperandType::kMaybeReg, OperandType::kRegCount) \ |
| 163 /* New operator */ \ | 164 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ |
| 164 V(New, OperandType::kReg, OperandType::kMaybeReg, OperandType::kRegCount) \ | 165 OperandType::kMaybeReg, OperandType::kRegCount, OperandType::kRegOutPair) \ |
| 165 \ | 166 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 166 /* Test Operators */ \ | 167 OperandType::kReg, OperandType::kRegCount) \ |
| 167 V(TestEqual, OperandType::kReg) \ | 168 \ |
| 168 V(TestNotEqual, OperandType::kReg) \ | 169 /* Intrinsics */ \ |
| 169 V(TestEqualStrict, OperandType::kReg) \ | 170 V(InvokeIntrinsic, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ |
| 170 V(TestLessThan, OperandType::kReg) \ | 171 OperandType::kMaybeReg, OperandType::kRegCount) \ |
| 171 V(TestGreaterThan, OperandType::kReg) \ | 172 \ |
| 172 V(TestLessThanOrEqual, OperandType::kReg) \ | 173 /* New operator */ \ |
| 173 V(TestGreaterThanOrEqual, OperandType::kReg) \ | 174 V(New, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 174 V(TestInstanceOf, OperandType::kReg) \ | 175 OperandType::kMaybeReg, OperandType::kRegCount) \ |
| 175 V(TestIn, OperandType::kReg) \ | 176 \ |
| 176 \ | 177 /* Test Operators */ \ |
| 177 /* Cast operators */ \ | 178 V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 178 V(ToName, OperandType::kNone) \ | 179 V(TestNotEqual, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 179 V(ToNumber, OperandType::kNone) \ | 180 V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 180 V(ToObject, OperandType::kNone) \ | 181 V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 181 \ | 182 V(TestGreaterThan, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 182 /* Literals */ \ | 183 V(TestLessThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 183 V(CreateRegExpLiteral, OperandType::kIdx, OperandType::kIdx, \ | 184 V(TestGreaterThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 184 OperandType::kFlag8) \ | 185 V(TestInstanceOf, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 185 V(CreateArrayLiteral, OperandType::kIdx, OperandType::kIdx, \ | 186 V(TestIn, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 186 OperandType::kFlag8) \ | 187 \ |
| 187 V(CreateObjectLiteral, OperandType::kIdx, OperandType::kIdx, \ | 188 /* Cast operators */ \ |
| 188 OperandType::kFlag8) \ | 189 V(ToName, AccumulatorUse::kReadWrite) \ |
| 189 \ | 190 V(ToNumber, AccumulatorUse::kReadWrite) \ |
| 190 /* Closure allocation */ \ | 191 V(ToObject, AccumulatorUse::kReadWrite) \ |
| 191 V(CreateClosure, OperandType::kIdx, OperandType::kFlag8) \ | 192 \ |
| 192 \ | 193 /* Literals */ \ |
| 193 /* Arguments allocation */ \ | 194 V(CreateRegExpLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 194 V(CreateMappedArguments, OperandType::kNone) \ | 195 OperandType::kIdx, OperandType::kFlag8) \ |
| 195 V(CreateUnmappedArguments, OperandType::kNone) \ | 196 V(CreateArrayLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 196 V(CreateRestParameter, OperandType::kNone) \ | 197 OperandType::kIdx, OperandType::kFlag8) \ |
| 197 \ | 198 V(CreateObjectLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 198 /* Control Flow */ \ | 199 OperandType::kIdx, OperandType::kFlag8) \ |
| 199 V(Jump, OperandType::kImm) \ | 200 \ |
| 200 V(JumpConstant, OperandType::kIdx) \ | 201 /* Closure allocation */ \ |
| 201 V(JumpIfTrue, OperandType::kImm) \ | 202 V(CreateClosure, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 202 V(JumpIfTrueConstant, OperandType::kIdx) \ | 203 OperandType::kFlag8) \ |
| 203 V(JumpIfFalse, OperandType::kImm) \ | 204 \ |
| 204 V(JumpIfFalseConstant, OperandType::kIdx) \ | 205 /* Arguments allocation */ \ |
| 205 V(JumpIfToBooleanTrue, OperandType::kImm) \ | 206 V(CreateMappedArguments, AccumulatorUse::kWrite) \ |
| 206 V(JumpIfToBooleanTrueConstant, OperandType::kIdx) \ | 207 V(CreateUnmappedArguments, AccumulatorUse::kWrite) \ |
| 207 V(JumpIfToBooleanFalse, OperandType::kImm) \ | 208 V(CreateRestParameter, AccumulatorUse::kWrite) \ |
| 208 V(JumpIfToBooleanFalseConstant, OperandType::kIdx) \ | 209 \ |
| 209 V(JumpIfNull, OperandType::kImm) \ | 210 /* Control Flow */ \ |
| 210 V(JumpIfNullConstant, OperandType::kIdx) \ | 211 V(Jump, AccumulatorUse::kNone, OperandType::kImm) \ |
| 211 V(JumpIfUndefined, OperandType::kImm) \ | 212 V(JumpConstant, AccumulatorUse::kNone, OperandType::kIdx) \ |
| 212 V(JumpIfUndefinedConstant, OperandType::kIdx) \ | 213 V(JumpIfTrue, AccumulatorUse::kRead, OperandType::kImm) \ |
| 213 V(JumpIfNotHole, OperandType::kImm) \ | 214 V(JumpIfTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 214 V(JumpIfNotHoleConstant, OperandType::kIdx) \ | 215 V(JumpIfFalse, AccumulatorUse::kRead, OperandType::kImm) \ |
| 215 \ | 216 V(JumpIfFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 216 /* Complex flow control For..in */ \ | 217 V(JumpIfToBooleanTrue, AccumulatorUse::kRead, OperandType::kImm) \ |
| 217 V(ForInPrepare, OperandType::kRegOutTriple) \ | 218 V(JumpIfToBooleanTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 218 V(ForInDone, OperandType::kReg, OperandType::kReg) \ | 219 V(JumpIfToBooleanFalse, AccumulatorUse::kRead, OperandType::kImm) \ |
| 219 V(ForInNext, OperandType::kReg, OperandType::kReg, OperandType::kRegPair, \ | 220 V(JumpIfToBooleanFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 220 OperandType::kIdx) \ | 221 V(JumpIfNull, AccumulatorUse::kRead, OperandType::kImm) \ |
| 221 V(ForInStep, OperandType::kReg) \ | 222 V(JumpIfNullConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 222 \ | 223 V(JumpIfUndefined, AccumulatorUse::kRead, OperandType::kImm) \ |
| 223 /* Perform a stack guard check */ \ | 224 V(JumpIfUndefinedConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 224 V(StackCheck, OperandType::kNone) \ | 225 V(JumpIfNotHole, AccumulatorUse::kRead, OperandType::kImm) \ |
| 225 \ | 226 V(JumpIfNotHoleConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 226 /* Non-local flow control */ \ | 227 \ |
| 227 V(Throw, OperandType::kNone) \ | 228 /* Complex flow control For..in */ \ |
| 228 V(ReThrow, OperandType::kNone) \ | 229 V(ForInPrepare, AccumulatorUse::kRead, OperandType::kRegOutTriple) \ |
| 229 V(Return, OperandType::kNone) \ | 230 V(ForInDone, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg) \ |
| 230 \ | 231 V(ForInNext, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 231 /* Debugger */ \ | 232 OperandType::kRegPair, OperandType::kIdx) \ |
| 232 V(Debugger, OperandType::kNone) \ | 233 V(ForInStep, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 233 DEBUG_BREAK_BYTECODE_LIST(V) \ | 234 \ |
| 234 \ | 235 /* Perform a stack guard check */ \ |
| 235 /* Illegal bytecode (terminates execution) */ \ | 236 V(StackCheck, AccumulatorUse::kNone) \ |
| 236 V(Illegal, OperandType::kNone) | 237 \ |
| 238 /* Non-local flow control */ \ | |
| 239 V(Throw, AccumulatorUse::kRead) \ | |
| 240 V(ReThrow, AccumulatorUse::kRead) \ | |
| 241 V(Return, AccumulatorUse::kNone) \ | |
| 242 \ | |
| 243 /* Debugger */ \ | |
| 244 V(Debugger, AccumulatorUse::kNone) \ | |
| 245 DEBUG_BREAK_BYTECODE_LIST(V) \ | |
| 246 \ | |
| 247 /* Illegal bytecode (terminates execution) */ \ | |
| 248 V(Illegal, AccumulatorUse::kNone) | |
| 249 | |
| 250 enum class AccumulatorUse : uint8_t { | |
| 251 kNone = 0, | |
| 252 kRead = 1, | |
| 253 kWrite = 2, | |
|
rmcilroy
2016/04/05 12:59:22
Nit - could you make this 1 << 1 (and read 1 << 0)
oth
2016/04/05 14:12:10
Done.
| |
| 254 kReadWrite = kRead | kWrite | |
| 255 }; | |
| 256 | |
| 257 V8_INLINE AccumulatorUse operator&(AccumulatorUse lhs, AccumulatorUse rhs) { | |
| 258 int result = static_cast<int>(lhs) & static_cast<int>(rhs); | |
| 259 return static_cast<AccumulatorUse>(result); | |
| 260 } | |
| 261 | |
| 262 V8_INLINE AccumulatorUse operator|(AccumulatorUse lhs, AccumulatorUse rhs) { | |
| 263 int result = static_cast<int>(lhs) | static_cast<int>(rhs); | |
| 264 return static_cast<AccumulatorUse>(result); | |
| 265 } | |
| 237 | 266 |
| 238 // Enumeration of scaling factors applicable to scalable operands. Code | 267 // Enumeration of scaling factors applicable to scalable operands. Code |
| 239 // relies on being able to cast values to integer scaling values. | 268 // relies on being able to cast values to integer scaling values. |
| 240 enum class OperandScale : uint8_t { | 269 enum class OperandScale : uint8_t { |
| 241 kSingle = 1, | 270 kSingle = 1, |
| 242 kDouble = 2, | 271 kDouble = 2, |
| 243 kQuadruple = 4, | 272 kQuadruple = 4, |
| 244 kMaxValid = kQuadruple, | 273 kMaxValid = kQuadruple, |
| 245 kInvalid = 8, | 274 kInvalid = 8, |
| 246 }; | 275 }; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 | 396 |
| 368 | 397 |
| 369 class Bytecodes { | 398 class Bytecodes { |
| 370 public: | 399 public: |
| 371 // Returns string representation of |bytecode|. | 400 // Returns string representation of |bytecode|. |
| 372 static const char* ToString(Bytecode bytecode); | 401 static const char* ToString(Bytecode bytecode); |
| 373 | 402 |
| 374 // Returns string representation of |bytecode|. | 403 // Returns string representation of |bytecode|. |
| 375 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); | 404 static std::string ToString(Bytecode bytecode, OperandScale operand_scale); |
| 376 | 405 |
| 406 // Returns string representation of |accumulator_use|. | |
| 407 static const char* AccumulatorUseToString(AccumulatorUse accumulator_use); | |
| 408 | |
| 377 // Returns string representation of |operand_type|. | 409 // Returns string representation of |operand_type|. |
| 378 static const char* OperandTypeToString(OperandType operand_type); | 410 static const char* OperandTypeToString(OperandType operand_type); |
| 379 | 411 |
| 380 // Returns string representation of |operand_scale|. | 412 // Returns string representation of |operand_scale|. |
| 381 static const char* OperandScaleToString(OperandScale operand_scale); | 413 static const char* OperandScaleToString(OperandScale operand_scale); |
| 382 | 414 |
| 383 // Returns string representation of |operand_size|. | 415 // Returns string representation of |operand_size|. |
| 384 static const char* OperandSizeToString(OperandSize operand_size); | 416 static const char* OperandSizeToString(OperandSize operand_size); |
| 385 | 417 |
| 386 // Returns byte value of bytecode. | 418 // Returns byte value of bytecode. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 399 // applied to a a bytecode. | 431 // applied to a a bytecode. |
| 400 static Bytecode OperandScaleToPrefixBytecode(OperandScale operand_scale); | 432 static Bytecode OperandScaleToPrefixBytecode(OperandScale operand_scale); |
| 401 | 433 |
| 402 // Returns true if the operand scale requires a prefix bytecode. | 434 // Returns true if the operand scale requires a prefix bytecode. |
| 403 static bool OperandScaleRequiresPrefixBytecode(OperandScale operand_scale); | 435 static bool OperandScaleRequiresPrefixBytecode(OperandScale operand_scale); |
| 404 | 436 |
| 405 // Returns the scaling applied to scalable operands if bytecode is | 437 // Returns the scaling applied to scalable operands if bytecode is |
| 406 // is a scaling prefix. | 438 // is a scaling prefix. |
| 407 static OperandScale PrefixBytecodeToOperandScale(Bytecode bytecode); | 439 static OperandScale PrefixBytecodeToOperandScale(Bytecode bytecode); |
| 408 | 440 |
| 441 // Returns how accumulator is used by |bytecode|. | |
| 442 static AccumulatorUse GetAccumulatorUse(Bytecode bytecode); | |
| 443 | |
| 444 // Returns true if |bytecode| reads the accumulator. | |
| 445 static bool ReadsAccumulator(Bytecode bytecode); | |
| 446 | |
| 447 // Returns true if |bytecode| writes the accumulator. | |
| 448 static bool WritesAccumulator(Bytecode bytecode); | |
| 449 | |
| 409 // Returns the i-th operand of |bytecode|. | 450 // Returns the i-th operand of |bytecode|. |
| 410 static OperandType GetOperandType(Bytecode bytecode, int i); | 451 static OperandType GetOperandType(Bytecode bytecode, int i); |
| 411 | 452 |
| 412 // Returns the size of the i-th operand of |bytecode|. | 453 // Returns the size of the i-th operand of |bytecode|. |
| 413 static OperandSize GetOperandSize(Bytecode bytecode, int i, | 454 static OperandSize GetOperandSize(Bytecode bytecode, int i, |
| 414 OperandScale operand_scale); | 455 OperandScale operand_scale); |
| 415 | 456 |
| 416 // Returns the offset of the i-th operand of |bytecode| relative to the start | 457 // Returns the offset of the i-th operand of |bytecode| relative to the start |
| 417 // of the bytecode. | 458 // of the bytecode. |
| 418 static int GetOperandOffset(Bytecode bytecode, int i, | 459 static int GetOperandOffset(Bytecode bytecode, int i, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 int number_of_parameters); | 554 int number_of_parameters); |
| 514 | 555 |
| 515 // Return the next larger operand scale. | 556 // Return the next larger operand scale. |
| 516 static OperandScale NextOperandScale(OperandScale operand_scale); | 557 static OperandScale NextOperandScale(OperandScale operand_scale); |
| 517 | 558 |
| 518 private: | 559 private: |
| 519 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 560 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
| 520 }; | 561 }; |
| 521 | 562 |
| 522 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 563 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
| 564 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | |
| 523 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 565 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
| 524 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 566 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
| 525 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 567 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
| 526 | 568 |
| 527 } // namespace interpreter | 569 } // namespace interpreter |
| 528 } // namespace internal | 570 } // namespace internal |
| 529 } // namespace v8 | 571 } // namespace v8 |
| 530 | 572 |
| 531 #endif // V8_INTERPRETER_BYTECODES_H_ | 573 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |