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 #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/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/instruction-selector.h" | 9 #include "src/compiler/instruction-selector.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
11 #include "src/compiler/machine-operator.h" | 11 #include "src/compiler/machine-operator.h" |
12 #include "src/compiler/operator-properties.h" | 12 #include "src/compiler/operator-properties.h" |
13 #include "src/compiler/pipeline.h" | 13 #include "src/compiler/pipeline.h" |
14 #include "src/compiler/simplified-operator.h" | 14 #include "src/compiler/simplified-operator.h" |
15 #include "test/cctest/cctest.h" | 15 #include "test/cctest/cctest.h" |
16 #include "test/cctest/compiler/call-tester.h" | 16 #include "test/cctest/compiler/call-tester.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 namespace compiler { | 20 namespace compiler { |
21 | 21 |
22 class GraphAndBuilders { | 22 class GraphAndBuilders { |
23 public: | 23 public: |
24 explicit GraphAndBuilders(Zone* zone) | 24 explicit GraphAndBuilders(Zone* zone) |
25 : main_graph_(new (zone) Graph(zone)), | 25 : main_graph_(new (zone) Graph(zone)), |
26 main_common_(zone), | 26 main_common_(zone), |
27 main_machine_(zone, kMachPtr, | 27 main_machine_(zone, MachineType::PointerRepresentation(), |
28 InstructionSelector::SupportedMachineOperatorFlags()), | 28 InstructionSelector::SupportedMachineOperatorFlags()), |
29 main_simplified_(zone) {} | 29 main_simplified_(zone) {} |
30 | 30 |
31 Graph* graph() const { return main_graph_; } | 31 Graph* graph() const { return main_graph_; } |
32 Zone* zone() const { return graph()->zone(); } | 32 Zone* zone() const { return graph()->zone(); } |
33 CommonOperatorBuilder* common() { return &main_common_; } | 33 CommonOperatorBuilder* common() { return &main_common_; } |
34 MachineOperatorBuilder* machine() { return &main_machine_; } | 34 MachineOperatorBuilder* machine() { return &main_machine_; } |
35 SimplifiedOperatorBuilder* simplified() { return &main_simplified_; } | 35 SimplifiedOperatorBuilder* simplified() { return &main_simplified_; } |
36 | 36 |
37 protected: | 37 protected: |
38 // Prefixed with main_ to avoid naming conflicts. | 38 // Prefixed with main_ to avoid naming conflicts. |
39 Graph* main_graph_; | 39 Graph* main_graph_; |
40 CommonOperatorBuilder main_common_; | 40 CommonOperatorBuilder main_common_; |
41 MachineOperatorBuilder main_machine_; | 41 MachineOperatorBuilder main_machine_; |
42 SimplifiedOperatorBuilder main_simplified_; | 42 SimplifiedOperatorBuilder main_simplified_; |
43 }; | 43 }; |
44 | 44 |
45 | 45 |
46 template <typename ReturnType> | 46 template <typename ReturnType> |
47 class GraphBuilderTester : public HandleAndZoneScope, | 47 class GraphBuilderTester : public HandleAndZoneScope, |
48 public GraphAndBuilders, | 48 public GraphAndBuilders, |
49 public CallHelper<ReturnType> { | 49 public CallHelper<ReturnType> { |
50 public: | 50 public: |
51 explicit GraphBuilderTester(MachineType p0 = kMachNone, | 51 explicit GraphBuilderTester(MachineType p0 = MachineType::None(), |
52 MachineType p1 = kMachNone, | 52 MachineType p1 = MachineType::None(), |
53 MachineType p2 = kMachNone, | 53 MachineType p2 = MachineType::None(), |
54 MachineType p3 = kMachNone, | 54 MachineType p3 = MachineType::None(), |
55 MachineType p4 = kMachNone) | 55 MachineType p4 = MachineType::None()) |
56 : GraphAndBuilders(main_zone()), | 56 : GraphAndBuilders(main_zone()), |
57 CallHelper<ReturnType>( | 57 CallHelper<ReturnType>( |
58 main_isolate(), | 58 main_isolate(), |
59 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, p1, | 59 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, p1, |
60 p2, p3, p4)), | 60 p2, p3, p4)), |
61 effect_(NULL), | 61 effect_(NULL), |
62 return_(NULL), | 62 return_(NULL), |
63 parameters_(main_zone()->template NewArray<Node*>(parameter_count())) { | 63 parameters_(main_zone()->template NewArray<Node*>(parameter_count())) { |
64 Begin(static_cast<int>(parameter_count())); | 64 Begin(static_cast<int>(parameter_count())); |
65 InitParameters(); | 65 InitParameters(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 Node* return_; | 303 Node* return_; |
304 Node** parameters_; | 304 Node** parameters_; |
305 MaybeHandle<Code> code_; | 305 MaybeHandle<Code> code_; |
306 }; | 306 }; |
307 | 307 |
308 } // namespace compiler | 308 } // namespace compiler |
309 } // namespace internal | 309 } // namespace internal |
310 } // namespace v8 | 310 } // namespace v8 |
311 | 311 |
312 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ | 312 #endif // V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ |
OLD | NEW |