OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_ESCAPE_ANALYSIS_REDUCER_H_ | 5 #ifndef V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_ |
6 #define V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_ | 6 #define V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_ |
7 | 7 |
8 #include "src/bit-vector.h" | 8 #include "src/bit-vector.h" |
9 #include "src/compiler/escape-analysis.h" | 9 #include "src/compiler/escape-analysis.h" |
10 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
11 | 11 |
12 | |
13 namespace v8 { | 12 namespace v8 { |
14 namespace internal { | 13 namespace internal { |
15 | |
16 // Forward declarations. | |
17 class Counters; | |
18 | |
19 | |
20 namespace compiler { | 14 namespace compiler { |
21 | 15 |
22 // Forward declarations. | 16 // Forward declarations. |
23 class JSGraph; | 17 class JSGraph; |
24 | 18 |
25 | |
26 class EscapeAnalysisReducer final : public AdvancedReducer { | 19 class EscapeAnalysisReducer final : public AdvancedReducer { |
27 public: | 20 public: |
28 EscapeAnalysisReducer(Editor* editor, JSGraph* jsgraph, | 21 EscapeAnalysisReducer(Editor* editor, JSGraph* jsgraph, |
29 EscapeAnalysis* escape_analysis, Zone* zone); | 22 EscapeAnalysis* escape_analysis, Zone* zone); |
30 | 23 |
31 Reduction Reduce(Node* node) final; | 24 Reduction Reduce(Node* node) final; |
| 25 |
| 26 // Verifies that all virtual allocation nodes have been dealt with. Run it |
| 27 // after this reducer has been applied. Has no effect in release mode. |
32 void VerifyReplacement() const; | 28 void VerifyReplacement() const; |
33 | 29 |
34 private: | 30 private: |
35 Reduction ReduceLoad(Node* node); | 31 Reduction ReduceLoad(Node* node); |
36 Reduction ReduceStore(Node* node); | 32 Reduction ReduceStore(Node* node); |
37 Reduction ReduceAllocate(Node* node); | 33 Reduction ReduceAllocate(Node* node); |
38 Reduction ReduceFinishRegion(Node* node); | 34 Reduction ReduceFinishRegion(Node* node); |
39 Reduction ReduceReferenceEqual(Node* node); | 35 Reduction ReduceReferenceEqual(Node* node); |
40 Reduction ReduceObjectIsSmi(Node* node); | 36 Reduction ReduceObjectIsSmi(Node* node); |
41 Reduction ReduceFrameStateUses(Node* node); | 37 Reduction ReduceFrameStateUses(Node* node); |
42 Node* ReduceDeoptState(Node* node, Node* effect, bool multiple_users); | 38 Node* ReduceDeoptState(Node* node, Node* effect, bool multiple_users); |
43 Node* ReduceStateValueInput(Node* node, int node_index, Node* effect, | 39 Node* ReduceStateValueInput(Node* node, int node_index, Node* effect, |
44 bool node_multiused, bool already_cloned, | 40 bool node_multiused, bool already_cloned, |
45 bool multiple_users); | 41 bool multiple_users); |
46 | 42 |
47 JSGraph* jsgraph() const { return jsgraph_; } | 43 JSGraph* jsgraph() const { return jsgraph_; } |
48 EscapeAnalysis* escape_analysis() const { return escape_analysis_; } | 44 EscapeAnalysis* escape_analysis() const { return escape_analysis_; } |
49 Zone* zone() const { return zone_; } | 45 Zone* zone() const { return zone_; } |
50 Counters* counters() const; | 46 Isolate* isolate() const; |
51 | 47 |
52 JSGraph* const jsgraph_; | 48 JSGraph* const jsgraph_; |
53 EscapeAnalysis* escape_analysis_; | 49 EscapeAnalysis* escape_analysis_; |
54 Zone* const zone_; | 50 Zone* const zone_; |
55 // _visited marks nodes we already processed (allocs, loads, stores) | 51 // This bit vector marks nodes we already processed (allocs, loads, stores) |
56 // and nodes that do not need a visit from ReduceDeoptState etc. | 52 // and nodes that do not need a visit from ReduceDeoptState etc. |
57 BitVector fully_reduced_; | 53 BitVector fully_reduced_; |
58 bool exists_virtual_allocate_; | 54 bool exists_virtual_allocate_; |
59 | 55 |
60 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysisReducer); | 56 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysisReducer); |
61 }; | 57 }; |
62 | 58 |
63 } // namespace compiler | 59 } // namespace compiler |
64 } // namespace internal | 60 } // namespace internal |
65 } // namespace v8 | 61 } // namespace v8 |
66 | 62 |
67 #endif // V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_ | 63 #endif // V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_ |
OLD | NEW |