| 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/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
| 6 #include "src/compiler/graph-unittest.h" | 6 #include "src/compiler/graph-unittest.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 "src/compiler/typer.h" | 10 #include "src/compiler/typer.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // ----------------------------------------------------------------------------- | 107 // ----------------------------------------------------------------------------- |
| 108 // Common. | 108 // Common. |
| 109 | 109 |
| 110 | 110 |
| 111 class ChangeLoweringCommonTest | 111 class ChangeLoweringCommonTest |
| 112 : public ChangeLoweringTest, | 112 : public ChangeLoweringTest, |
| 113 public ::testing::WithParamInterface<MachineType> { | 113 public ::testing::WithParamInterface<MachineType> { |
| 114 public: | 114 public: |
| 115 virtual ~ChangeLoweringCommonTest() {} | 115 virtual ~ChangeLoweringCommonTest() {} |
| 116 | 116 |
| 117 virtual MachineType WordRepresentation() const V8_FINAL V8_OVERRIDE { | 117 virtual MachineType WordRepresentation() const FINAL OVERRIDE { |
| 118 return GetParam(); | 118 return GetParam(); |
| 119 } | 119 } |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 | 122 |
| 123 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { | 123 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { |
| 124 Node* val = Parameter(0); | 124 Node* val = Parameter(0); |
| 125 Node* node = graph()->NewNode(simplified()->ChangeBitToBool(), val); | 125 Node* node = graph()->NewNode(simplified()->ChangeBitToBool(), val); |
| 126 Reduction reduction = Reduce(node); | 126 Reduction reduction = Reduce(node); |
| 127 ASSERT_TRUE(reduction.Changed()); | 127 ASSERT_TRUE(reduction.Changed()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 ::testing::Values(kRepWord32, kRepWord64)); | 177 ::testing::Values(kRepWord32, kRepWord64)); |
| 178 | 178 |
| 179 | 179 |
| 180 // ----------------------------------------------------------------------------- | 180 // ----------------------------------------------------------------------------- |
| 181 // 32-bit | 181 // 32-bit |
| 182 | 182 |
| 183 | 183 |
| 184 class ChangeLowering32Test : public ChangeLoweringTest { | 184 class ChangeLowering32Test : public ChangeLoweringTest { |
| 185 public: | 185 public: |
| 186 virtual ~ChangeLowering32Test() {} | 186 virtual ~ChangeLowering32Test() {} |
| 187 virtual MachineType WordRepresentation() const V8_FINAL V8_OVERRIDE { | 187 virtual MachineType WordRepresentation() const FINAL OVERRIDE { |
| 188 return kRepWord32; | 188 return kRepWord32; |
| 189 } | 189 } |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 | 192 |
| 193 TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) { | 193 TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) { |
| 194 Node* val = Parameter(0); | 194 Node* val = Parameter(0); |
| 195 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); | 195 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); |
| 196 Reduction reduction = Reduce(node); | 196 Reduction reduction = Reduce(node); |
| 197 ASSERT_TRUE(reduction.Changed()); | 197 ASSERT_TRUE(reduction.Changed()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 | 326 |
| 327 | 327 |
| 328 // ----------------------------------------------------------------------------- | 328 // ----------------------------------------------------------------------------- |
| 329 // 64-bit | 329 // 64-bit |
| 330 | 330 |
| 331 | 331 |
| 332 class ChangeLowering64Test : public ChangeLoweringTest { | 332 class ChangeLowering64Test : public ChangeLoweringTest { |
| 333 public: | 333 public: |
| 334 virtual ~ChangeLowering64Test() {} | 334 virtual ~ChangeLowering64Test() {} |
| 335 virtual MachineType WordRepresentation() const V8_FINAL V8_OVERRIDE { | 335 virtual MachineType WordRepresentation() const FINAL OVERRIDE { |
| 336 return kRepWord64; | 336 return kRepWord64; |
| 337 } | 337 } |
| 338 }; | 338 }; |
| 339 | 339 |
| 340 | 340 |
| 341 TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) { | 341 TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) { |
| 342 Node* val = Parameter(0); | 342 Node* val = Parameter(0); |
| 343 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); | 343 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); |
| 344 Reduction reduction = Reduce(node); | 344 Reduction reduction = Reduce(node); |
| 345 ASSERT_TRUE(reduction.Changed()); | 345 ASSERT_TRUE(reduction.Changed()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 IsIfTrue(AllOf(CaptureEq(&branch), | 457 IsIfTrue(AllOf(CaptureEq(&branch), |
| 458 IsBranch(IsUint32LessThanOrEqual( | 458 IsBranch(IsUint32LessThanOrEqual( |
| 459 val, IsInt32Constant(SmiMaxValue())), | 459 val, IsInt32Constant(SmiMaxValue())), |
| 460 graph()->start()))), | 460 graph()->start()))), |
| 461 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 461 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace compiler | 464 } // namespace compiler |
| 465 } // namespace internal | 465 } // namespace internal |
| 466 } // namespace v8 | 466 } // namespace v8 |
| OLD | NEW |