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

Unified Diff: src/compiler/opcodes.h

Issue 807573004: [turbofan] Turn IrOpcode::IsXXX() into range checks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/unittests/compiler/opcodes-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/opcodes.h
diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h
index b7a2f6b51ba22c1e6bad7403407c77c3781fc91f..fa85974c0136e2ff46b8dcb2007efc75bfed89b3 100644
--- a/src/compiler/opcodes.h
+++ b/src/compiler/opcodes.h
@@ -275,57 +275,24 @@ class IrOpcode {
// Returns the mnemonic name of an opcode.
static char const* Mnemonic(Value value);
- static bool IsJsOpcode(Value val) {
- switch (val) {
-// TODO(turbofan): make this a range check.
-#define RETURN_NAME(x) \
- case k##x: \
- return true;
- JS_OP_LIST(RETURN_NAME)
-#undef RETURN_NAME
- default:
- return false;
- }
+ // Returns true if opcode for common operator.
+ static bool IsCommonOpcode(Value value) {
+ return kDead <= value && value <= kProjection;
}
- static bool IsControlOpcode(Value val) {
- switch (val) {
-// TODO(turbofan): make this a range check.
-#define RETURN_NAME(x) \
- case k##x: \
- return true;
- CONTROL_OP_LIST(RETURN_NAME)
-#undef RETURN_NAME
- default:
- return false;
- }
+ // Returns true if opcode for control operator.
+ static bool IsControlOpcode(Value value) {
+ return kDead <= value && value <= kEnd;
}
- static bool IsLeafOpcode(Value val) {
- switch (val) {
-// TODO(turbofan): make this a table lookup.
-#define RETURN_NAME(x) \
- case k##x: \
- return true;
- LEAF_OP_LIST(RETURN_NAME)
-#undef RETURN_NAME
- default:
- return false;
- }
+ // Returns true if opcode for JavaScript operator.
+ static bool IsJsOpcode(Value value) {
+ return kJSEqual <= value && value <= kJSDebugger;
}
- static bool IsCommonOpcode(Value val) {
- switch (val) {
-// TODO(turbofan): make this a table lookup or a range check.
-#define RETURN_NAME(x) \
- case k##x: \
- return true;
- CONTROL_OP_LIST(RETURN_NAME)
- COMMON_OP_LIST(RETURN_NAME)
-#undef RETURN_NAME
- default:
- return false;
- }
+ // Returns true if opcode for leaf operator.
+ static bool IsLeafOpcode(Value value) {
+ return kInt32Constant <= value && value <= kHeapConstant;
}
};
« no previous file with comments | « no previous file | test/unittests/compiler/opcodes-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698