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

Side by Side Diff: test/unittests/compiler/machine-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
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/machine-operator.h" 5 #include "src/compiler/machine-operator.h"
6 #include "src/compiler/operator-properties-inl.h" 6 #include "src/compiler/operator-properties-inl.h"
7 #include "testing/gtest-support.h" 7 #include "testing/gtest-support.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 MachineOperatorBuilder machine1(type()); 50 MachineOperatorBuilder machine1(type());
51 MachineOperatorBuilder machine2(type()); 51 MachineOperatorBuilder machine2(type());
52 EXPECT_EQ(machine1.Load(GetParam()), machine2.Load(GetParam())); 52 EXPECT_EQ(machine1.Load(GetParam()), machine2.Load(GetParam()));
53 } 53 }
54 54
55 55
56 TEST_P(MachineLoadOperatorTest, NumberOfInputsAndOutputs) { 56 TEST_P(MachineLoadOperatorTest, NumberOfInputsAndOutputs) {
57 MachineOperatorBuilder machine(type()); 57 MachineOperatorBuilder machine(type());
58 const Operator* op = machine.Load(GetParam()); 58 const Operator* op = machine.Load(GetParam());
59 59
60 EXPECT_EQ(2, OperatorProperties::GetValueInputCount(op)); 60 EXPECT_EQ(2, op->ValueInputCount());
61 EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op)); 61 EXPECT_EQ(1, op->EffectInputCount());
62 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); 62 EXPECT_EQ(1, op->ControlInputCount());
63 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op)); 63 EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
64 64
65 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); 65 EXPECT_EQ(1, op->ValueOutputCount());
66 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); 66 EXPECT_EQ(1, op->EffectOutputCount());
67 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 67 EXPECT_EQ(0, op->ControlOutputCount());
68 } 68 }
69 69
70 70
71 TEST_P(MachineLoadOperatorTest, OpcodeIsCorrect) { 71 TEST_P(MachineLoadOperatorTest, OpcodeIsCorrect) {
72 MachineOperatorBuilder machine(type()); 72 MachineOperatorBuilder machine(type());
73 EXPECT_EQ(IrOpcode::kLoad, machine.Load(GetParam())->opcode()); 73 EXPECT_EQ(IrOpcode::kLoad, machine.Load(GetParam())->opcode());
74 } 74 }
75 75
76 76
77 TEST_P(MachineLoadOperatorTest, ParameterIsCorrect) { 77 TEST_P(MachineLoadOperatorTest, ParameterIsCorrect) {
(...skipping 30 matching lines...) Expand all
108 MachineOperatorBuilder machine1(type()); 108 MachineOperatorBuilder machine1(type());
109 MachineOperatorBuilder machine2(type()); 109 MachineOperatorBuilder machine2(type());
110 EXPECT_EQ(machine1.Store(GetParam()), machine2.Store(GetParam())); 110 EXPECT_EQ(machine1.Store(GetParam()), machine2.Store(GetParam()));
111 } 111 }
112 112
113 113
114 TEST_P(MachineStoreOperatorTest, NumberOfInputsAndOutputs) { 114 TEST_P(MachineStoreOperatorTest, NumberOfInputsAndOutputs) {
115 MachineOperatorBuilder machine(type()); 115 MachineOperatorBuilder machine(type());
116 const Operator* op = machine.Store(GetParam()); 116 const Operator* op = machine.Store(GetParam());
117 117
118 EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op)); 118 EXPECT_EQ(3, op->ValueInputCount());
119 EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op)); 119 EXPECT_EQ(1, op->EffectInputCount());
120 EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op)); 120 EXPECT_EQ(1, op->ControlInputCount());
121 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op)); 121 EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op));
122 122
123 EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op)); 123 EXPECT_EQ(0, op->ValueOutputCount());
124 EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op)); 124 EXPECT_EQ(1, op->EffectOutputCount());
125 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); 125 EXPECT_EQ(0, op->ControlOutputCount());
126 } 126 }
127 127
128 128
129 TEST_P(MachineStoreOperatorTest, OpcodeIsCorrect) { 129 TEST_P(MachineStoreOperatorTest, OpcodeIsCorrect) {
130 MachineOperatorBuilder machine(type()); 130 MachineOperatorBuilder machine(type());
131 EXPECT_EQ(IrOpcode::kStore, machine.Store(GetParam())->opcode()); 131 EXPECT_EQ(IrOpcode::kStore, machine.Store(GetParam())->opcode());
132 } 132 }
133 133
134 134
135 TEST_P(MachineStoreOperatorTest, ParameterIsCorrect) { 135 TEST_P(MachineStoreOperatorTest, ParameterIsCorrect) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 MachineOperatorBuilder machine2(type()); 219 MachineOperatorBuilder machine2(type());
220 EXPECT_EQ((machine1.*pop.constructor)(), (machine2.*pop.constructor)()); 220 EXPECT_EQ((machine1.*pop.constructor)(), (machine2.*pop.constructor)());
221 } 221 }
222 222
223 223
224 TEST_P(MachinePureOperatorTest, NumberOfInputsAndOutputs) { 224 TEST_P(MachinePureOperatorTest, NumberOfInputsAndOutputs) {
225 MachineOperatorBuilder machine(type()); 225 MachineOperatorBuilder machine(type());
226 const PureOperator& pop = GetParam(); 226 const PureOperator& pop = GetParam();
227 const Operator* op = (machine.*pop.constructor)(); 227 const Operator* op = (machine.*pop.constructor)();
228 228
229 EXPECT_EQ(pop.value_input_count, OperatorProperties::GetValueInputCount(op)); 229 EXPECT_EQ(pop.value_input_count, op->ValueInputCount());
230 EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op)); 230 EXPECT_EQ(0, op->EffectInputCount());
231 EXPECT_EQ(pop.control_input_count, 231 EXPECT_EQ(pop.control_input_count, op->ControlInputCount());
232 OperatorProperties::GetControlInputCount(op));
233 EXPECT_EQ(pop.value_input_count + pop.control_input_count, 232 EXPECT_EQ(pop.value_input_count + pop.control_input_count,
234 OperatorProperties::GetTotalInputCount(op)); 233 OperatorProperties::GetTotalInputCount(op));
235 234
236 EXPECT_EQ(pop.value_output_count, 235 EXPECT_EQ(pop.value_output_count, op->ValueOutputCount());
237 OperatorProperties::GetValueOutputCount(op)); 236 EXPECT_EQ(0, op->EffectOutputCount());
238 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); 237 EXPECT_EQ(0, op->ControlOutputCount());
239 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
240 } 238 }
241 239
242 240
243 TEST_P(MachinePureOperatorTest, MarkedAsPure) { 241 TEST_P(MachinePureOperatorTest, MarkedAsPure) {
244 MachineOperatorBuilder machine(type()); 242 MachineOperatorBuilder machine(type());
245 const PureOperator& pop = GetParam(); 243 const PureOperator& pop = GetParam();
246 const Operator* op = (machine.*pop.constructor)(); 244 const Operator* op = (machine.*pop.constructor)();
247 EXPECT_TRUE(op->HasProperty(Operator::kPure)); 245 EXPECT_TRUE(op->HasProperty(Operator::kPure));
248 } 246 }
249 247
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 EXPECT_EQ(machine.Uint64Div(), machine.UintDiv()); 305 EXPECT_EQ(machine.Uint64Div(), machine.UintDiv());
308 EXPECT_EQ(machine.Int64Mod(), machine.IntMod()); 306 EXPECT_EQ(machine.Int64Mod(), machine.IntMod());
309 EXPECT_EQ(machine.Uint64Mod(), machine.UintMod()); 307 EXPECT_EQ(machine.Uint64Mod(), machine.UintMod());
310 EXPECT_EQ(machine.Int64LessThan(), machine.IntLessThan()); 308 EXPECT_EQ(machine.Int64LessThan(), machine.IntLessThan());
311 EXPECT_EQ(machine.Int64LessThanOrEqual(), machine.IntLessThanOrEqual()); 309 EXPECT_EQ(machine.Int64LessThanOrEqual(), machine.IntLessThanOrEqual());
312 } 310 }
313 311
314 } // namespace compiler 312 } // namespace compiler
315 } // namespace internal 313 } // namespace internal
316 } // namespace v8 314 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-operator-unittest.cc ('k') | test/unittests/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698