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

Side by Side Diff: src/compiler/escape-analysis.h

Issue 1499143002: Improve escape analysis (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bug Created 5 years 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 | « no previous file | src/compiler/escape-analysis.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 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_H_ 5 #ifndef V8_COMPILER_ESCAPE_ANALYSIS_H_
6 #define V8_COMPILER_ESCAPE_ANALYSIS_H_ 6 #define V8_COMPILER_ESCAPE_ANALYSIS_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 class CommonOperatorBuilder; 16 class CommonOperatorBuilder;
17 class EscapeAnalysis; 17 class EscapeAnalysis;
18 class VirtualState; 18 class VirtualState;
19 class VirtualObject;
19 20
20 21
21 // EscapeStatusAnalysis determines for each allocation whether it escapes. 22 // EscapeStatusAnalysis determines for each allocation whether it escapes.
22 class EscapeStatusAnalysis { 23 class EscapeStatusAnalysis {
23 public: 24 public:
24 ~EscapeStatusAnalysis(); 25 ~EscapeStatusAnalysis();
25 26
26 enum EscapeStatusFlag { 27 enum EscapeStatusFlag {
27 kUnknown = 0u, 28 kUnknown = 0u,
28 kVirtual = 1u << 0, 29 kVirtual = 1u << 0,
(...skipping 10 matching lines...) Expand all
39 40
40 friend class EscapeAnalysis; 41 friend class EscapeAnalysis;
41 42
42 private: 43 private:
43 EscapeStatusAnalysis(EscapeAnalysis* object_analysis, Graph* graph, 44 EscapeStatusAnalysis(EscapeAnalysis* object_analysis, Graph* graph,
44 Zone* zone); 45 Zone* zone);
45 void Process(Node* node); 46 void Process(Node* node);
46 void ProcessAllocate(Node* node); 47 void ProcessAllocate(Node* node);
47 void ProcessFinishRegion(Node* node); 48 void ProcessFinishRegion(Node* node);
48 void ProcessStoreField(Node* node); 49 void ProcessStoreField(Node* node);
49 bool CheckUsesForEscape(Node* node) { return CheckUsesForEscape(node, node); } 50 void ProcessStoreElement(Node* node);
50 bool CheckUsesForEscape(Node* node, Node* rep); 51 bool CheckUsesForEscape(Node* node, bool phi_escaping = false) {
52 return CheckUsesForEscape(node, node, phi_escaping);
53 }
54 bool CheckUsesForEscape(Node* node, Node* rep, bool phi_escaping = false);
51 void RevisitUses(Node* node); 55 void RevisitUses(Node* node);
52 void RevisitInputs(Node* node); 56 void RevisitInputs(Node* node);
53 bool SetEscaped(Node* node); 57 bool SetEscaped(Node* node);
54 bool HasEntry(Node* node); 58 bool HasEntry(Node* node);
55 59
56 Graph* graph() const { return graph_; } 60 Graph* graph() const { return graph_; }
57 Zone* zone() const { return zone_; } 61 Zone* zone() const { return zone_; }
58 62
59 EscapeAnalysis* object_analysis_; 63 EscapeAnalysis* object_analysis_;
60 Graph* const graph_; 64 Graph* const graph_;
(...skipping 19 matching lines...) Expand all
80 84
81 Node* GetReplacement(Node* at, NodeId id); 85 Node* GetReplacement(Node* at, NodeId id);
82 bool IsVirtual(Node* node); 86 bool IsVirtual(Node* node);
83 bool IsEscaped(Node* node); 87 bool IsEscaped(Node* node);
84 88
85 private: 89 private:
86 void RunObjectAnalysis(); 90 void RunObjectAnalysis();
87 bool Process(Node* node); 91 bool Process(Node* node);
88 void ProcessLoadField(Node* node); 92 void ProcessLoadField(Node* node);
89 void ProcessStoreField(Node* node); 93 void ProcessStoreField(Node* node);
94 void ProcessLoadElement(Node* node);
95 void ProcessStoreElement(Node* node);
96 void ProcessAllocationUsers(Node* node);
90 void ProcessAllocation(Node* node); 97 void ProcessAllocation(Node* node);
91 void ProcessFinishRegion(Node* node); 98 void ProcessFinishRegion(Node* node);
92 void ProcessCall(Node* node); 99 void ProcessCall(Node* node);
93 void ProcessStart(Node* node); 100 void ProcessStart(Node* node);
94 bool ProcessEffectPhi(Node* node); 101 bool ProcessEffectPhi(Node* node);
102 void ProcessLoadFromPhi(int offset, Node* from, Node* node,
103 VirtualState* states);
104
95 void ForwardVirtualState(Node* node); 105 void ForwardVirtualState(Node* node);
106
96 bool IsEffectBranchPoint(Node* node); 107 bool IsEffectBranchPoint(Node* node);
97 bool IsDanglingEffectNode(Node* node); 108 bool IsDanglingEffectNode(Node* node);
98 int OffsetFromAccess(Node* node); 109 int OffsetFromAccess(Node* node);
99 110
111 VirtualObject* GetVirtualObject(Node* at, NodeId id);
112
100 void DebugPrint(); 113 void DebugPrint();
114 void DebugPrintState(VirtualState* state);
115 void DebugPrintObject(VirtualObject* state, NodeId id);
101 116
102 Graph* graph() const { return graph_; } 117 Graph* graph() const { return graph_; }
103 CommonOperatorBuilder* common() const { return common_; } 118 CommonOperatorBuilder* common() const { return common_; }
104 Zone* zone() const { return zone_; } 119 Zone* zone() const { return zone_; }
105 120
106 Graph* const graph_; 121 Graph* const graph_;
107 CommonOperatorBuilder* const common_; 122 CommonOperatorBuilder* const common_;
108 Zone* const zone_; 123 Zone* const zone_;
109 ZoneVector<VirtualState*> virtual_states_; 124 ZoneVector<VirtualState*> virtual_states_;
110 EscapeStatusAnalysis escape_status_; 125 EscapeStatusAnalysis escape_status_;
111 126
112 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis); 127 DISALLOW_COPY_AND_ASSIGN(EscapeAnalysis);
113 }; 128 };
114 129
115 } // namespace compiler 130 } // namespace compiler
116 } // namespace internal 131 } // namespace internal
117 } // namespace v8 132 } // namespace v8
118 133
119 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_ 134 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/escape-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698