Line data Source code
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/base/compiler-specific.h"
9 : #include "src/bit-vector.h"
10 : #include "src/compiler/escape-analysis.h"
11 : #include "src/compiler/graph-reducer.h"
12 : #include "src/globals.h"
13 :
14 : namespace v8 {
15 : namespace internal {
16 : namespace compiler {
17 :
18 : // Forward declarations.
19 : class JSGraph;
20 :
21 39760 : class V8_EXPORT_PRIVATE EscapeAnalysisReducer final
22 : : public NON_EXPORTED_BASE(AdvancedReducer) {
23 : public:
24 : EscapeAnalysisReducer(Editor* editor, JSGraph* jsgraph,
25 : EscapeAnalysis* escape_analysis, Zone* zone);
26 :
27 : Reduction Reduce(Node* node) final;
28 :
29 : void Finalize() override;
30 :
31 : // Verifies that all virtual allocation nodes have been dealt with. Run it
32 : // after this reducer has been applied. Has no effect in release mode.
33 : void VerifyReplacement() const;
34 :
35 : bool compilation_failed() const { return compilation_failed_; }
36 :
37 : private:
38 : Reduction ReduceNode(Node* node);
39 : Reduction ReduceLoad(Node* node);
40 : Reduction ReduceStore(Node* node);
41 : Reduction ReduceCheckMaps(Node* node);
42 : Reduction ReduceAllocate(Node* node);
43 : Reduction ReduceFinishRegion(Node* node);
44 : Reduction ReduceReferenceEqual(Node* node);
45 : Reduction ReduceObjectIsSmi(Node* node);
46 : Reduction ReduceFrameStateUses(Node* node);
47 : Node* ReduceDeoptState(Node* node, Node* effect, bool multiple_users);
48 : Node* ReduceStateValueInput(Node* node, int node_index, Node* effect,
49 : bool node_multiused, bool already_cloned,
50 : bool multiple_users);
51 :
52 : JSGraph* jsgraph() const { return jsgraph_; }
53 : EscapeAnalysis* escape_analysis() const { return escape_analysis_; }
54 : Zone* zone() const { return zone_; }
55 :
56 : JSGraph* const jsgraph_;
57 : EscapeAnalysis* escape_analysis_;
58 : Zone* const zone_;
59 : // This bit vector marks nodes we already processed (allocs, loads, stores)
60 : // and nodes that do not need a visit from ReduceDeoptState etc.
61 : BitVector fully_reduced_;
62 : bool exists_virtual_allocate_;
63 : std::set<Node*> arguments_elements_;
64 : bool compilation_failed_ = false;
65 :
66 : DISALLOW_COPY_AND_ASSIGN(EscapeAnalysisReducer);
67 : };
68 :
69 : } // namespace compiler
70 : } // namespace internal
71 : } // namespace v8
72 :
73 : #endif // V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_
|