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_COMPILER_CONTROL_REDUCER_H_ | 5 #ifndef V8_COMPILER_CONTROL_REDUCER_H_ |
6 #define V8_COMPILER_CONTROL_REDUCER_H_ | 6 #define V8_COMPILER_CONTROL_REDUCER_H_ |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
11 // Forward declarations. | 11 // Forward declarations. |
12 class Zone; | 12 class Zone; |
13 | 13 |
14 | 14 |
15 namespace compiler { | 15 namespace compiler { |
16 | 16 |
17 // Forward declarations. | 17 // Forward declarations. |
18 class JSGraph; | 18 class JSGraph; |
19 class CommonOperatorBuilder; | 19 class CommonOperatorBuilder; |
20 class Node; | 20 class Node; |
21 | 21 |
22 class ControlReducer { | 22 class ControlReducer { |
23 public: | 23 public: |
24 // Perform branch folding and dead code elimination on the graph. | 24 // Perform branch folding and dead code elimination on the graph. |
25 static void ReduceGraph(Zone* zone, JSGraph* graph, | 25 static void ReduceGraph(Zone* zone, JSGraph* graph, |
26 CommonOperatorBuilder* builder); | 26 CommonOperatorBuilder* builder, |
| 27 int max_phis_for_select = 0); |
27 | 28 |
28 // Trim nodes in the graph that are not reachable from end. | 29 // Trim nodes in the graph that are not reachable from end. |
29 static void TrimGraph(Zone* zone, JSGraph* graph); | 30 static void TrimGraph(Zone* zone, JSGraph* graph); |
30 | 31 |
31 // Reduces a single merge node and attached phis. | 32 // Reduces a single merge node and attached phis. |
32 static Node* ReduceMerge(JSGraph* graph, CommonOperatorBuilder* builder, | 33 static Node* ReduceMerge(JSGraph* graph, CommonOperatorBuilder* builder, |
33 Node* node); | 34 Node* node, int max_phis_for_select = 0); |
34 | 35 |
35 // Testing interface. | 36 // Testing interface. |
36 static Node* ReducePhiForTesting(JSGraph* graph, | 37 static Node* ReducePhiForTesting(JSGraph* graph, |
37 CommonOperatorBuilder* builder, Node* node); | 38 CommonOperatorBuilder* builder, Node* node); |
38 static Node* ReduceIfNodeForTesting(JSGraph* graph, | 39 static Node* ReduceIfNodeForTesting(JSGraph* graph, |
39 CommonOperatorBuilder* builder, | 40 CommonOperatorBuilder* builder, |
40 Node* node); | 41 Node* node); |
41 }; | 42 }; |
42 } | 43 } |
43 } | 44 } |
44 } // namespace v8::internal::compiler | 45 } // namespace v8::internal::compiler |
45 | 46 |
46 #endif // V8_COMPILER_CONTROL_REDUCER_H_ | 47 #endif // V8_COMPILER_CONTROL_REDUCER_H_ |
OLD | NEW |