Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: src/compiler/opcodes.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/node-properties-inl.h ('k') | src/compiler/operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_COMPILER_OPCODES_H_
6 #define V8_COMPILER_OPCODES_H_
7
8 // Opcodes for control operators.
9 #define CONTROL_OP_LIST(V) \
10 V(Start) \
11 V(Dead) \
12 V(Loop) \
13 V(End) \
14 V(Branch) \
15 V(IfTrue) \
16 V(IfFalse) \
17 V(Merge) \
18 V(Return) \
19 V(Throw) \
20 V(Continuation) \
21 V(LazyDeoptimization) \
22 V(Deoptimize)
23
24 // Opcodes for common operators.
25 #define LEAF_OP_LIST(V) \
26 V(Parameter) \
27 V(Int32Constant) \
28 V(Int64Constant) \
29 V(Float64Constant) \
30 V(ExternalConstant) \
31 V(NumberConstant) \
32 V(HeapConstant)
33
34 #define INNER_OP_LIST(V) \
35 V(Phi) \
36 V(EffectPhi) \
37 V(FrameState) \
38 V(Call) \
39 V(Projection)
40
41 #define COMMON_OP_LIST(V) \
42 LEAF_OP_LIST(V) \
43 INNER_OP_LIST(V)
44
45 // Opcodes for JavaScript operators.
46 #define JS_COMPARE_BINOP_LIST(V) \
47 V(JSEqual) \
48 V(JSNotEqual) \
49 V(JSStrictEqual) \
50 V(JSStrictNotEqual) \
51 V(JSLessThan) \
52 V(JSGreaterThan) \
53 V(JSLessThanOrEqual) \
54 V(JSGreaterThanOrEqual)
55
56 #define JS_BITWISE_BINOP_LIST(V) \
57 V(JSBitwiseOr) \
58 V(JSBitwiseXor) \
59 V(JSBitwiseAnd) \
60 V(JSShiftLeft) \
61 V(JSShiftRight) \
62 V(JSShiftRightLogical)
63
64 #define JS_ARITH_BINOP_LIST(V) \
65 V(JSAdd) \
66 V(JSSubtract) \
67 V(JSMultiply) \
68 V(JSDivide) \
69 V(JSModulus)
70
71 #define JS_SIMPLE_BINOP_LIST(V) \
72 JS_COMPARE_BINOP_LIST(V) \
73 JS_BITWISE_BINOP_LIST(V) \
74 JS_ARITH_BINOP_LIST(V)
75
76 #define JS_LOGIC_UNOP_LIST(V) V(JSUnaryNot)
77
78 #define JS_CONVERSION_UNOP_LIST(V) \
79 V(JSToBoolean) \
80 V(JSToNumber) \
81 V(JSToString) \
82 V(JSToName) \
83 V(JSToObject)
84
85 #define JS_OTHER_UNOP_LIST(V) V(JSTypeOf)
86
87 #define JS_SIMPLE_UNOP_LIST(V) \
88 JS_LOGIC_UNOP_LIST(V) \
89 JS_CONVERSION_UNOP_LIST(V) \
90 JS_OTHER_UNOP_LIST(V)
91
92 #define JS_OBJECT_OP_LIST(V) \
93 V(JSCreate) \
94 V(JSLoadProperty) \
95 V(JSLoadNamed) \
96 V(JSStoreProperty) \
97 V(JSStoreNamed) \
98 V(JSDeleteProperty) \
99 V(JSHasProperty) \
100 V(JSInstanceOf)
101
102 #define JS_CONTEXT_OP_LIST(V) \
103 V(JSLoadContext) \
104 V(JSStoreContext) \
105 V(JSCreateFunctionContext) \
106 V(JSCreateCatchContext) \
107 V(JSCreateWithContext) \
108 V(JSCreateBlockContext) \
109 V(JSCreateModuleContext) \
110 V(JSCreateGlobalContext)
111
112 #define JS_OTHER_OP_LIST(V) \
113 V(JSCallConstruct) \
114 V(JSCallFunction) \
115 V(JSCallRuntime) \
116 V(JSYield) \
117 V(JSDebugger)
118
119 #define JS_OP_LIST(V) \
120 JS_SIMPLE_BINOP_LIST(V) \
121 JS_SIMPLE_UNOP_LIST(V) \
122 JS_OBJECT_OP_LIST(V) \
123 JS_CONTEXT_OP_LIST(V) \
124 JS_OTHER_OP_LIST(V)
125
126 // Opcodes for VirtuaMachine-level operators.
127 #define SIMPLIFIED_OP_LIST(V) \
128 V(BooleanNot) \
129 V(NumberEqual) \
130 V(NumberLessThan) \
131 V(NumberLessThanOrEqual) \
132 V(NumberAdd) \
133 V(NumberSubtract) \
134 V(NumberMultiply) \
135 V(NumberDivide) \
136 V(NumberModulus) \
137 V(NumberToInt32) \
138 V(NumberToUint32) \
139 V(ReferenceEqual) \
140 V(StringEqual) \
141 V(StringLessThan) \
142 V(StringLessThanOrEqual) \
143 V(StringAdd) \
144 V(ChangeTaggedToInt32) \
145 V(ChangeTaggedToUint32) \
146 V(ChangeTaggedToFloat64) \
147 V(ChangeInt32ToTagged) \
148 V(ChangeUint32ToTagged) \
149 V(ChangeFloat64ToTagged) \
150 V(ChangeBoolToBit) \
151 V(ChangeBitToBool) \
152 V(LoadField) \
153 V(LoadElement) \
154 V(StoreField) \
155 V(StoreElement)
156
157 // Opcodes for Machine-level operators.
158 #define MACHINE_OP_LIST(V) \
159 V(Load) \
160 V(Store) \
161 V(Word32And) \
162 V(Word32Or) \
163 V(Word32Xor) \
164 V(Word32Shl) \
165 V(Word32Shr) \
166 V(Word32Sar) \
167 V(Word32Equal) \
168 V(Word64And) \
169 V(Word64Or) \
170 V(Word64Xor) \
171 V(Word64Shl) \
172 V(Word64Shr) \
173 V(Word64Sar) \
174 V(Word64Equal) \
175 V(Int32Add) \
176 V(Int32Sub) \
177 V(Int32Mul) \
178 V(Int32Div) \
179 V(Int32UDiv) \
180 V(Int32Mod) \
181 V(Int32UMod) \
182 V(Int32LessThan) \
183 V(Int32LessThanOrEqual) \
184 V(Uint32LessThan) \
185 V(Uint32LessThanOrEqual) \
186 V(Int64Add) \
187 V(Int64Sub) \
188 V(Int64Mul) \
189 V(Int64Div) \
190 V(Int64UDiv) \
191 V(Int64Mod) \
192 V(Int64UMod) \
193 V(Int64LessThan) \
194 V(Int64LessThanOrEqual) \
195 V(ConvertInt64ToInt32) \
196 V(ConvertInt32ToInt64) \
197 V(ConvertInt32ToFloat64) \
198 V(ConvertUint32ToFloat64) \
199 V(ConvertFloat64ToInt32) \
200 V(ConvertFloat64ToUint32) \
201 V(Float64Add) \
202 V(Float64Sub) \
203 V(Float64Mul) \
204 V(Float64Div) \
205 V(Float64Mod) \
206 V(Float64Equal) \
207 V(Float64LessThan) \
208 V(Float64LessThanOrEqual)
209
210 #define VALUE_OP_LIST(V) \
211 COMMON_OP_LIST(V) \
212 SIMPLIFIED_OP_LIST(V) \
213 MACHINE_OP_LIST(V) \
214 JS_OP_LIST(V)
215
216 // The combination of all operators at all levels and the common operators.
217 #define ALL_OP_LIST(V) \
218 CONTROL_OP_LIST(V) \
219 VALUE_OP_LIST(V)
220
221 namespace v8 {
222 namespace internal {
223 namespace compiler {
224
225 // Declare an enumeration with all the opcodes at all levels so that they
226 // can be globally, uniquely numbered.
227 class IrOpcode {
228 public:
229 enum Value {
230 #define DECLARE_OPCODE(x) k##x,
231 ALL_OP_LIST(DECLARE_OPCODE)
232 #undef DECLARE_OPCODE
233 kLast = -1
234 #define COUNT_OPCODE(x) +1
235 ALL_OP_LIST(COUNT_OPCODE)
236 #undef COUNT_OPCODE
237 };
238
239 // Returns the mnemonic name of an opcode.
240 static const char* Mnemonic(Value val) {
241 switch (val) {
242 #define RETURN_NAME(x) \
243 case k##x: \
244 return #x;
245 ALL_OP_LIST(RETURN_NAME)
246 #undef RETURN_NAME
247 default:
248 return "UnknownOpcode";
249 }
250 }
251
252 static bool IsJsOpcode(Value val) {
253 switch (val) {
254 #define RETURN_NAME(x) \
255 case k##x: \
256 return true;
257 JS_OP_LIST(RETURN_NAME)
258 #undef RETURN_NAME
259 default:
260 return false;
261 }
262 }
263
264 static bool IsControlOpcode(Value val) {
265 switch (val) {
266 #define RETURN_NAME(x) \
267 case k##x: \
268 return true;
269 CONTROL_OP_LIST(RETURN_NAME)
270 #undef RETURN_NAME
271 default:
272 return false;
273 }
274 }
275
276 static bool IsCommonOpcode(Value val) {
277 switch (val) {
278 #define RETURN_NAME(x) \
279 case k##x: \
280 return true;
281 CONTROL_OP_LIST(RETURN_NAME)
282 COMMON_OP_LIST(RETURN_NAME)
283 #undef RETURN_NAME
284 default:
285 return false;
286 }
287 }
288 };
289
290 } // namespace compiler
291 } // namespace internal
292 } // namespace v8
293
294 #endif // V8_COMPILER_OPCODES_H_
OLDNEW
« no previous file with comments | « src/compiler/node-properties-inl.h ('k') | src/compiler/operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698