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

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

Issue 1457683003: [turbofan] Initial support for escape analysis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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 | « BUILD.gn ('k') | 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_COMPILER_ESCAPE_ANALYSIS_H_
6 #define V8_COMPILER_ESCAPE_ANALYSIS_H_
7
8 #include "src/base/flags.h"
9 #include "src/compiler/graph.h"
10
11 namespace v8 {
12 namespace internal {
13 namespace compiler {
14
15 // Forward declarations.
16 class CommonOperatorBuilder;
17 class EscapeObjectAnalysis;
18 class VirtualState;
19
20
21 // EscapeStatusAnalysis determines for each allocation whether it escapes.
22 class EscapeStatusAnalysis {
23 public:
24 EscapeStatusAnalysis(EscapeObjectAnalysis* object_analysis, Graph* graph,
25 Zone* zone);
26 ~EscapeStatusAnalysis();
27
28 enum EscapeStatusFlag {
29 kUnknown = 0u,
30 kVirtual = 1u << 0,
31 kEscaped = 1u << 1,
32 };
33 typedef base::Flags<EscapeStatusFlag> EscapeStatusFlags;
34
35 void Run();
36
37 bool HasEntry(Node* node);
38 bool IsVirtual(Node* node);
39 bool IsEscaped(Node* node);
40
41 void DebugPrint();
42
43 private:
44 void Process(Node* node);
45 void ProcessAllocate(Node* node);
46 void ProcessFinishRegion(Node* node);
47 void ProcessStoreField(Node* node);
48 bool CheckUsesForEscape(Node* node) { return CheckUsesForEscape(node, node); }
49 bool CheckUsesForEscape(Node* node, Node* rep);
50 void RevisitUses(Node* node);
51 void RevisitInputs(Node* node);
52 bool SetEscaped(Node* node);
53
54 Graph* graph() const { return graph_; }
55 Zone* zone() const { return zone_; }
56
57 EscapeObjectAnalysis* object_analysis_;
58 Graph* const graph_;
59 Zone* const zone_;
60 ZoneVector<EscapeStatusFlags> info_;
61 ZoneDeque<Node*> queue_;
62
63 DISALLOW_COPY_AND_ASSIGN(EscapeStatusAnalysis);
64 };
65
66
67 DEFINE_OPERATORS_FOR_FLAGS(EscapeStatusAnalysis::EscapeStatusFlags)
68
69
70 // EscapeObjectAnalysis simulates stores to determine values of loads if
71 // an object is virtual and eliminated.
72 class EscapeObjectAnalysis {
73 public:
74 EscapeObjectAnalysis(Graph* graph, CommonOperatorBuilder* common, Zone* zone);
75 ~EscapeObjectAnalysis();
76
77 void Run();
78
79 Node* GetReplacement(Node* at, NodeId id);
80
81 private:
82 bool Process(Node* node);
83 void ProcessLoadField(Node* node);
84 void ProcessStoreField(Node* node);
85 void ProcessAllocation(Node* node);
86 void ProcessFinishRegion(Node* node);
87 void ProcessCall(Node* node);
88 void ProcessStart(Node* node);
89 bool ProcessEffectPhi(Node* node);
90 void ForwardVirtualState(Node* node);
91 bool IsEffectBranchPoint(Node* node);
92 bool IsDanglingEffectNode(Node* node);
93 int OffsetFromAccess(Node* node);
94
95 void DebugPrint();
96
97 Graph* graph() const { return graph_; }
98 CommonOperatorBuilder* common() const { return common_; }
99 Zone* zone() const { return zone_; }
100
101 Graph* const graph_;
102 CommonOperatorBuilder* const common_;
103 Zone* const zone_;
104 ZoneVector<VirtualState*> virtual_states_;
105
106 DISALLOW_COPY_AND_ASSIGN(EscapeObjectAnalysis);
107 };
108
109 } // namespace compiler
110 } // namespace internal
111 } // namespace v8
112
113 #endif // V8_COMPILER_ESCAPE_ANALYSIS_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/escape-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698