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