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.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 | 90 |
91 // ----------------------------------------------------------------------------- | 91 // ----------------------------------------------------------------------------- |
92 // Common. | 92 // Common. |
93 | 93 |
94 | 94 |
95 class ChangeLoweringCommonTest | 95 class ChangeLoweringCommonTest |
96 : public ChangeLoweringTest, | 96 : public ChangeLoweringTest, |
97 public ::testing::WithParamInterface<MachineType> { | 97 public ::testing::WithParamInterface<MachineType> { |
98 public: | 98 public: |
99 ~ChangeLoweringCommonTest() OVERRIDE {} | 99 ~ChangeLoweringCommonTest() override {} |
100 | 100 |
101 MachineType WordRepresentation() const FINAL { return GetParam(); } | 101 MachineType WordRepresentation() const final { return GetParam(); } |
102 }; | 102 }; |
103 | 103 |
104 | 104 |
105 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { | 105 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { |
106 Node* value = Parameter(Type::Boolean()); | 106 Node* value = Parameter(Type::Boolean()); |
107 Reduction r = | 107 Reduction r = |
108 Reduce(graph()->NewNode(simplified()->ChangeBitToBool(), value)); | 108 Reduce(graph()->NewNode(simplified()->ChangeBitToBool(), value)); |
109 ASSERT_TRUE(r.Changed()); | 109 ASSERT_TRUE(r.Changed()); |
110 EXPECT_THAT(r.replacement(), IsSelect(kMachAnyTagged, value, IsTrueConstant(), | 110 EXPECT_THAT(r.replacement(), IsSelect(kMachAnyTagged, value, IsTrueConstant(), |
111 IsFalseConstant())); | 111 IsFalseConstant())); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 INSTANTIATE_TEST_CASE_P(ChangeLoweringTest, ChangeLoweringCommonTest, | 198 INSTANTIATE_TEST_CASE_P(ChangeLoweringTest, ChangeLoweringCommonTest, |
199 ::testing::Values(kRepWord32, kRepWord64)); | 199 ::testing::Values(kRepWord32, kRepWord64)); |
200 | 200 |
201 | 201 |
202 // ----------------------------------------------------------------------------- | 202 // ----------------------------------------------------------------------------- |
203 // 32-bit | 203 // 32-bit |
204 | 204 |
205 | 205 |
206 class ChangeLowering32Test : public ChangeLoweringTest { | 206 class ChangeLowering32Test : public ChangeLoweringTest { |
207 public: | 207 public: |
208 ~ChangeLowering32Test() OVERRIDE {} | 208 ~ChangeLowering32Test() override {} |
209 MachineType WordRepresentation() const FINAL { return kRepWord32; } | 209 MachineType WordRepresentation() const final { return kRepWord32; } |
210 }; | 210 }; |
211 | 211 |
212 | 212 |
213 TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) { | 213 TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) { |
214 Node* value = Parameter(Type::Integral32()); | 214 Node* value = Parameter(Type::Integral32()); |
215 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), value); | 215 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), value); |
216 Reduction r = Reduce(node); | 216 Reduction r = Reduce(node); |
217 ASSERT_TRUE(r.Changed()); | 217 ASSERT_TRUE(r.Changed()); |
218 Capture<Node*> add, branch, heap_number, if_true; | 218 Capture<Node*> add, branch, heap_number, if_true; |
219 EXPECT_THAT( | 219 EXPECT_THAT( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 336 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 // ----------------------------------------------------------------------------- | 340 // ----------------------------------------------------------------------------- |
341 // 64-bit | 341 // 64-bit |
342 | 342 |
343 | 343 |
344 class ChangeLowering64Test : public ChangeLoweringTest { | 344 class ChangeLowering64Test : public ChangeLoweringTest { |
345 public: | 345 public: |
346 ~ChangeLowering64Test() OVERRIDE {} | 346 ~ChangeLowering64Test() override {} |
347 MachineType WordRepresentation() const FINAL { return kRepWord64; } | 347 MachineType WordRepresentation() const final { return kRepWord64; } |
348 }; | 348 }; |
349 | 349 |
350 | 350 |
351 TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) { | 351 TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) { |
352 Node* value = Parameter(Type::Signed32()); | 352 Node* value = Parameter(Type::Signed32()); |
353 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), value); | 353 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), value); |
354 Reduction r = Reduce(node); | 354 Reduction r = Reduce(node); |
355 ASSERT_TRUE(r.Changed()); | 355 ASSERT_TRUE(r.Changed()); |
356 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value)); | 356 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value)); |
357 } | 357 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 CaptureEq(&branch), | 456 CaptureEq(&branch), |
457 IsBranch(IsUint32LessThanOrEqual( | 457 IsBranch(IsUint32LessThanOrEqual( |
458 value, IsInt32Constant(Smi::kMaxValue)), | 458 value, IsInt32Constant(Smi::kMaxValue)), |
459 graph()->start()))), | 459 graph()->start()))), |
460 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 460 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
461 } | 461 } |
462 | 462 |
463 } // namespace compiler | 463 } // namespace compiler |
464 } // namespace internal | 464 } // namespace internal |
465 } // namespace v8 | 465 } // namespace v8 |
OLD | NEW |