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