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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/change-lowering.h" | 6 #include "src/compiler/change-lowering.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "test/unittests/compiler/compiler-test-utils.h" | 10 #include "test/unittests/compiler/compiler-test-utils.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return GetParam(); | 117 return GetParam(); |
118 } | 118 } |
119 }; | 119 }; |
120 | 120 |
121 | 121 |
122 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { | 122 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { |
123 Node* val = Parameter(0); | 123 Node* val = Parameter(0); |
124 Node* node = graph()->NewNode(simplified()->ChangeBitToBool(), val); | 124 Node* node = graph()->NewNode(simplified()->ChangeBitToBool(), val); |
125 Reduction reduction = Reduce(node); | 125 Reduction reduction = Reduce(node); |
126 ASSERT_TRUE(reduction.Changed()); | 126 ASSERT_TRUE(reduction.Changed()); |
127 | 127 EXPECT_THAT(reduction.replacement(), |
128 Node* phi = reduction.replacement(); | 128 IsSelect(static_cast<MachineType>(kTypeBool | kRepTagged), val, |
129 Capture<Node*> branch; | 129 IsTrueConstant(), IsFalseConstant())); |
130 EXPECT_THAT(phi, | |
131 IsPhi(static_cast<MachineType>(kTypeBool | kRepTagged), | |
132 IsTrueConstant(), IsFalseConstant(), | |
133 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), | |
134 IsBranch(val, graph()->start()))), | |
135 IsIfFalse(CaptureEq(&branch))))); | |
136 } | 130 } |
137 | 131 |
138 | 132 |
139 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { | 133 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { |
140 Node* val = Parameter(0); | 134 Node* val = Parameter(0); |
141 Node* node = graph()->NewNode(simplified()->ChangeBoolToBit(), val); | 135 Node* node = graph()->NewNode(simplified()->ChangeBoolToBit(), val); |
142 Reduction reduction = Reduce(node); | 136 Reduction reduction = Reduce(node); |
143 ASSERT_TRUE(reduction.Changed()); | 137 ASSERT_TRUE(reduction.Changed()); |
144 | 138 |
145 EXPECT_THAT(reduction.replacement(), IsWordEqual(val, IsTrueConstant())); | 139 EXPECT_THAT(reduction.replacement(), IsWordEqual(val, IsTrueConstant())); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 IsIfTrue(AllOf(CaptureEq(&branch), | 447 IsIfTrue(AllOf(CaptureEq(&branch), |
454 IsBranch(IsUint32LessThanOrEqual( | 448 IsBranch(IsUint32LessThanOrEqual( |
455 val, IsInt32Constant(SmiMaxValue())), | 449 val, IsInt32Constant(SmiMaxValue())), |
456 graph()->start()))), | 450 graph()->start()))), |
457 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 451 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
458 } | 452 } |
459 | 453 |
460 } // namespace compiler | 454 } // namespace compiler |
461 } // namespace internal | 455 } // namespace internal |
462 } // namespace v8 | 456 } // namespace v8 |
OLD | NEW |