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

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: 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
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) \
77 V(JSUnaryNot)
78
79 #define JS_CONVERSION_UNOP_LIST(V) \
80 V(JSToBoolean) \
81 V(JSToNumber) \
82 V(JSToString) \
83 V(JSToName) \
84 V(JSToObject)
85
86 #define JS_OTHER_UNOP_LIST(V) \
87 V(JSTypeOf)
88
89 #define JS_SIMPLE_UNOP_LIST(V) \
90 JS_LOGIC_UNOP_LIST(V) \
91 JS_CONVERSION_UNOP_LIST(V) \
92 JS_OTHER_UNOP_LIST(V)
93
94 #define JS_OBJECT_OP_LIST(V) \
95 V(JSCreate) \
96 V(JSLoadProperty) \
97 V(JSLoadNamed) \
98 V(JSStoreProperty) \
99 V(JSStoreNamed) \
100 V(JSDeleteProperty) \
101 V(JSHasProperty) \
102 V(JSInstanceOf)
103
104 #define JS_CONTEXT_OP_LIST(V) \
105 V(JSLoadContext) \
106 V(JSStoreContext) \
107 V(JSCreateFunctionContext) \
108 V(JSCreateCatchContext) \
109 V(JSCreateWithContext) \
110 V(JSCreateBlockContext) \
111 V(JSCreateModuleContext) \
112 V(JSCreateGlobalContext)
113
114 #define JS_OTHER_OP_LIST(V) \
115 V(JSCallConstruct) \
116 V(JSCallFunction) \
117 V(JSCallRuntime) \
118 V(JSYield) \
119 V(JSDebugger)
120
121 #define JS_OP_LIST(V) \
122 JS_SIMPLE_BINOP_LIST(V) \
123 JS_SIMPLE_UNOP_LIST(V) \
124 JS_OBJECT_OP_LIST(V) \
125 JS_CONTEXT_OP_LIST(V) \
126 JS_OTHER_OP_LIST(V)
127
128 // Opcodes for VirtuaMachine-level operators.
129 #define SIMPLIFIED_OP_LIST(V) \
130 V(BooleanNot) \
131 V(NumberEqual) \
132 V(NumberLessThan) \
133 V(NumberLessThanOrEqual) \
134 V(NumberAdd) \
135 V(NumberSubtract) \
136 V(NumberMultiply) \
137 V(NumberDivide) \
138 V(NumberModulus) \
139 V(NumberToInt32) \
140 V(NumberToUint32) \
141 V(ReferenceEqual) \
142 V(StringEqual) \
143 V(StringLessThan) \
144 V(StringLessThanOrEqual) \
145 V(StringAdd) \
146 V(ChangeTaggedToInt32) \
147 V(ChangeTaggedToUint32) \
148 V(ChangeTaggedToFloat64) \
149 V(ChangeInt32ToTagged) \
150 V(ChangeUint32ToTagged) \
151 V(ChangeFloat64ToTagged) \
152 V(ChangeBoolToBit) \
153 V(ChangeBitToBool) \
154 V(LoadField) \
155 V(LoadElement) \
156 V(StoreField) \
157 V(StoreElement)
158
159 // Opcodes for Machine-level operators.
160 #define MACHINE_OP_LIST(V) \
161 V(Load) \
162 V(Store) \
163 V(Word32And) \
164 V(Word32Or) \
165 V(Word32Xor) \
166 V(Word32Shl) \
167 V(Word32Shr) \
168 V(Word32Sar) \
169 V(Word32Equal) \
170 V(Word64And) \
171 V(Word64Or) \
172 V(Word64Xor) \
173 V(Word64Shl) \
174 V(Word64Shr) \
175 V(Word64Sar) \
176 V(Word64Equal) \
177 V(Int32Add) \
178 V(Int32Sub) \
179 V(Int32Mul) \
180 V(Int32Div) \
181 V(Int32UDiv) \
182 V(Int32Mod) \
183 V(Int32UMod) \
184 V(Int32LessThan) \
185 V(Int32LessThanOrEqual) \
186 V(Uint32LessThan) \
187 V(Uint32LessThanOrEqual) \
188 V(Int64Add) \
189 V(Int64Sub) \
190 V(Int64Mul) \
191 V(Int64Div) \
192 V(Int64UDiv) \
193 V(Int64Mod) \
194 V(Int64UMod) \
195 V(Int64LessThan) \
196 V(Int64LessThanOrEqual) \
197 V(ConvertInt64ToInt32) \
198 V(ConvertInt32ToInt64) \
199 V(ConvertInt32ToFloat64) \
200 V(ConvertUint32ToFloat64) \
201 V(ConvertFloat64ToInt32) \
202 V(ConvertFloat64ToUint32) \
203 V(Float64Add) \
204 V(Float64Sub) \
205 V(Float64Mul) \
206 V(Float64Div) \
207 V(Float64Mod) \
208 V(Float64Equal) \
209 V(Float64LessThan) \
210 V(Float64LessThanOrEqual)
211
212 #define VALUE_OP_LIST(V) \
213 COMMON_OP_LIST(V) \
214 SIMPLIFIED_OP_LIST(V) \
215 MACHINE_OP_LIST(V) \
216 JS_OP_LIST(V)
217
218 // The combination of all operators at all levels and the common operators.
219 #define ALL_OP_LIST(V) \
220 CONTROL_OP_LIST(V) \
221 VALUE_OP_LIST(V)
222
223 namespace v8 {
224 namespace internal {
225 namespace compiler {
226
227 // Declare an enumeration with all the opcodes at all levels so that they
228 // can be globally, uniquely numbered.
229 class IrOpcode {
230 public:
231 enum Value {
232 #define DECLARE_OPCODE(x) k##x,
233 ALL_OP_LIST(DECLARE_OPCODE)
234 #undef DECLARE_OPCODE
235 kLast = -1
236 #define COUNT_OPCODE(x) + 1
237 ALL_OP_LIST(COUNT_OPCODE)
238 #undef COUNT_OPCODE
239 };
240
241 // Returns the mnemonic name of an opcode.
242 static const char* Mnemonic(Value val) {
243 switch (val) {
244 #define RETURN_NAME(x) case k##x: 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) case k##x: return true;
255 JS_OP_LIST(RETURN_NAME)
256 #undef RETURN_NAME
257 default:
258 return false;
259 }
260 }
261
262 static bool IsControlOpcode(Value val) {
263 switch (val) {
264 #define RETURN_NAME(x) case k##x: return true;
265 CONTROL_OP_LIST(RETURN_NAME)
266 #undef RETURN_NAME
267 default:
268 return false;
269 }
270 }
271
272 static bool IsCommonOpcode(Value val) {
273 switch (val) {
274 #define RETURN_NAME(x) case k##x: return true;
275 CONTROL_OP_LIST(RETURN_NAME)
276 COMMON_OP_LIST(RETURN_NAME)
277 #undef RETURN_NAME
278 default:
279 return false;
280 }
281 }
282 };
283
284 } // namespace compiler
285 } // namespace internal
286 } // namespace v8
287
288 #endif // V8_COMPILER_OPCODES_H_
OLDNEW
« no previous file with comments | « src/compiler/node-properties-inl.h ('k') | src/compiler/operator.h » ('j') | src/lithium-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698