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