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

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

Issue 868883002: Remove the dependency of Zone on Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation issues Created 5 years, 11 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
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | test/cctest/compiler/graph-builder-tester.cc » ('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 #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ 5 #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_
6 #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ 6 #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 #include "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 10
11 #include "src/compiler/common-operator.h" 11 #include "src/compiler/common-operator.h"
12 #include "src/compiler/graph-builder.h" 12 #include "src/compiler/graph-builder.h"
13 #include "src/compiler/machine-operator.h" 13 #include "src/compiler/machine-operator.h"
14 #include "src/compiler/simplified-operator.h" 14 #include "src/compiler/simplified-operator.h"
15 #include "test/cctest/compiler/call-tester.h" 15 #include "test/cctest/compiler/call-tester.h"
16 #include "test/cctest/compiler/simplified-graph-builder.h" 16 #include "test/cctest/compiler/simplified-graph-builder.h"
17 17
18 namespace v8 { 18 namespace v8 {
19 namespace internal { 19 namespace internal {
20 namespace compiler { 20 namespace compiler {
21 21
22 // A class that just passes node creation on to the Graph. 22 // A class that just passes node creation on to the Graph.
23 class DirectGraphBuilder : public GraphBuilder { 23 class DirectGraphBuilder : public GraphBuilder {
24 public: 24 public:
25 explicit DirectGraphBuilder(Graph* graph) : GraphBuilder(graph) {} 25 DirectGraphBuilder(Isolate* isolate, Graph* graph)
26 : GraphBuilder(isolate, graph) {}
26 virtual ~DirectGraphBuilder() {} 27 virtual ~DirectGraphBuilder() {}
27 28
28 protected: 29 protected:
29 virtual Node* MakeNode(const Operator* op, int value_input_count, 30 virtual Node* MakeNode(const Operator* op, int value_input_count,
30 Node** value_inputs, bool incomplete) FINAL { 31 Node** value_inputs, bool incomplete) FINAL {
31 return graph()->NewNode(op, value_input_count, value_inputs, incomplete); 32 return graph()->NewNode(op, value_input_count, value_inputs, incomplete);
32 } 33 }
33 }; 34 };
34 35
35 36
36 class MachineCallHelper : public CallHelper { 37 class MachineCallHelper : public CallHelper {
37 public: 38 public:
38 MachineCallHelper(Zone* zone, MachineSignature* machine_sig); 39 MachineCallHelper(Isolate* isolate, MachineSignature* machine_sig);
39 40
40 Node* Parameter(size_t index); 41 Node* Parameter(size_t index);
41 42
42 void GenerateCode() { Generate(); } 43 void GenerateCode() { Generate(); }
43 44
44 protected: 45 protected:
45 virtual byte* Generate(); 46 virtual byte* Generate();
46 void InitParameters(GraphBuilder* builder, CommonOperatorBuilder* common); 47 void InitParameters(GraphBuilder* builder, CommonOperatorBuilder* common);
47 48
48 protected: 49 protected:
49 size_t parameter_count() const { return machine_sig_->parameter_count(); } 50 size_t parameter_count() const { return machine_sig_->parameter_count(); }
50 51
51 private: 52 private:
52 Node** parameters_; 53 Node** parameters_;
53 // TODO(dcarney): shouldn't need graph stored. 54 // TODO(dcarney): shouldn't need graph stored.
55 Isolate* isolate_;
54 Graph* graph_; 56 Graph* graph_;
55 MaybeHandle<Code> code_; 57 MaybeHandle<Code> code_;
56 }; 58 };
57 59
58 60
59 class GraphAndBuilders { 61 class GraphAndBuilders {
60 public: 62 public:
61 explicit GraphAndBuilders(Zone* zone) 63 explicit GraphAndBuilders(Zone* zone)
62 : main_graph_(new (zone) Graph(zone)), 64 : main_graph_(new (zone) Graph(zone)),
63 main_common_(zone), 65 main_common_(zone),
(...skipping 17 matching lines...) Expand all
81 public SimplifiedGraphBuilder, 83 public SimplifiedGraphBuilder,
82 public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > { 84 public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > {
83 public: 85 public:
84 explicit GraphBuilderTester(MachineType p0 = kMachNone, 86 explicit GraphBuilderTester(MachineType p0 = kMachNone,
85 MachineType p1 = kMachNone, 87 MachineType p1 = kMachNone,
86 MachineType p2 = kMachNone, 88 MachineType p2 = kMachNone,
87 MachineType p3 = kMachNone, 89 MachineType p3 = kMachNone,
88 MachineType p4 = kMachNone) 90 MachineType p4 = kMachNone)
89 : GraphAndBuilders(main_zone()), 91 : GraphAndBuilders(main_zone()),
90 MachineCallHelper( 92 MachineCallHelper(
91 main_zone(), 93 main_isolate(),
92 MakeMachineSignature( 94 MakeMachineSignature(
93 main_zone(), ReturnValueTraits<ReturnType>::Representation(), 95 main_zone(), ReturnValueTraits<ReturnType>::Representation(),
94 p0, p1, p2, p3, p4)), 96 p0, p1, p2, p3, p4)),
95 SimplifiedGraphBuilder(main_graph_, &main_common_, &main_machine_, 97 SimplifiedGraphBuilder(main_isolate(), main_graph_, &main_common_,
96 &main_simplified_) { 98 &main_machine_, &main_simplified_) {
97 Begin(static_cast<int>(parameter_count())); 99 Begin(static_cast<int>(parameter_count()));
98 InitParameters(this, &main_common_); 100 InitParameters(this, &main_common_);
99 } 101 }
100 virtual ~GraphBuilderTester() {} 102 virtual ~GraphBuilderTester() {}
101 103
102 Factory* factory() const { return isolate()->factory(); } 104 Factory* factory() const { return isolate()->factory(); }
103 }; 105 };
104 } // namespace compiler 106 } // namespace compiler
105 } // namespace internal 107 } // namespace internal
106 } // namespace v8 108 } // namespace v8
107 109
108 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ 110 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_
OLDNEW
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | test/cctest/compiler/graph-builder-tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698