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

Side by Side Diff: test/cctest/compiler/simplified-graph-builder.h

Issue 543763002: Remove overly complex MachineNodeFactory. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
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 #ifndef V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ 5 #ifndef V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
6 #define V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ 6 #define V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
7 7
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-builder.h" 9 #include "src/compiler/graph-builder.h"
10 #include "src/compiler/machine-node-factory.h"
11 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
12 #include "src/compiler/simplified-operator.h" 11 #include "src/compiler/simplified-operator.h"
13 #include "test/cctest/cctest.h" 12 #include "test/cctest/cctest.h"
14 #include "test/cctest/compiler/call-tester.h" 13 #include "test/cctest/compiler/call-tester.h"
15 14
16 namespace v8 { 15 namespace v8 {
17 namespace internal { 16 namespace internal {
18 namespace compiler { 17 namespace compiler {
19 18
20 class SimplifiedGraphBuilder 19 class SimplifiedGraphBuilder : public GraphBuilder {
21 : public GraphBuilder,
22 public MachineNodeFactory<SimplifiedGraphBuilder> {
23 public: 20 public:
24 SimplifiedGraphBuilder(Graph* graph, CommonOperatorBuilder* common, 21 SimplifiedGraphBuilder(Graph* graph, CommonOperatorBuilder* common,
25 MachineOperatorBuilder* machine, 22 MachineOperatorBuilder* machine,
26 SimplifiedOperatorBuilder* simplified); 23 SimplifiedOperatorBuilder* simplified);
27 virtual ~SimplifiedGraphBuilder() {} 24 virtual ~SimplifiedGraphBuilder() {}
28 25
29 Zone* zone() const { return graph()->zone(); } 26 Zone* zone() const { return graph()->zone(); }
30 Isolate* isolate() const { return zone()->isolate(); } 27 Isolate* isolate() const { return zone()->isolate(); }
31 CommonOperatorBuilder* common() const { return common_; } 28 CommonOperatorBuilder* common() const { return common_; }
32 MachineOperatorBuilder* machine() const { return machine_; } 29 MachineOperatorBuilder* machine() const { return machine_; }
33 SimplifiedOperatorBuilder* simplified() const { return simplified_; } 30 SimplifiedOperatorBuilder* simplified() const { return simplified_; }
34 31
35 // Initialize graph and builder. 32 // Initialize graph and builder.
36 void Begin(int num_parameters); 33 void Begin(int num_parameters);
37 34
38 void Return(Node* value); 35 void Return(Node* value);
39 36
40 // Close the graph. 37 // Close the graph.
41 void End(); 38 void End();
42 39
40 Node* PointerConstant(void* value) {
41 intptr_t intptr_value = reinterpret_cast<intptr_t>(value);
42 return kPointerSize == 8 ? NewNode(common()->Int64Constant(intptr_value))
43 : Int32Constant(static_cast<int>(intptr_value));
44 }
45 Node* Int32Constant(int32_t value) {
46 return NewNode(common()->Int32Constant(value));
47 }
48 Node* HeapConstant(Handle<Object> object) {
49 Unique<Object> val = Unique<Object>::CreateUninitialized(object);
50 return NewNode(common()->HeapConstant(val));
51 }
52
43 Node* BooleanNot(Node* a) { return NewNode(simplified()->BooleanNot(), a); } 53 Node* BooleanNot(Node* a) { return NewNode(simplified()->BooleanNot(), a); }
44 54
45 Node* NumberEqual(Node* a, Node* b) { 55 Node* NumberEqual(Node* a, Node* b) {
46 return NewNode(simplified()->NumberEqual(), a, b); 56 return NewNode(simplified()->NumberEqual(), a, b);
47 } 57 }
48 Node* NumberLessThan(Node* a, Node* b) { 58 Node* NumberLessThan(Node* a, Node* b) {
49 return NewNode(simplified()->NumberLessThan(), a, b); 59 return NewNode(simplified()->NumberLessThan(), a, b);
50 } 60 }
51 Node* NumberLessThanOrEqual(Node* a, Node* b) { 61 Node* NumberLessThanOrEqual(Node* a, Node* b) {
52 return NewNode(simplified()->NumberLessThanOrEqual(), a, b); 62 return NewNode(simplified()->NumberLessThanOrEqual(), a, b);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 CommonOperatorBuilder* common_; 145 CommonOperatorBuilder* common_;
136 MachineOperatorBuilder* machine_; 146 MachineOperatorBuilder* machine_;
137 SimplifiedOperatorBuilder* simplified_; 147 SimplifiedOperatorBuilder* simplified_;
138 }; 148 };
139 149
140 } // namespace compiler 150 } // namespace compiler
141 } // namespace internal 151 } // namespace internal
142 } // namespace v8 152 } // namespace v8
143 153
144 #endif // V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_ 154 #endif // V8_CCTEST_COMPILER_SIMPLIFIED_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « test/cctest/compiler/graph-builder-tester.h ('k') | test/cctest/compiler/structured-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698