| 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 <cstdint> | 8 #include <cstdint> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "src/globals.h" | 12 #include "src/globals.h" |
| 13 #include "src/interpreter/bytecode-operands.h" | 13 #include "src/interpreter/bytecode-operands.h" |
| 14 | 14 |
| 15 // This interface and it's implementation are independent of the | 15 // This interface and it's implementation are independent of the |
| 16 // libv8_base library as they are used by the interpreter and the | 16 // libv8_base library as they are used by the interpreter and the |
| 17 // standalone mkpeephole table generator program. | 17 // standalone mkpeephole table generator program. |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 namespace interpreter { | 21 namespace interpreter { |
| 22 | 22 |
| 23 // The list of bytecodes which are interpreted by the interpreter. | 23 // The list of bytecodes which are interpreted by the interpreter. |
| 24 // Format is V(<bytecode>, <accumulator_use>, <operands>). | 24 // Format is V(<bytecode>, <accumulator_use>, <operands>). |
| 25 #define BYTECODE_LIST(V) \ | 25 #define BYTECODE_LIST(V) \ |
| 26 /* Extended width operands */ \ | 26 /* Extended width operands */ \ |
| 27 V(Wide, AccumulatorUse::kNone) \ | 27 V(Wide, AccumulatorUse::kNone) \ |
| 28 V(ExtraWide, AccumulatorUse::kNone) \ | 28 V(ExtraWide, AccumulatorUse::kNone) \ |
| 29 \ | 29 \ |
| 30 /* Loading the accumulator */ \ | 30 /* Loading the accumulator */ \ |
| 31 V(LdaZero, AccumulatorUse::kWrite) \ | 31 V(LdaZero, AccumulatorUse::kWrite) \ |
| 32 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ | 32 V(LdaSmi, AccumulatorUse::kWrite, OperandType::kImm) \ |
| 33 V(LdaUndefined, AccumulatorUse::kWrite) \ | 33 V(LdaUndefined, AccumulatorUse::kWrite) \ |
| 34 V(LdaNull, AccumulatorUse::kWrite) \ | 34 V(LdaNull, AccumulatorUse::kWrite) \ |
| 35 V(LdaTheHole, AccumulatorUse::kWrite) \ | 35 V(LdaTheHole, AccumulatorUse::kWrite) \ |
| 36 V(LdaTrue, AccumulatorUse::kWrite) \ | 36 V(LdaTrue, AccumulatorUse::kWrite) \ |
| 37 V(LdaFalse, AccumulatorUse::kWrite) \ | 37 V(LdaFalse, AccumulatorUse::kWrite) \ |
| 38 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ | 38 V(LdaConstant, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 39 \ | 39 \ |
| 40 /* Globals */ \ | 40 /* Globals */ \ |
| 41 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \ | 41 V(LdaGlobal, AccumulatorUse::kWrite, OperandType::kIdx, OperandType::kIdx) \ |
| 42 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \ | 42 V(LdaGlobalInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 43 OperandType::kIdx) \ | 43 OperandType::kIdx) \ |
| 44 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ | 44 V(StaGlobalSloppy, AccumulatorUse::kRead, OperandType::kIdx, \ |
| 45 OperandType::kIdx) \ | 45 OperandType::kIdx) \ |
| 46 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ | 46 V(StaGlobalStrict, AccumulatorUse::kRead, OperandType::kIdx, \ |
| 47 OperandType::kIdx) \ | 47 OperandType::kIdx) \ |
| 48 \ | 48 \ |
| 49 /* Context operations */ \ | 49 /* Context operations */ \ |
| 50 V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \ | 50 V(PushContext, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 51 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ | 51 V(PopContext, AccumulatorUse::kNone, OperandType::kReg) \ |
| 52 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ | 52 V(LdaContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 53 OperandType::kIdx, OperandType::kUImm) \ | 53 OperandType::kIdx, OperandType::kUImm) \ |
| 54 V(LdaCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ | 54 V(LdaImmutableContextSlot, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 55 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ | 55 OperandType::kIdx, OperandType::kUImm) \ |
| 56 OperandType::kIdx, OperandType::kUImm) \ | 56 V(LdaCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 57 V(StaCurrentContextSlot, AccumulatorUse::kRead, OperandType::kIdx) \ | 57 V(LdaImmutableCurrentContextSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 58 \ | 58 V(StaContextSlot, AccumulatorUse::kRead, OperandType::kReg, \ |
| 59 /* Load-Store lookup slots */ \ | 59 OperandType::kIdx, OperandType::kUImm) \ |
| 60 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ | 60 V(StaCurrentContextSlot, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 61 V(LdaLookupContextSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ | 61 \ |
| 62 OperandType::kIdx, OperandType::kUImm) \ | 62 /* Load-Store lookup slots */ \ |
| 63 V(LdaLookupGlobalSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ | 63 V(LdaLookupSlot, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 64 OperandType::kIdx, OperandType::kUImm) \ | 64 V(LdaLookupContextSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 65 V(LdaLookupSlotInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ | 65 OperandType::kIdx, OperandType::kUImm) \ |
| 66 V(LdaLookupContextSlotInsideTypeof, AccumulatorUse::kWrite, \ | 66 V(LdaLookupGlobalSlot, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 67 OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \ | 67 OperandType::kIdx, OperandType::kUImm) \ |
| 68 V(LdaLookupGlobalSlotInsideTypeof, AccumulatorUse::kWrite, \ | 68 V(LdaLookupSlotInsideTypeof, AccumulatorUse::kWrite, OperandType::kIdx) \ |
| 69 OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \ | 69 V(LdaLookupContextSlotInsideTypeof, AccumulatorUse::kWrite, \ |
| 70 V(StaLookupSlotSloppy, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 70 OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \ |
| 71 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 71 V(LdaLookupGlobalSlotInsideTypeof, AccumulatorUse::kWrite, \ |
| 72 \ | 72 OperandType::kIdx, OperandType::kIdx, OperandType::kUImm) \ |
| 73 /* Register-accumulator transfers */ \ | 73 V(StaLookupSlotSloppy, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 74 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ | 74 V(StaLookupSlotStrict, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 75 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ | 75 \ |
| 76 \ | 76 /* Register-accumulator transfers */ \ |
| 77 /* Register-register transfers */ \ | 77 V(Ldar, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 78 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ | 78 V(Star, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 79 \ | 79 \ |
| 80 /* Property loads (LoadIC) operations */ \ | 80 /* Register-register transfers */ \ |
| 81 V(LdaNamedProperty, AccumulatorUse::kWrite, OperandType::kReg, \ | 81 V(Mov, AccumulatorUse::kNone, OperandType::kReg, OperandType::kRegOut) \ |
| 82 OperandType::kIdx, OperandType::kIdx) \ | 82 \ |
| 83 V(LdaKeyedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 83 /* Property loads (LoadIC) operations */ \ |
| 84 OperandType::kIdx) \ | 84 V(LdaNamedProperty, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 85 \ | 85 OperandType::kIdx, OperandType::kIdx) \ |
| 86 /* Operations on module variables */ \ | 86 V(LdaKeyedProperty, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 87 V(LdaModuleVariable, AccumulatorUse::kWrite, OperandType::kImm, \ | 87 OperandType::kIdx) \ |
| 88 OperandType::kUImm) \ | 88 \ |
| 89 V(StaModuleVariable, AccumulatorUse::kRead, OperandType::kImm, \ | 89 /* Operations on module variables */ \ |
| 90 OperandType::kUImm) \ | 90 V(LdaModuleVariable, AccumulatorUse::kWrite, OperandType::kImm, \ |
| 91 \ | 91 OperandType::kUImm) \ |
| 92 /* Propery stores (StoreIC) operations */ \ | 92 V(StaModuleVariable, AccumulatorUse::kRead, OperandType::kImm, \ |
| 93 V(StaNamedPropertySloppy, AccumulatorUse::kRead, OperandType::kReg, \ | 93 OperandType::kUImm) \ |
| 94 OperandType::kIdx, OperandType::kIdx) \ | 94 \ |
| 95 V(StaNamedPropertyStrict, AccumulatorUse::kRead, OperandType::kReg, \ | 95 /* Propery stores (StoreIC) operations */ \ |
| 96 OperandType::kIdx, OperandType::kIdx) \ | 96 V(StaNamedPropertySloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 97 V(StaKeyedPropertySloppy, AccumulatorUse::kRead, OperandType::kReg, \ | 97 OperandType::kIdx, OperandType::kIdx) \ |
| 98 OperandType::kReg, OperandType::kIdx) \ | 98 V(StaNamedPropertyStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 99 V(StaKeyedPropertyStrict, AccumulatorUse::kRead, OperandType::kReg, \ | 99 OperandType::kIdx, OperandType::kIdx) \ |
| 100 OperandType::kReg, OperandType::kIdx) \ | 100 V(StaKeyedPropertySloppy, AccumulatorUse::kRead, OperandType::kReg, \ |
| 101 V(StaDataPropertyInLiteral, AccumulatorUse::kRead, OperandType::kReg, \ | 101 OperandType::kReg, OperandType::kIdx) \ |
| 102 OperandType::kReg, OperandType::kFlag8, OperandType::kIdx) \ | 102 V(StaKeyedPropertyStrict, AccumulatorUse::kRead, OperandType::kReg, \ |
| 103 \ | 103 OperandType::kReg, OperandType::kIdx) \ |
| 104 /* Binary Operators */ \ | 104 V(StaDataPropertyInLiteral, AccumulatorUse::kRead, OperandType::kReg, \ |
| 105 V(Add, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ | 105 OperandType::kReg, OperandType::kFlag8, OperandType::kIdx) \ |
| 106 V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ | 106 \ |
| 107 V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ | 107 /* Binary Operators */ \ |
| 108 V(Div, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ | 108 V(Add, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ |
| 109 V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ | 109 V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ |
| 110 V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 110 V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ |
| 111 OperandType::kIdx) \ | 111 V(Div, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ |
| 112 V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 112 V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \ |
| 113 OperandType::kIdx) \ | 113 V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 114 V(BitwiseAnd, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 114 OperandType::kIdx) \ |
| 115 OperandType::kIdx) \ | 115 V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 116 V(ShiftLeft, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 116 OperandType::kIdx) \ |
| 117 OperandType::kIdx) \ | 117 V(BitwiseAnd, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 118 V(ShiftRight, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 118 OperandType::kIdx) \ |
| 119 OperandType::kIdx) \ | 119 V(ShiftLeft, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 120 V(ShiftRightLogical, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 120 OperandType::kIdx) \ |
| 121 OperandType::kIdx) \ | 121 V(ShiftRight, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 122 \ | 122 OperandType::kIdx) \ |
| 123 /* Binary operators with immediate operands */ \ | 123 V(ShiftRightLogical, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 124 V(AddSmi, AccumulatorUse::kWrite, OperandType::kImm, OperandType::kReg, \ | 124 OperandType::kIdx) \ |
| 125 OperandType::kIdx) \ | 125 \ |
| 126 V(SubSmi, AccumulatorUse::kWrite, OperandType::kImm, OperandType::kReg, \ | 126 /* Binary operators with immediate operands */ \ |
| 127 OperandType::kIdx) \ | 127 V(AddSmi, AccumulatorUse::kWrite, OperandType::kImm, OperandType::kReg, \ |
| 128 V(BitwiseOrSmi, AccumulatorUse::kWrite, OperandType::kImm, \ | 128 OperandType::kIdx) \ |
| 129 OperandType::kReg, OperandType::kIdx) \ | 129 V(SubSmi, AccumulatorUse::kWrite, OperandType::kImm, OperandType::kReg, \ |
| 130 V(BitwiseAndSmi, AccumulatorUse::kWrite, OperandType::kImm, \ | 130 OperandType::kIdx) \ |
| 131 OperandType::kReg, OperandType::kIdx) \ | 131 V(BitwiseOrSmi, AccumulatorUse::kWrite, OperandType::kImm, \ |
| 132 V(ShiftLeftSmi, AccumulatorUse::kWrite, OperandType::kImm, \ | 132 OperandType::kReg, OperandType::kIdx) \ |
| 133 OperandType::kReg, OperandType::kIdx) \ | 133 V(BitwiseAndSmi, AccumulatorUse::kWrite, OperandType::kImm, \ |
| 134 V(ShiftRightSmi, AccumulatorUse::kWrite, OperandType::kImm, \ | 134 OperandType::kReg, OperandType::kIdx) \ |
| 135 OperandType::kReg, OperandType::kIdx) \ | 135 V(ShiftLeftSmi, AccumulatorUse::kWrite, OperandType::kImm, \ |
| 136 \ | 136 OperandType::kReg, OperandType::kIdx) \ |
| 137 /* Unary Operators */ \ | 137 V(ShiftRightSmi, AccumulatorUse::kWrite, OperandType::kImm, \ |
| 138 V(Inc, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 138 OperandType::kReg, OperandType::kIdx) \ |
| 139 V(Dec, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 139 \ |
| 140 V(ToBooleanLogicalNot, AccumulatorUse::kReadWrite) \ | 140 /* Unary Operators */ \ |
| 141 V(LogicalNot, AccumulatorUse::kReadWrite) \ | 141 V(Inc, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 142 V(TypeOf, AccumulatorUse::kReadWrite) \ | 142 V(Dec, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 143 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 143 V(ToBooleanLogicalNot, AccumulatorUse::kReadWrite) \ |
| 144 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 144 V(LogicalNot, AccumulatorUse::kReadWrite) \ |
| 145 \ | 145 V(TypeOf, AccumulatorUse::kReadWrite) \ |
| 146 /* GetSuperConstructor operator */ \ | 146 V(DeletePropertyStrict, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 147 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ | 147 V(DeletePropertySloppy, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 148 \ | 148 \ |
| 149 /* Call operations */ \ | 149 /* GetSuperConstructor operator */ \ |
| 150 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ | 150 V(GetSuperConstructor, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 151 OperandType::kRegCount, OperandType::kIdx) \ | 151 \ |
| 152 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ | 152 /* Call operations */ \ |
| 153 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 153 V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ |
| 154 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ | 154 OperandType::kRegCount, OperandType::kIdx) \ |
| 155 OperandType::kRegList, OperandType::kRegCount) \ | 155 V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 156 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ | 156 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 157 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 157 V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 158 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ | 158 OperandType::kRegList, OperandType::kRegCount) \ |
| 159 OperandType::kRegList, OperandType::kRegCount) \ | 159 V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 160 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ | 160 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 161 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ | 161 V(CallRuntime, AccumulatorUse::kWrite, OperandType::kRuntimeId, \ |
| 162 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ | 162 OperandType::kRegList, OperandType::kRegCount) \ |
| 163 OperandType::kRegList, OperandType::kRegCount) \ | 163 V(CallRuntimeForPair, AccumulatorUse::kNone, OperandType::kRuntimeId, \ |
| 164 \ | 164 OperandType::kRegList, OperandType::kRegCount, OperandType::kRegOutPair) \ |
| 165 /* Intrinsics */ \ | 165 V(CallJSRuntime, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 166 V(InvokeIntrinsic, AccumulatorUse::kWrite, OperandType::kIntrinsicId, \ | 166 OperandType::kRegList, OperandType::kRegCount) \ |
| 167 OperandType::kRegList, OperandType::kRegCount) \ | 167 \ |
| 168 \ | 168 /* Intrinsics */ \ |
| 169 /* Construct operators */ \ | 169 V(InvokeIntrinsic, AccumulatorUse::kWrite, OperandType::kIntrinsicId, \ |
| 170 V(Construct, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 170 OperandType::kRegList, OperandType::kRegCount) \ |
| 171 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ | 171 \ |
| 172 V(ConstructWithSpread, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 172 /* Construct operators */ \ |
| 173 OperandType::kRegList, OperandType::kRegCount) \ | 173 V(Construct, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 174 \ | 174 OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ |
| 175 /* Test Operators */ \ | 175 V(ConstructWithSpread, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 176 V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 176 OperandType::kRegList, OperandType::kRegCount) \ |
| 177 OperandType::kIdx) \ | 177 \ |
| 178 V(TestNotEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 178 /* Test Operators */ \ |
| 179 OperandType::kIdx) \ | 179 V(TestEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 180 V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 180 OperandType::kIdx) \ |
| 181 OperandType::kIdx) \ | 181 V(TestNotEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 182 V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 182 OperandType::kIdx) \ |
| 183 OperandType::kIdx) \ | 183 V(TestEqualStrict, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 184 V(TestGreaterThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 184 OperandType::kIdx) \ |
| 185 OperandType::kIdx) \ | 185 V(TestLessThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 186 V(TestLessThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 186 OperandType::kIdx) \ |
| 187 OperandType::kIdx) \ | 187 V(TestGreaterThan, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 188 V(TestGreaterThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 188 OperandType::kIdx) \ |
| 189 OperandType::kIdx) \ | 189 V(TestLessThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 190 V(TestInstanceOf, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 190 OperandType::kIdx) \ |
| 191 V(TestIn, AccumulatorUse::kReadWrite, OperandType::kReg) \ | 191 V(TestGreaterThanOrEqual, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 192 \ | 192 OperandType::kIdx) \ |
| 193 /* TestEqual with Null or Undefined */ \ | 193 V(TestInstanceOf, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 194 V(TestUndetectable, AccumulatorUse::kWrite, OperandType::kReg) \ | 194 V(TestIn, AccumulatorUse::kReadWrite, OperandType::kReg) \ |
| 195 V(TestNull, AccumulatorUse::kWrite, OperandType::kReg) \ | 195 \ |
| 196 V(TestUndefined, AccumulatorUse::kWrite, OperandType::kReg) \ | 196 /* TestEqual with Null or Undefined */ \ |
| 197 \ | 197 V(TestUndetectable, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 198 /* Cast operators */ \ | 198 V(TestNull, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 199 V(ToName, AccumulatorUse::kRead, OperandType::kRegOut) \ | 199 V(TestUndefined, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 200 V(ToNumber, AccumulatorUse::kRead, OperandType::kRegOut) \ | 200 \ |
| 201 V(ToObject, AccumulatorUse::kRead, OperandType::kRegOut) \ | 201 /* Cast operators */ \ |
| 202 \ | 202 V(ToName, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 203 /* Literals */ \ | 203 V(ToNumber, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 204 V(CreateRegExpLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ | 204 V(ToObject, AccumulatorUse::kRead, OperandType::kRegOut) \ |
| 205 OperandType::kIdx, OperandType::kFlag8) \ | 205 \ |
| 206 V(CreateArrayLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ | 206 /* Literals */ \ |
| 207 OperandType::kIdx, OperandType::kFlag8) \ | 207 V(CreateRegExpLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 208 V(CreateObjectLiteral, AccumulatorUse::kNone, OperandType::kIdx, \ | 208 OperandType::kIdx, OperandType::kFlag8) \ |
| 209 OperandType::kIdx, OperandType::kFlag8, OperandType::kRegOut) \ | 209 V(CreateArrayLiteral, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 210 \ | 210 OperandType::kIdx, OperandType::kFlag8) \ |
| 211 /* Closure allocation */ \ | 211 V(CreateObjectLiteral, AccumulatorUse::kNone, OperandType::kIdx, \ |
| 212 V(CreateClosure, AccumulatorUse::kWrite, OperandType::kIdx, \ | 212 OperandType::kIdx, OperandType::kFlag8, OperandType::kRegOut) \ |
| 213 OperandType::kIdx, OperandType::kFlag8) \ | 213 \ |
| 214 \ | 214 /* Closure allocation */ \ |
| 215 /* Context allocation */ \ | 215 V(CreateClosure, AccumulatorUse::kWrite, OperandType::kIdx, \ |
| 216 V(CreateBlockContext, AccumulatorUse::kReadWrite, OperandType::kIdx) \ | 216 OperandType::kIdx, OperandType::kFlag8) \ |
| 217 V(CreateCatchContext, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 217 \ |
| 218 OperandType::kIdx, OperandType::kIdx) \ | 218 /* Context allocation */ \ |
| 219 V(CreateFunctionContext, AccumulatorUse::kWrite, OperandType::kUImm) \ | 219 V(CreateBlockContext, AccumulatorUse::kReadWrite, OperandType::kIdx) \ |
| 220 V(CreateEvalContext, AccumulatorUse::kWrite, OperandType::kUImm) \ | 220 V(CreateCatchContext, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 221 V(CreateWithContext, AccumulatorUse::kReadWrite, OperandType::kReg, \ | 221 OperandType::kIdx, OperandType::kIdx) \ |
| 222 OperandType::kIdx) \ | 222 V(CreateFunctionContext, AccumulatorUse::kWrite, OperandType::kUImm) \ |
| 223 \ | 223 V(CreateEvalContext, AccumulatorUse::kWrite, OperandType::kUImm) \ |
| 224 /* Arguments allocation */ \ | 224 V(CreateWithContext, AccumulatorUse::kReadWrite, OperandType::kReg, \ |
| 225 V(CreateMappedArguments, AccumulatorUse::kWrite) \ | 225 OperandType::kIdx) \ |
| 226 V(CreateUnmappedArguments, AccumulatorUse::kWrite) \ | 226 \ |
| 227 V(CreateRestParameter, AccumulatorUse::kWrite) \ | 227 /* Arguments allocation */ \ |
| 228 \ | 228 V(CreateMappedArguments, AccumulatorUse::kWrite) \ |
| 229 /* Control Flow -- carefully ordered for efficient checks */ \ | 229 V(CreateUnmappedArguments, AccumulatorUse::kWrite) \ |
| 230 /* - [Unconditional jumps] */ \ | 230 V(CreateRestParameter, AccumulatorUse::kWrite) \ |
| 231 V(JumpLoop, AccumulatorUse::kNone, OperandType::kUImm, OperandType::kImm) \ | 231 \ |
| 232 /* - [Forward jumps] */ \ | 232 /* Control Flow -- carefully ordered for efficient checks */ \ |
| 233 V(Jump, AccumulatorUse::kNone, OperandType::kUImm) \ | 233 /* - [Unconditional jumps] */ \ |
| 234 /* - [Start constant jumps] */ \ | 234 V(JumpLoop, AccumulatorUse::kNone, OperandType::kUImm, OperandType::kImm) \ |
| 235 V(JumpConstant, AccumulatorUse::kNone, OperandType::kIdx) \ | 235 /* - [Forward jumps] */ \ |
| 236 /* - [Conditional jumps] */ \ | 236 V(Jump, AccumulatorUse::kNone, OperandType::kUImm) \ |
| 237 /* - [Conditional constant jumps] */ \ | 237 /* - [Start constant jumps] */ \ |
| 238 V(JumpIfNullConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 238 V(JumpConstant, AccumulatorUse::kNone, OperandType::kIdx) \ |
| 239 V(JumpIfUndefinedConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 239 /* - [Conditional jumps] */ \ |
| 240 V(JumpIfTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 240 /* - [Conditional constant jumps] */ \ |
| 241 V(JumpIfFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 241 V(JumpIfNullConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 242 V(JumpIfJSReceiverConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 242 V(JumpIfUndefinedConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 243 V(JumpIfNotHoleConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 243 V(JumpIfTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 244 /* - [Start ToBoolean jumps] */ \ | 244 V(JumpIfFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 245 V(JumpIfToBooleanTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 245 V(JumpIfJSReceiverConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 246 V(JumpIfToBooleanFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \ | 246 V(JumpIfNotHoleConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 247 /* - [End constant jumps] */ \ | 247 /* - [Start ToBoolean jumps] */ \ |
| 248 /* - [Conditional immediate jumps] */ \ | 248 V(JumpIfToBooleanTrueConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 249 V(JumpIfToBooleanTrue, AccumulatorUse::kRead, OperandType::kUImm) \ | 249 V(JumpIfToBooleanFalseConstant, AccumulatorUse::kRead, OperandType::kIdx) \ |
| 250 V(JumpIfToBooleanFalse, AccumulatorUse::kRead, OperandType::kUImm) \ | 250 /* - [End constant jumps] */ \ |
| 251 /* - [End ToBoolean jumps] */ \ | 251 /* - [Conditional immediate jumps] */ \ |
| 252 V(JumpIfTrue, AccumulatorUse::kRead, OperandType::kUImm) \ | 252 V(JumpIfToBooleanTrue, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 253 V(JumpIfFalse, AccumulatorUse::kRead, OperandType::kUImm) \ | 253 V(JumpIfToBooleanFalse, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 254 V(JumpIfNull, AccumulatorUse::kRead, OperandType::kUImm) \ | 254 /* - [End ToBoolean jumps] */ \ |
| 255 V(JumpIfUndefined, AccumulatorUse::kRead, OperandType::kUImm) \ | 255 V(JumpIfTrue, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 256 V(JumpIfJSReceiver, AccumulatorUse::kRead, OperandType::kUImm) \ | 256 V(JumpIfFalse, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 257 V(JumpIfNotHole, AccumulatorUse::kRead, OperandType::kUImm) \ | 257 V(JumpIfNull, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 258 \ | 258 V(JumpIfUndefined, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 259 /* Complex flow control For..in */ \ | 259 V(JumpIfJSReceiver, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 260 V(ForInPrepare, AccumulatorUse::kNone, OperandType::kReg, \ | 260 V(JumpIfNotHole, AccumulatorUse::kRead, OperandType::kUImm) \ |
| 261 OperandType::kRegOutTriple) \ | 261 \ |
| 262 V(ForInContinue, AccumulatorUse::kWrite, OperandType::kReg, \ | 262 /* Complex flow control For..in */ \ |
| 263 OperandType::kReg) \ | 263 V(ForInPrepare, AccumulatorUse::kNone, OperandType::kReg, \ |
| 264 V(ForInNext, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ | 264 OperandType::kRegOutTriple) \ |
| 265 OperandType::kRegPair, OperandType::kIdx) \ | 265 V(ForInContinue, AccumulatorUse::kWrite, OperandType::kReg, \ |
| 266 V(ForInStep, AccumulatorUse::kWrite, OperandType::kReg) \ | 266 OperandType::kReg) \ |
| 267 \ | 267 V(ForInNext, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ |
| 268 /* Perform a stack guard check */ \ | 268 OperandType::kRegPair, OperandType::kIdx) \ |
| 269 V(StackCheck, AccumulatorUse::kNone) \ | 269 V(ForInStep, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 270 \ | 270 \ |
| 271 /* Update the pending message */ \ | 271 /* Perform a stack guard check */ \ |
| 272 V(SetPendingMessage, AccumulatorUse::kReadWrite) \ | 272 V(StackCheck, AccumulatorUse::kNone) \ |
| 273 \ | 273 \ |
| 274 /* Non-local flow control */ \ | 274 /* Update the pending message */ \ |
| 275 V(Throw, AccumulatorUse::kRead) \ | 275 V(SetPendingMessage, AccumulatorUse::kReadWrite) \ |
| 276 V(ReThrow, AccumulatorUse::kRead) \ | 276 \ |
| 277 V(Return, AccumulatorUse::kRead) \ | 277 /* Non-local flow control */ \ |
| 278 \ | 278 V(Throw, AccumulatorUse::kRead) \ |
| 279 /* Generators */ \ | 279 V(ReThrow, AccumulatorUse::kRead) \ |
| 280 V(SuspendGenerator, AccumulatorUse::kRead, OperandType::kReg) \ | 280 V(Return, AccumulatorUse::kRead) \ |
| 281 V(ResumeGenerator, AccumulatorUse::kWrite, OperandType::kReg) \ | 281 \ |
| 282 \ | 282 /* Generators */ \ |
| 283 /* Debugger */ \ | 283 V(SuspendGenerator, AccumulatorUse::kRead, OperandType::kReg) \ |
| 284 V(Debugger, AccumulatorUse::kNone) \ | 284 V(ResumeGenerator, AccumulatorUse::kWrite, OperandType::kReg) \ |
| 285 \ | 285 \ |
| 286 /* Debug Breakpoints - one for each possible size of unscaled bytecodes */ \ | 286 /* Debugger */ \ |
| 287 /* and one for each operand widening prefix bytecode */ \ | 287 V(Debugger, AccumulatorUse::kNone) \ |
| 288 V(DebugBreak0, AccumulatorUse::kRead) \ | 288 \ |
| 289 V(DebugBreak1, AccumulatorUse::kRead, OperandType::kReg) \ | 289 /* Debug Breakpoints - one for each possible size of unscaled bytecodes */ \ |
| 290 V(DebugBreak2, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg) \ | 290 /* and one for each operand widening prefix bytecode */ \ |
| 291 V(DebugBreak3, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg, \ | 291 V(DebugBreak0, AccumulatorUse::kRead) \ |
| 292 OperandType::kReg) \ | 292 V(DebugBreak1, AccumulatorUse::kRead, OperandType::kReg) \ |
| 293 V(DebugBreak4, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg, \ | 293 V(DebugBreak2, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg) \ |
| 294 OperandType::kReg, OperandType::kReg) \ | 294 V(DebugBreak3, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg, \ |
| 295 V(DebugBreak5, AccumulatorUse::kRead, OperandType::kRuntimeId, \ | 295 OperandType::kReg) \ |
| 296 OperandType::kReg, OperandType::kReg) \ | 296 V(DebugBreak4, AccumulatorUse::kRead, OperandType::kReg, OperandType::kReg, \ |
| 297 V(DebugBreak6, AccumulatorUse::kRead, OperandType::kRuntimeId, \ | 297 OperandType::kReg, OperandType::kReg) \ |
| 298 OperandType::kReg, OperandType::kReg, OperandType::kReg) \ | 298 V(DebugBreak5, AccumulatorUse::kRead, OperandType::kRuntimeId, \ |
| 299 V(DebugBreakWide, AccumulatorUse::kRead) \ | 299 OperandType::kReg, OperandType::kReg) \ |
| 300 V(DebugBreakExtraWide, AccumulatorUse::kRead) \ | 300 V(DebugBreak6, AccumulatorUse::kRead, OperandType::kRuntimeId, \ |
| 301 \ | 301 OperandType::kReg, OperandType::kReg, OperandType::kReg) \ |
| 302 /* Illegal bytecode (terminates execution) */ \ | 302 V(DebugBreakWide, AccumulatorUse::kRead) \ |
| 303 V(Illegal, AccumulatorUse::kNone) \ | 303 V(DebugBreakExtraWide, AccumulatorUse::kRead) \ |
| 304 \ | 304 \ |
| 305 /* No operation (used to maintain source positions for peephole */ \ | 305 /* Illegal bytecode (terminates execution) */ \ |
| 306 /* eliminated bytecodes). */ \ | 306 V(Illegal, AccumulatorUse::kNone) \ |
| 307 \ |
| 308 /* No operation (used to maintain source positions for peephole */ \ |
| 309 /* eliminated bytecodes). */ \ |
| 307 V(Nop, AccumulatorUse::kNone) | 310 V(Nop, AccumulatorUse::kNone) |
| 308 | 311 |
| 309 // List of debug break bytecodes. | 312 // List of debug break bytecodes. |
| 310 #define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ | 313 #define DEBUG_BREAK_PLAIN_BYTECODE_LIST(V) \ |
| 311 V(DebugBreak0) \ | 314 V(DebugBreak0) \ |
| 312 V(DebugBreak1) \ | 315 V(DebugBreak1) \ |
| 313 V(DebugBreak2) \ | 316 V(DebugBreak2) \ |
| 314 V(DebugBreak3) \ | 317 V(DebugBreak3) \ |
| 315 V(DebugBreak4) \ | 318 V(DebugBreak4) \ |
| 316 V(DebugBreak5) \ | 319 V(DebugBreak5) \ |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Return true if |bytecode| is an accumulator load without effects, | 506 // Return true if |bytecode| is an accumulator load without effects, |
| 504 // e.g. LdaConstant, LdaTrue, Ldar. | 507 // e.g. LdaConstant, LdaTrue, Ldar. |
| 505 static constexpr bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) { | 508 static constexpr bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) { |
| 506 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kLdaZero || | 509 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kLdaZero || |
| 507 bytecode == Bytecode::kLdaSmi || bytecode == Bytecode::kLdaNull || | 510 bytecode == Bytecode::kLdaSmi || bytecode == Bytecode::kLdaNull || |
| 508 bytecode == Bytecode::kLdaTrue || bytecode == Bytecode::kLdaFalse || | 511 bytecode == Bytecode::kLdaTrue || bytecode == Bytecode::kLdaFalse || |
| 509 bytecode == Bytecode::kLdaUndefined || | 512 bytecode == Bytecode::kLdaUndefined || |
| 510 bytecode == Bytecode::kLdaTheHole || | 513 bytecode == Bytecode::kLdaTheHole || |
| 511 bytecode == Bytecode::kLdaConstant || | 514 bytecode == Bytecode::kLdaConstant || |
| 512 bytecode == Bytecode::kLdaContextSlot || | 515 bytecode == Bytecode::kLdaContextSlot || |
| 513 bytecode == Bytecode::kLdaCurrentContextSlot; | 516 bytecode == Bytecode::kLdaCurrentContextSlot || |
| 517 bytecode == Bytecode::kLdaImmutableContextSlot || |
| 518 bytecode == Bytecode::kLdaImmutableCurrentContextSlot; |
| 514 } | 519 } |
| 515 | 520 |
| 516 // Return true if |bytecode| is a register load without effects, | 521 // Return true if |bytecode| is a register load without effects, |
| 517 // e.g. Mov, Star. | 522 // e.g. Mov, Star. |
| 518 static constexpr bool IsRegisterLoadWithoutEffects(Bytecode bytecode) { | 523 static constexpr bool IsRegisterLoadWithoutEffects(Bytecode bytecode) { |
| 519 return bytecode == Bytecode::kMov || bytecode == Bytecode::kPopContext || | 524 return bytecode == Bytecode::kMov || bytecode == Bytecode::kPopContext || |
| 520 bytecode == Bytecode::kPushContext || bytecode == Bytecode::kStar; | 525 bytecode == Bytecode::kPushContext || bytecode == Bytecode::kStar; |
| 521 } | 526 } |
| 522 | 527 |
| 523 // Returns true if the bytecode is a conditional jump taking | 528 // Returns true if the bytecode is a conditional jump taking |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 }; | 823 }; |
| 819 | 824 |
| 820 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 825 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
| 821 const Bytecode& bytecode); | 826 const Bytecode& bytecode); |
| 822 | 827 |
| 823 } // namespace interpreter | 828 } // namespace interpreter |
| 824 } // namespace internal | 829 } // namespace internal |
| 825 } // namespace v8 | 830 } // namespace v8 |
| 826 | 831 |
| 827 #endif // V8_INTERPRETER_BYTECODES_H_ | 832 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |