escape-analysis-reducer.h 2.07 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_
#define V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_

8
#include "src/bit-vector.h"
9 10 11 12 13 14 15 16 17 18 19 20 21
#include "src/compiler/escape-analysis.h"
#include "src/compiler/graph-reducer.h"

namespace v8 {
namespace internal {
namespace compiler {

// Forward declarations.
class JSGraph;

class EscapeAnalysisReducer final : public AdvancedReducer {
 public:
  EscapeAnalysisReducer(Editor* editor, JSGraph* jsgraph,
22
                        EscapeAnalysis* escape_analysis, Zone* zone);
23 24

  Reduction Reduce(Node* node) final;
25 26 27

  // Verifies that all virtual allocation nodes have been dealt with. Run it
  // after this reducer has been applied. Has no effect in release mode.
28
  void VerifyReplacement() const;
29 30

 private:
31 32
  Reduction ReduceLoad(Node* node);
  Reduction ReduceStore(Node* node);
33 34 35
  Reduction ReduceAllocate(Node* node);
  Reduction ReduceFinishRegion(Node* node);
  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 43

  JSGraph* jsgraph() const { return jsgraph_; }
44
  EscapeAnalysis* escape_analysis() const { return escape_analysis_; }
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 57 58 59 60 61 62 63

  DISALLOW_COPY_AND_ASSIGN(EscapeAnalysisReducer);
};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_ESCAPE_ANALYSIS_REDUCER_H_