• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_REDUCER_H_
6 #define V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_
7 
8 #include "src/bit-vector.h"
9 #include "src/compiler/escape-analysis.h"
10 #include "src/compiler/graph-reducer.h"
11 
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15 
16 // Forward declarations.
17 class JSGraph;
18 
19 class EscapeAnalysisReducer final : public AdvancedReducer {
20  public:
21   EscapeAnalysisReducer(Editor* editor, JSGraph* jsgraph,
22                         EscapeAnalysis* escape_analysis, Zone* zone);
23 
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.
28   void VerifyReplacement() const;
29 
30  private:
31   Reduction ReduceLoad(Node* node);
32   Reduction ReduceStore(Node* node);
33   Reduction ReduceAllocate(Node* node);
34   Reduction ReduceFinishRegion(Node* node);
35   Reduction ReduceReferenceEqual(Node* node);
36   Reduction ReduceObjectIsSmi(Node* node);
37   Reduction ReduceFrameStateUses(Node* node);
38   Node* ReduceDeoptState(Node* node, Node* effect, bool multiple_users);
39   Node* ReduceStateValueInput(Node* node, int node_index, Node* effect,
40                               bool node_multiused, bool already_cloned,
41                               bool multiple_users);
42 
jsgraph()43   JSGraph* jsgraph() const { return jsgraph_; }
escape_analysis()44   EscapeAnalysis* escape_analysis() const { return escape_analysis_; }
zone()45   Zone* zone() const { return zone_; }
46   Isolate* isolate() const;
47 
48   JSGraph* const jsgraph_;
49   EscapeAnalysis* escape_analysis_;
50   Zone* const zone_;
51   // This bit vector marks nodes we already processed (allocs, loads, stores)
52   // and nodes that do not need a visit from ReduceDeoptState etc.
53   BitVector fully_reduced_;
54   bool exists_virtual_allocate_;
55 
56   DISALLOW_COPY_AND_ASSIGN(EscapeAnalysisReducer);
57 };
58 
59 }  // namespace compiler
60 }  // namespace internal
61 }  // namespace v8
62 
63 #endif  // V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_
64