OLD | NEW |
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 "src/test/test-utils.h" | 7 #include "src/test/test-utils.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 protected: | 33 protected: |
34 MachineOperatorBuilder* machine() const { return machine_; } | 34 MachineOperatorBuilder* machine() const { return machine_; } |
35 | 35 |
36 private: | 36 private: |
37 MachineOperatorBuilder* machine_; | 37 MachineOperatorBuilder* machine_; |
38 }; | 38 }; |
39 | 39 |
40 | 40 |
41 TEST_P(MachineOperatorCommonTest, ChangeInt32ToInt64) { | 41 TEST_P(MachineOperatorCommonTest, ChangeInt32ToInt64) { |
42 Operator* op = machine()->ChangeInt32ToInt64(); | 42 const Operator* op = machine()->ChangeInt32ToInt64(); |
43 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); | 43 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); |
44 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); | 44 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
45 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 45 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
46 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); | 46 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
47 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); | 47 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 TEST_P(MachineOperatorCommonTest, ChangeUint32ToUint64) { | 51 TEST_P(MachineOperatorCommonTest, ChangeUint32ToUint64) { |
52 Operator* op = machine()->ChangeUint32ToUint64(); | 52 const Operator* op = machine()->ChangeUint32ToUint64(); |
53 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); | 53 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); |
54 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); | 54 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
55 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 55 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
56 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); | 56 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
57 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); | 57 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 TEST_P(MachineOperatorCommonTest, TruncateFloat64ToInt32) { | 61 TEST_P(MachineOperatorCommonTest, TruncateFloat64ToInt32) { |
62 Operator* op = machine()->TruncateFloat64ToInt32(); | 62 const Operator* op = machine()->TruncateFloat64ToInt32(); |
63 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); | 63 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); |
64 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); | 64 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
65 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 65 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
66 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); | 66 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
67 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); | 67 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 TEST_P(MachineOperatorCommonTest, TruncateInt64ToInt32) { | 71 TEST_P(MachineOperatorCommonTest, TruncateInt64ToInt32) { |
72 Operator* op = machine()->TruncateInt64ToInt32(); | 72 const Operator* op = machine()->TruncateInt64ToInt32(); |
73 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); | 73 EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op)); |
74 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); | 74 EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op)); |
75 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); | 75 EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op)); |
76 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); | 76 EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op)); |
77 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); | 77 EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op)); |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 INSTANTIATE_TEST_CASE_P(MachineOperatorTest, MachineOperatorCommonTest, | 81 INSTANTIATE_TEST_CASE_P(MachineOperatorTest, MachineOperatorCommonTest, |
82 ::testing::Values(kRepWord32, kRepWord64)); | 82 ::testing::Values(kRepWord32, kRepWord64)); |
83 | 83 |
84 } // namespace compiler | 84 } // namespace compiler |
85 } // namespace internal | 85 } // namespace internal |
86 } // namespace v8 | 86 } // namespace v8 |
OLD | NEW |