Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: test/unittests/compiler/change-lowering-unittest.cc

Issue 816453005: [turbofan] Cleanup use of virtual, OVERRIDE, FINAL. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "test/unittests/compiler/graph-unittest.h" 11 #include "test/unittests/compiler/graph-unittest.h"
12 #include "test/unittests/compiler/node-test-utils.h" 12 #include "test/unittests/compiler/node-test-utils.h"
13 #include "testing/gmock-support.h" 13 #include "testing/gmock-support.h"
14 14
15 using testing::_; 15 using testing::_;
16 using testing::AllOf; 16 using testing::AllOf;
17 using testing::Capture; 17 using testing::Capture;
18 using testing::CaptureEq; 18 using testing::CaptureEq;
19 19
20 namespace v8 { 20 namespace v8 {
21 namespace internal { 21 namespace internal {
22 namespace compiler { 22 namespace compiler {
23 23
24 class ChangeLoweringTest : public GraphTest { 24 class ChangeLoweringTest : public GraphTest {
25 public: 25 public:
26 ChangeLoweringTest() : simplified_(zone()) {} 26 ChangeLoweringTest() : simplified_(zone()) {}
27 virtual ~ChangeLoweringTest() {} 27 ~ChangeLoweringTest() OVERRIDE {}
28 28
29 virtual MachineType WordRepresentation() const = 0; 29 virtual MachineType WordRepresentation() const = 0;
30 30
31 protected: 31 protected:
32 int HeapNumberValueOffset() const { 32 int HeapNumberValueOffset() const {
33 STATIC_ASSERT(HeapNumber::kValueOffset % kApiPointerSize == 0); 33 STATIC_ASSERT(HeapNumber::kValueOffset % kApiPointerSize == 0);
34 return (HeapNumber::kValueOffset / kApiPointerSize) * PointerSize() - 34 return (HeapNumber::kValueOffset / kApiPointerSize) * PointerSize() -
35 kHeapObjectTag; 35 kHeapObjectTag;
36 } 36 }
37 bool Is32() const { return WordRepresentation() == kRepWord32; } 37 bool Is32() const { return WordRepresentation() == kRepWord32; }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 105
106 // ----------------------------------------------------------------------------- 106 // -----------------------------------------------------------------------------
107 // Common. 107 // Common.
108 108
109 109
110 class ChangeLoweringCommonTest 110 class ChangeLoweringCommonTest
111 : public ChangeLoweringTest, 111 : public ChangeLoweringTest,
112 public ::testing::WithParamInterface<MachineType> { 112 public ::testing::WithParamInterface<MachineType> {
113 public: 113 public:
114 virtual ~ChangeLoweringCommonTest() {} 114 ~ChangeLoweringCommonTest() OVERRIDE {}
115 115
116 virtual MachineType WordRepresentation() const FINAL { return GetParam(); } 116 MachineType WordRepresentation() const FINAL { return GetParam(); }
117 }; 117 };
118 118
119 119
120 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) { 120 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) {
121 Node* val = Parameter(0); 121 Node* val = Parameter(0);
122 Node* node = graph()->NewNode(simplified()->ChangeBitToBool(), val); 122 Node* node = graph()->NewNode(simplified()->ChangeBitToBool(), val);
123 Reduction reduction = Reduce(node); 123 Reduction reduction = Reduce(node);
124 ASSERT_TRUE(reduction.Changed()); 124 ASSERT_TRUE(reduction.Changed());
125 EXPECT_THAT(reduction.replacement(), 125 EXPECT_THAT(reduction.replacement(),
126 IsSelect(static_cast<MachineType>(kTypeBool | kRepTagged), val, 126 IsSelect(static_cast<MachineType>(kTypeBool | kRepTagged), val,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 INSTANTIATE_TEST_CASE_P(ChangeLoweringTest, ChangeLoweringCommonTest, 169 INSTANTIATE_TEST_CASE_P(ChangeLoweringTest, ChangeLoweringCommonTest,
170 ::testing::Values(kRepWord32, kRepWord64)); 170 ::testing::Values(kRepWord32, kRepWord64));
171 171
172 172
173 // ----------------------------------------------------------------------------- 173 // -----------------------------------------------------------------------------
174 // 32-bit 174 // 32-bit
175 175
176 176
177 class ChangeLowering32Test : public ChangeLoweringTest { 177 class ChangeLowering32Test : public ChangeLoweringTest {
178 public: 178 public:
179 virtual ~ChangeLowering32Test() {} 179 ~ChangeLowering32Test() OVERRIDE {}
180 virtual MachineType WordRepresentation() const FINAL { return kRepWord32; } 180 MachineType WordRepresentation() const FINAL { return kRepWord32; }
181 }; 181 };
182 182
183 183
184 TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) { 184 TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) {
185 Node* val = Parameter(0); 185 Node* val = Parameter(0);
186 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); 186 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val);
187 NodeProperties::SetBounds(val, Bounds(Type::None(), Type::Signed32())); 187 NodeProperties::SetBounds(val, Bounds(Type::None(), Type::Signed32()));
188 Reduction reduction = Reduce(node); 188 Reduction reduction = Reduce(node);
189 ASSERT_TRUE(reduction.Changed()); 189 ASSERT_TRUE(reduction.Changed());
190 190
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 327 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
328 } 328 }
329 329
330 330
331 // ----------------------------------------------------------------------------- 331 // -----------------------------------------------------------------------------
332 // 64-bit 332 // 64-bit
333 333
334 334
335 class ChangeLowering64Test : public ChangeLoweringTest { 335 class ChangeLowering64Test : public ChangeLoweringTest {
336 public: 336 public:
337 virtual ~ChangeLowering64Test() {} 337 ~ChangeLowering64Test() OVERRIDE {}
338 virtual MachineType WordRepresentation() const FINAL { return kRepWord64; } 338 MachineType WordRepresentation() const FINAL { return kRepWord64; }
339 }; 339 };
340 340
341 341
342 TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) { 342 TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) {
343 Node* val = Parameter(0); 343 Node* val = Parameter(0);
344 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val); 344 Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), val);
345 Reduction reduction = Reduce(node); 345 Reduction reduction = Reduce(node);
346 ASSERT_TRUE(reduction.Changed()); 346 ASSERT_TRUE(reduction.Changed());
347 347
348 EXPECT_THAT(reduction.replacement(), 348 EXPECT_THAT(reduction.replacement(),
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 IsIfTrue(AllOf(CaptureEq(&branch), 455 IsIfTrue(AllOf(CaptureEq(&branch),
456 IsBranch(IsUint32LessThanOrEqual( 456 IsBranch(IsUint32LessThanOrEqual(
457 val, IsInt32Constant(SmiMaxValue())), 457 val, IsInt32Constant(SmiMaxValue())),
458 graph()->start()))), 458 graph()->start()))),
459 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 459 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
460 } 460 }
461 461
462 } // namespace compiler 462 } // namespace compiler
463 } // namespace internal 463 } // namespace internal
464 } // namespace v8 464 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698