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

Side by Side Diff: test/compiler-unittests/machine-operator-reducer-unittest.cc

Issue 480863002: Refactor ChangeLowering class to avoid template specialization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « test/compiler-unittests/graph-unittest.cc ('k') | test/compiler-unittests/node-matchers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph.h"
8 #include "src/compiler/machine-operator-reducer.h" 6 #include "src/compiler/machine-operator-reducer.h"
9 #include "test/compiler-unittests/compiler-unittests.h" 7 #include "test/compiler-unittests/graph-unittest.h"
10 #include "test/compiler-unittests/node-matchers.h"
11 8
12 namespace v8 { 9 namespace v8 {
13 namespace internal { 10 namespace internal {
14 namespace compiler { 11 namespace compiler {
15 12
16 class MachineOperatorReducerTest : public CompilerTest { 13 class MachineOperatorReducerTest : public GraphTest {
17 public: 14 public:
18 explicit MachineOperatorReducerTest(int num_parameters = 2) 15 explicit MachineOperatorReducerTest(int num_parameters = 2)
19 : graph_(zone()), common_(zone()), machine_(zone()) { 16 : GraphTest(num_parameters), machine_(zone()) {}
20 graph()->SetStart(graph()->NewNode(common()->Start(num_parameters)));
21 }
22 virtual ~MachineOperatorReducerTest() {} 17 virtual ~MachineOperatorReducerTest() {}
23 18
24 protected: 19 protected:
25 Node* Parameter(int32_t index) { 20 Node* Parameter(int32_t index) {
26 return graph()->NewNode(common()->Parameter(index), graph()->start()); 21 return graph()->NewNode(common()->Parameter(index), graph()->start());
27 } 22 }
28 Node* Int32Constant(int32_t value) { 23 Node* Int32Constant(int32_t value) {
29 return graph()->NewNode(common()->Int32Constant(value)); 24 return graph()->NewNode(common()->Int32Constant(value));
30 } 25 }
31 26
32 Reduction Reduce(Node* node) { 27 Reduction Reduce(Node* node) {
33 MachineOperatorReducer reducer(graph()); 28 MachineOperatorReducer reducer(graph());
34 return reducer.Reduce(node); 29 return reducer.Reduce(node);
35 } 30 }
36 31
37 Graph* graph() { return &graph_; }
38 CommonOperatorBuilder* common() { return &common_; }
39 MachineOperatorBuilder* machine() { return &machine_; } 32 MachineOperatorBuilder* machine() { return &machine_; }
40 33
41 private: 34 private:
42 Graph graph_;
43 CommonOperatorBuilder common_;
44 MachineOperatorBuilder machine_; 35 MachineOperatorBuilder machine_;
45 }; 36 };
46 37
47 38
48 namespace { 39 namespace {
49 40
50 static const uint32_t kConstants[] = { 41 static const uint32_t kConstants[] = {
51 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, 42 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf,
52 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, 43 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344,
53 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, 44 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 EXPECT_TRUE(reduction.Changed()); 121 EXPECT_TRUE(reduction.Changed());
131 EXPECT_THAT(reduction.replacement(), 122 EXPECT_THAT(reduction.replacement(),
132 IsInt32Constant(base::bits::RotateRight32(x, y))); 123 IsInt32Constant(base::bits::RotateRight32(x, y)));
133 } 124 }
134 } 125 }
135 } 126 }
136 127
137 } // namespace compiler 128 } // namespace compiler
138 } // namespace internal 129 } // namespace internal
139 } // namespace v8 130 } // namespace v8
OLDNEW
« no previous file with comments | « test/compiler-unittests/graph-unittest.cc ('k') | test/compiler-unittests/node-matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698