Index: test/unittests/compiler/opcodes-unittest.cc |
diff --git a/test/unittests/compiler/opcodes-unittest.cc b/test/unittests/compiler/opcodes-unittest.cc |
index ca79e8ac8b6e33099d5d18e5f386ecc5ecb72db3..3bb65c2e13b025f9fc8ba455ba98ff143624cf73 100644 |
--- a/test/unittests/compiler/opcodes-unittest.cc |
+++ b/test/unittests/compiler/opcodes-unittest.cc |
@@ -64,6 +64,21 @@ bool IsConstantOpcode(IrOpcode::Value opcode) { |
} |
+bool IsComparisonOpcode(IrOpcode::Value opcode) { |
+ switch (opcode) { |
+#define OPCODE(Opcode) \ |
+ case IrOpcode::k##Opcode: \ |
+ return true; |
+ JS_COMPARE_BINOP_LIST(OPCODE) |
+ SIMPLIFIED_COMPARE_BINOP_LIST(OPCODE) |
+ MACHINE_COMPARE_BINOP_LIST(OPCODE) |
+#undef OPCODE |
+ default: |
+ return false; |
+ } |
+} |
+ |
+ |
const IrOpcode::Value kInvalidOpcode = static_cast<IrOpcode::Value>(123456789); |
} // namespace |
@@ -109,6 +124,16 @@ TEST(IrOpcodeTest, IsConstantOpcode) { |
} |
+TEST(IrOpcodeTest, IsComparisonOpcode) { |
+ EXPECT_FALSE(IrOpcode::IsComparisonOpcode(kInvalidOpcode)); |
+#define OPCODE(Opcode) \ |
+ EXPECT_EQ(IsComparisonOpcode(IrOpcode::k##Opcode), \ |
+ IrOpcode::IsComparisonOpcode(IrOpcode::k##Opcode)); |
+ ALL_OP_LIST(OPCODE) |
+#undef OPCODE |
+} |
+ |
+ |
TEST(IrOpcodeTest, Mnemonic) { |
EXPECT_STREQ("UnknownOpcode", IrOpcode::Mnemonic(kInvalidOpcode)); |
#define OPCODE(Opcode) \ |