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

Side by Side Diff: test/unittests/compiler/simplified-operator-unittest.cc

Issue 686213002: Inline trivial OperatorProperties methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « test/unittests/compiler/machine-operator-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/compiler/operator-properties-inl.h" 7 #include "src/compiler/operator-properties-inl.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 SimplifiedOperatorBuilder simplified2(zone()); 76 SimplifiedOperatorBuilder simplified2(zone());
77 EXPECT_EQ((simplified1.*pop.constructor)(), (simplified2.*pop.constructor)()); 77 EXPECT_EQ((simplified1.*pop.constructor)(), (simplified2.*pop.constructor)());
78 } 78 }
79 79
80 80
81 TEST_P(SimplifiedPureOperatorTest, NumberOfInputsAndOutputs) { 81 TEST_P(SimplifiedPureOperatorTest, NumberOfInputsAndOutputs) {
82 SimplifiedOperatorBuilder simplified(zone()); 82 SimplifiedOperatorBuilder simplified(zone());
83 const PureOperator& pop = GetParam(); 83 const PureOperator& pop = GetParam();
84 const Operator* op = (simplified.*pop.constructor)(); 84 const Operator* op = (simplified.*pop.constructor)();
85 85
86 EXPECT_EQ(pop.value_input_count, OperatorProperties::GetValueInputCount(op)); 86 EXPECT_EQ(pop.value_input_count, op->ValueInputCount());
87 EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op)); 87 EXPECT_EQ(0, op->EffectInputCount());
88 EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op)); 88 EXPECT_EQ(0, op->ControlInputCount());
89 EXPECT_EQ(pop.value_input_count, OperatorProperties::GetTotalInputCount(op)); 89 EXPECT_EQ(pop.value_input_count, OperatorProperties::GetTotalInputCount(op));
90 90
91 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 91 EXPECT_EQ(1, op->ValueOutputCount());
92 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 92 EXPECT_EQ(0, op->EffectOutputCount());
93 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 93 EXPECT_EQ(0, op->ControlOutputCount());
94 } 94 }
95 95
96 96
97 TEST_P(SimplifiedPureOperatorTest, OpcodeIsCorrect) { 97 TEST_P(SimplifiedPureOperatorTest, OpcodeIsCorrect) {
98 SimplifiedOperatorBuilder simplified(zone()); 98 SimplifiedOperatorBuilder simplified(zone());
99 const PureOperator& pop = GetParam(); 99 const PureOperator& pop = GetParam();
100 const Operator* op = (simplified.*pop.constructor)(); 100 const Operator* op = (simplified.*pop.constructor)();
101 EXPECT_EQ(pop.opcode, op->opcode()); 101 EXPECT_EQ(pop.opcode, op->opcode());
102 } 102 }
103 103
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { 169 TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) {
170 SimplifiedOperatorBuilder simplified(zone()); 170 SimplifiedOperatorBuilder simplified(zone());
171 const ElementAccess& access = GetParam(); 171 const ElementAccess& access = GetParam();
172 const Operator* op = simplified.LoadElement(access); 172 const Operator* op = simplified.LoadElement(access);
173 173
174 EXPECT_EQ(IrOpcode::kLoadElement, op->opcode()); 174 EXPECT_EQ(IrOpcode::kLoadElement, op->opcode());
175 EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties()); 175 EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties());
176 EXPECT_EQ(access, ElementAccessOf(op)); 176 EXPECT_EQ(access, ElementAccessOf(op));
177 177
178 EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op)); 178 EXPECT_EQ(3, op->ValueInputCount());
179 EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op)); 179 EXPECT_EQ(1, op->EffectInputCount());
180 EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op)); 180 EXPECT_EQ(0, op->ControlInputCount());
181 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op)); 181 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
182 182
183 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 183 EXPECT_EQ(1, op->ValueOutputCount());
184 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); 184 EXPECT_EQ(1, op->EffectOutputCount());
185 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 185 EXPECT_EQ(0, op->ControlOutputCount());
186 } 186 }
187 187
188 188
189 TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) { 189 TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) {
190 SimplifiedOperatorBuilder simplified(zone()); 190 SimplifiedOperatorBuilder simplified(zone());
191 const ElementAccess& access = GetParam(); 191 const ElementAccess& access = GetParam();
192 const Operator* op = simplified.StoreElement(access); 192 const Operator* op = simplified.StoreElement(access);
193 193
194 EXPECT_EQ(IrOpcode::kStoreElement, op->opcode()); 194 EXPECT_EQ(IrOpcode::kStoreElement, op->opcode());
195 EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties()); 195 EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties());
196 EXPECT_EQ(access, ElementAccessOf(op)); 196 EXPECT_EQ(access, ElementAccessOf(op));
197 197
198 EXPECT_EQ(4, OperatorProperties::GetValueInputCount(op)); 198 EXPECT_EQ(4, op->ValueInputCount());
199 EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op)); 199 EXPECT_EQ(1, op->EffectInputCount());
200 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); 200 EXPECT_EQ(1, op->ControlInputCount());
201 EXPECT_EQ(6, OperatorProperties::GetTotalInputCount(op)); 201 EXPECT_EQ(6, OperatorProperties::GetTotalInputCount(op));
202 202
203 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); 203 EXPECT_EQ(0, op->ValueOutputCount());
204 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); 204 EXPECT_EQ(1, op->EffectOutputCount());
205 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 205 EXPECT_EQ(0, op->ControlOutputCount());
206 } 206 }
207 207
208 208
209 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, 209 INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest,
210 SimplifiedElementAccessOperatorTest, 210 SimplifiedElementAccessOperatorTest,
211 ::testing::ValuesIn(kElementAccesses)); 211 ::testing::ValuesIn(kElementAccesses));
212 212
213 } // namespace compiler 213 } // namespace compiler
214 } // namespace internal 214 } // namespace internal
215 } // namespace v8 215 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/machine-operator-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698