| 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/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 IsSelect(static_cast<MachineType>(kTypeBool | kRepTagged), val, | 125 IsSelect(static_cast<MachineType>(kTypeBool | kRepTagged), val, |
| 126 IsTrueConstant(), IsFalseConstant())); | 126 IsTrueConstant(), IsFalseConstant())); |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { | 130 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { |
| 131 Node* val = Parameter(0); | 131 Node* val = Parameter(0); |
| 132 Node* node = graph()->NewNode(simplified()->ChangeBoolToBit(), val); | 132 Node* node = graph()->NewNode(simplified()->ChangeBoolToBit(), val); |
| 133 Reduction reduction = Reduce(node); | 133 Reduction reduction = Reduce(node); |
| 134 ASSERT_TRUE(reduction.Changed()); | 134 ASSERT_TRUE(reduction.Changed()); |
| 135 |
| 135 EXPECT_THAT(reduction.replacement(), IsWordEqual(val, IsTrueConstant())); | 136 EXPECT_THAT(reduction.replacement(), IsWordEqual(val, IsTrueConstant())); |
| 136 } | 137 } |
| 137 | 138 |
| 138 | 139 |
| 139 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeWord32ToBit) { | |
| 140 Node* val = Parameter(0); | |
| 141 Node* node = graph()->NewNode(simplified()->ChangeWord32ToBit(), val); | |
| 142 Reduction reduction = Reduce(node); | |
| 143 ASSERT_TRUE(reduction.Changed()); | |
| 144 EXPECT_THAT(reduction.replacement(), | |
| 145 IsWord32Equal(IsWord32Equal(val, IsInt32Constant(0)), | |
| 146 IsInt32Constant(0))); | |
| 147 } | |
| 148 | |
| 149 | |
| 150 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeWord64ToBit) { | |
| 151 Node* val = Parameter(0); | |
| 152 Node* node = graph()->NewNode(simplified()->ChangeWord64ToBit(), val); | |
| 153 Reduction reduction = Reduce(node); | |
| 154 ASSERT_TRUE(reduction.Changed()); | |
| 155 EXPECT_THAT(reduction.replacement(), | |
| 156 IsWord32Equal(IsWord64Equal(val, IsInt64Constant(0)), | |
| 157 IsInt32Constant(0))); | |
| 158 } | |
| 159 | |
| 160 | |
| 161 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeFloat64ToTagged) { | 140 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeFloat64ToTagged) { |
| 162 Node* val = Parameter(0); | 141 Node* val = Parameter(0); |
| 163 Node* node = graph()->NewNode(simplified()->ChangeFloat64ToTagged(), val); | 142 Node* node = graph()->NewNode(simplified()->ChangeFloat64ToTagged(), val); |
| 164 Reduction reduction = Reduce(node); | 143 Reduction reduction = Reduce(node); |
| 165 ASSERT_TRUE(reduction.Changed()); | 144 ASSERT_TRUE(reduction.Changed()); |
| 166 | 145 |
| 167 Node* finish = reduction.replacement(); | 146 Node* finish = reduction.replacement(); |
| 168 Capture<Node*> heap_number; | 147 Capture<Node*> heap_number; |
| 169 EXPECT_THAT( | 148 EXPECT_THAT( |
| 170 finish, | 149 finish, |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 IsIfTrue(AllOf(CaptureEq(&branch), | 454 IsIfTrue(AllOf(CaptureEq(&branch), |
| 476 IsBranch(IsUint32LessThanOrEqual( | 455 IsBranch(IsUint32LessThanOrEqual( |
| 477 val, IsInt32Constant(SmiMaxValue())), | 456 val, IsInt32Constant(SmiMaxValue())), |
| 478 graph()->start()))), | 457 graph()->start()))), |
| 479 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 458 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
| 480 } | 459 } |
| 481 | 460 |
| 482 } // namespace compiler | 461 } // namespace compiler |
| 483 } // namespace internal | 462 } // namespace internal |
| 484 } // namespace v8 | 463 } // namespace v8 |
| OLD | NEW |