| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 ALL_OP_LIST(DECLARE_OPCODE) | 256 ALL_OP_LIST(DECLARE_OPCODE) |
| 257 #undef DECLARE_OPCODE | 257 #undef DECLARE_OPCODE |
| 258 kLast = -1 | 258 kLast = -1 |
| 259 #define COUNT_OPCODE(x) +1 | 259 #define COUNT_OPCODE(x) +1 |
| 260 ALL_OP_LIST(COUNT_OPCODE) | 260 ALL_OP_LIST(COUNT_OPCODE) |
| 261 #undef COUNT_OPCODE | 261 #undef COUNT_OPCODE |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 // Returns the mnemonic name of an opcode. | 264 // Returns the mnemonic name of an opcode. |
| 265 static const char* Mnemonic(Value val) { | 265 static const char* Mnemonic(Value val) { |
| 266 // TODO(turbofan): make this a table lookup. |
| 266 switch (val) { | 267 switch (val) { |
| 267 #define RETURN_NAME(x) \ | 268 #define RETURN_NAME(x) \ |
| 268 case k##x: \ | 269 case k##x: \ |
| 269 return #x; | 270 return #x; |
| 270 ALL_OP_LIST(RETURN_NAME) | 271 ALL_OP_LIST(RETURN_NAME) |
| 271 #undef RETURN_NAME | 272 #undef RETURN_NAME |
| 272 default: | 273 default: |
| 273 return "UnknownOpcode"; | 274 return "UnknownOpcode"; |
| 274 } | 275 } |
| 275 } | 276 } |
| 276 | 277 |
| 277 static bool IsJsOpcode(Value val) { | 278 static bool IsJsOpcode(Value val) { |
| 278 switch (val) { | 279 switch (val) { |
| 280 // TODO(turbofan): make this a range check. |
| 279 #define RETURN_NAME(x) \ | 281 #define RETURN_NAME(x) \ |
| 280 case k##x: \ | 282 case k##x: \ |
| 281 return true; | 283 return true; |
| 282 JS_OP_LIST(RETURN_NAME) | 284 JS_OP_LIST(RETURN_NAME) |
| 283 #undef RETURN_NAME | 285 #undef RETURN_NAME |
| 284 default: | 286 default: |
| 285 return false; | 287 return false; |
| 286 } | 288 } |
| 287 } | 289 } |
| 288 | 290 |
| 289 static bool IsControlOpcode(Value val) { | 291 static bool IsControlOpcode(Value val) { |
| 290 switch (val) { | 292 switch (val) { |
| 293 // TODO(turbofan): make this a range check. |
| 291 #define RETURN_NAME(x) \ | 294 #define RETURN_NAME(x) \ |
| 292 case k##x: \ | 295 case k##x: \ |
| 293 return true; | 296 return true; |
| 294 CONTROL_OP_LIST(RETURN_NAME) | 297 CONTROL_OP_LIST(RETURN_NAME) |
| 295 #undef RETURN_NAME | 298 #undef RETURN_NAME |
| 296 default: | 299 default: |
| 297 return false; | 300 return false; |
| 298 } | 301 } |
| 299 } | 302 } |
| 300 | 303 |
| 301 static bool IsLeafOpcode(Value val) { | 304 static bool IsLeafOpcode(Value val) { |
| 302 switch (val) { | 305 switch (val) { |
| 306 // TODO(turbofan): make this a table lookup. |
| 303 #define RETURN_NAME(x) \ | 307 #define RETURN_NAME(x) \ |
| 304 case k##x: \ | 308 case k##x: \ |
| 305 return true; | 309 return true; |
| 306 LEAF_OP_LIST(RETURN_NAME) | 310 LEAF_OP_LIST(RETURN_NAME) |
| 307 #undef RETURN_NAME | 311 #undef RETURN_NAME |
| 308 default: | 312 default: |
| 309 return false; | 313 return false; |
| 310 } | 314 } |
| 311 } | 315 } |
| 312 | 316 |
| 313 static bool IsCommonOpcode(Value val) { | 317 static bool IsCommonOpcode(Value val) { |
| 314 switch (val) { | 318 switch (val) { |
| 319 // TODO(turbofan): make this a table lookup or a range check. |
| 315 #define RETURN_NAME(x) \ | 320 #define RETURN_NAME(x) \ |
| 316 case k##x: \ | 321 case k##x: \ |
| 317 return true; | 322 return true; |
| 318 CONTROL_OP_LIST(RETURN_NAME) | 323 CONTROL_OP_LIST(RETURN_NAME) |
| 319 COMMON_OP_LIST(RETURN_NAME) | 324 COMMON_OP_LIST(RETURN_NAME) |
| 320 #undef RETURN_NAME | 325 #undef RETURN_NAME |
| 321 default: | 326 default: |
| 322 return false; | 327 return false; |
| 323 } | 328 } |
| 324 } | 329 } |
| 325 }; | 330 }; |
| 326 | 331 |
| 327 } // namespace compiler | 332 } // namespace compiler |
| 328 } // namespace internal | 333 } // namespace internal |
| 329 } // namespace v8 | 334 } // namespace v8 |
| 330 | 335 |
| 331 #endif // V8_COMPILER_OPCODES_H_ | 336 #endif // V8_COMPILER_OPCODES_H_ |
| OLD | NEW |