OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 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 | 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_COMPILER_OPCODES_H_ | 5 #ifndef V8_COMPILER_OPCODES_H_ |
6 #define V8_COMPILER_OPCODES_H_ | 6 #define V8_COMPILER_OPCODES_H_ |
7 | 7 |
8 // Opcodes for control operators. | 8 // Opcodes for control operators. |
9 #define INNER_CONTROL_OP_LIST(V) \ | 9 #define INNER_CONTROL_OP_LIST(V) \ |
10 V(Dead) \ | 10 V(Dead) \ |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 #define DECLARE_OPCODE(x) k##x, | 261 #define DECLARE_OPCODE(x) k##x, |
262 ALL_OP_LIST(DECLARE_OPCODE) | 262 ALL_OP_LIST(DECLARE_OPCODE) |
263 #undef DECLARE_OPCODE | 263 #undef DECLARE_OPCODE |
264 kLast = -1 | 264 kLast = -1 |
265 #define COUNT_OPCODE(x) +1 | 265 #define COUNT_OPCODE(x) +1 |
266 ALL_OP_LIST(COUNT_OPCODE) | 266 ALL_OP_LIST(COUNT_OPCODE) |
267 #undef COUNT_OPCODE | 267 #undef COUNT_OPCODE |
268 }; | 268 }; |
269 | 269 |
270 // Returns the mnemonic name of an opcode. | 270 // Returns the mnemonic name of an opcode. |
271 static const char* Mnemonic(Value val) { | 271 static char const* Mnemonic(Value value); |
272 // TODO(turbofan): make this a table lookup. | |
273 switch (val) { | |
274 #define RETURN_NAME(x) \ | |
275 case k##x: \ | |
276 return #x; | |
277 ALL_OP_LIST(RETURN_NAME) | |
278 #undef RETURN_NAME | |
279 default: | |
280 return "UnknownOpcode"; | |
281 } | |
282 } | |
283 | 272 |
284 static bool IsJsOpcode(Value val) { | 273 static bool IsJsOpcode(Value val) { |
285 switch (val) { | 274 switch (val) { |
286 // TODO(turbofan): make this a range check. | 275 // TODO(turbofan): make this a range check. |
287 #define RETURN_NAME(x) \ | 276 #define RETURN_NAME(x) \ |
288 case k##x: \ | 277 case k##x: \ |
289 return true; | 278 return true; |
290 JS_OP_LIST(RETURN_NAME) | 279 JS_OP_LIST(RETURN_NAME) |
291 #undef RETURN_NAME | 280 #undef RETURN_NAME |
292 default: | 281 default: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return false; | 322 return false; |
334 } | 323 } |
335 } | 324 } |
336 }; | 325 }; |
337 | 326 |
338 } // namespace compiler | 327 } // namespace compiler |
339 } // namespace internal | 328 } // namespace internal |
340 } // namespace v8 | 329 } // namespace v8 |
341 | 330 |
342 #endif // V8_COMPILER_OPCODES_H_ | 331 #endif // V8_COMPILER_OPCODES_H_ |
OLD | NEW |