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

Unified Diff: test/unittests/compiler/opcodes-unittest.cc

Issue 951903003: [turbofan] Strength reduction for inline comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « test/unittests/compiler/machine-operator-reducer-unittest.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) \
« no previous file with comments | « test/unittests/compiler/machine-operator-reducer-unittest.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698