v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
late-escape-analysis.h
Go to the documentation of this file.
1// Copyright 2022 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_LATE_ESCAPE_ANALYSIS_H_
6#define V8_COMPILER_LATE_ESCAPE_ANALYSIS_H_
7
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14class CommonOperatorBuilder;
15
16// Eliminate allocated objects that have no uses besides the stores initializing
17// the object.
18class LateEscapeAnalysis final : public AdvancedReducer {
19 public:
20 LateEscapeAnalysis(Editor* editor, TFGraph* graph,
21 CommonOperatorBuilder* common, Zone* zone);
22
23 const char* reducer_name() const override { return "LateEscapeAnalysis"; }
24
25 Reduction Reduce(Node* node) final;
26 void Finalize() override;
27
28 private:
29 bool IsEscaping(Node* node);
30 void RemoveAllocation(Node* node);
31 void RecordEscapingAllocation(Node* allocation);
32 void RemoveWitness(Node* allocation);
33 Node* dead() const { return dead_; }
34
37 // Key: Allocation; Value: Number of witnesses for the allocation escaping.
40};
41
42} // namespace compiler
43} // namespace internal
44} // namespace v8
45
46#endif // V8_COMPILER_LATE_ESCAPE_ANALYSIS_H_
LateEscapeAnalysis(Editor *editor, TFGraph *graph, CommonOperatorBuilder *common, Zone *zone)
ZoneUnorderedMap< Node *, int > escaping_allocations_