• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 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 #if !V8_ENABLE_WEBASSEMBLY
6 #error This header should only be included if WebAssembly is enabled.
7 #endif  // !V8_ENABLE_WEBASSEMBLY
8 
9 #ifndef V8_COMPILER_WASM_ESCAPE_ANALYSIS_H_
10 #define V8_COMPILER_WASM_ESCAPE_ANALYSIS_H_
11 
12 #include "src/compiler/graph-reducer.h"
13 
14 namespace v8 {
15 namespace internal {
16 namespace compiler {
17 
18 class MachineGraph;
19 
20 // Eliminate allocated objects which are only assigned to.
21 // Current restrictions: Does not work for arrays (until they are also allocated
22 // with AllocateRaw). Does not work if the allocated object is passed to a phi.
23 class WasmEscapeAnalysis final : public AdvancedReducer {
24  public:
WasmEscapeAnalysis(Editor * editor,MachineGraph * mcgraph)25   WasmEscapeAnalysis(Editor* editor, MachineGraph* mcgraph)
26       : AdvancedReducer(editor), mcgraph_(mcgraph) {}
27 
reducer_name()28   const char* reducer_name() const override { return "WasmEscapeAnalysis"; }
29 
30   Reduction Reduce(Node* node) final;
31 
32  private:
33   Reduction ReduceAllocateRaw(Node* call);
34   MachineGraph* const mcgraph_;
35 };
36 
37 }  // namespace compiler
38 }  // namespace internal
39 }  // namespace v8
40 
41 #endif  // V8_COMPILER_WASM_ESCAPE_ANALYSIS_H_
42