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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/compiler/opcodes.h" 5 #include "src/compiler/opcodes.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 case IrOpcode::k##Opcode: \ 57 case IrOpcode::k##Opcode: \
58 return true; 58 return true;
59 CONSTANT_OP_LIST(OPCODE) 59 CONSTANT_OP_LIST(OPCODE)
60 #undef OPCODE 60 #undef OPCODE
61 default: 61 default:
62 return false; 62 return false;
63 } 63 }
64 } 64 }
65 65
66 66
67 bool IsComparisonOpcode(IrOpcode::Value opcode) {
68 switch (opcode) {
69 #define OPCODE(Opcode) \
70 case IrOpcode::k##Opcode: \
71 return true;
72 JS_COMPARE_BINOP_LIST(OPCODE)
73 SIMPLIFIED_COMPARE_BINOP_LIST(OPCODE)
74 MACHINE_COMPARE_BINOP_LIST(OPCODE)
75 #undef OPCODE
76 default:
77 return false;
78 }
79 }
80
81
67 const IrOpcode::Value kInvalidOpcode = static_cast<IrOpcode::Value>(123456789); 82 const IrOpcode::Value kInvalidOpcode = static_cast<IrOpcode::Value>(123456789);
68 83
69 } // namespace 84 } // namespace
70 85
71 86
72 TEST(IrOpcodeTest, IsCommonOpcode) { 87 TEST(IrOpcodeTest, IsCommonOpcode) {
73 EXPECT_FALSE(IrOpcode::IsCommonOpcode(kInvalidOpcode)); 88 EXPECT_FALSE(IrOpcode::IsCommonOpcode(kInvalidOpcode));
74 #define OPCODE(Opcode) \ 89 #define OPCODE(Opcode) \
75 EXPECT_EQ(IsCommonOpcode(IrOpcode::k##Opcode), \ 90 EXPECT_EQ(IsCommonOpcode(IrOpcode::k##Opcode), \
76 IrOpcode::IsCommonOpcode(IrOpcode::k##Opcode)); 91 IrOpcode::IsCommonOpcode(IrOpcode::k##Opcode));
(...skipping 25 matching lines...) Expand all
102 TEST(IrOpcodeTest, IsConstantOpcode) { 117 TEST(IrOpcodeTest, IsConstantOpcode) {
103 EXPECT_FALSE(IrOpcode::IsConstantOpcode(kInvalidOpcode)); 118 EXPECT_FALSE(IrOpcode::IsConstantOpcode(kInvalidOpcode));
104 #define OPCODE(Opcode) \ 119 #define OPCODE(Opcode) \
105 EXPECT_EQ(IsConstantOpcode(IrOpcode::k##Opcode), \ 120 EXPECT_EQ(IsConstantOpcode(IrOpcode::k##Opcode), \
106 IrOpcode::IsConstantOpcode(IrOpcode::k##Opcode)); 121 IrOpcode::IsConstantOpcode(IrOpcode::k##Opcode));
107 ALL_OP_LIST(OPCODE) 122 ALL_OP_LIST(OPCODE)
108 #undef OPCODE 123 #undef OPCODE
109 } 124 }
110 125
111 126
127 TEST(IrOpcodeTest, IsComparisonOpcode) {
128 EXPECT_FALSE(IrOpcode::IsComparisonOpcode(kInvalidOpcode));
129 #define OPCODE(Opcode) \
130 EXPECT_EQ(IsComparisonOpcode(IrOpcode::k##Opcode), \
131 IrOpcode::IsComparisonOpcode(IrOpcode::k##Opcode));
132 ALL_OP_LIST(OPCODE)
133 #undef OPCODE
134 }
135
136
112 TEST(IrOpcodeTest, Mnemonic) { 137 TEST(IrOpcodeTest, Mnemonic) {
113 EXPECT_STREQ("UnknownOpcode", IrOpcode::Mnemonic(kInvalidOpcode)); 138 EXPECT_STREQ("UnknownOpcode", IrOpcode::Mnemonic(kInvalidOpcode));
114 #define OPCODE(Opcode) \ 139 #define OPCODE(Opcode) \
115 EXPECT_STREQ(#Opcode, IrOpcode::Mnemonic(IrOpcode::k##Opcode)); 140 EXPECT_STREQ(#Opcode, IrOpcode::Mnemonic(IrOpcode::k##Opcode));
116 ALL_OP_LIST(OPCODE) 141 ALL_OP_LIST(OPCODE)
117 #undef OPCODE 142 #undef OPCODE
118 } 143 }
119 144
120 } // namespace compiler 145 } // namespace compiler
121 } // namespace internal 146 } // namespace internal
122 } // namespace v8 147 } // namespace v8
OLDNEW
« 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