summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/graph-builder-interface.h
blob: 2af67b3bc3171dd72c0fae596348ada79f7293f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2018 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.

#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif  // !V8_ENABLE_WEBASSEMBLY

#ifndef V8_WASM_GRAPH_BUILDER_INTERFACE_H_
#define V8_WASM_GRAPH_BUILDER_INTERFACE_H_

#include "src/wasm/decoder.h"
#include "src/wasm/wasm-result.h"

namespace v8 {
namespace internal {

class AccountingAllocator;

namespace compiler {  // external declarations from compiler.
class Node;
class NodeOriginTable;
class WasmGraphBuilder;
struct WasmLoopInfo;
}  // namespace compiler

namespace wasm {

class AssumptionsJournal;
struct FunctionBody;
class WasmFeatures;
struct WasmModule;

enum InlinedStatus {
  // Inlined function whose call node has IfSuccess/IfException outputs.
  kInlinedHandledCall,
  // Inlined function whose call node does not have IfSuccess/IfException
  // outputs.
  kInlinedNonHandledCall,
  // Not an inlined call.
  kRegularFunction
};

struct DanglingExceptions {
  std::vector<compiler::Node*> exception_values;
  std::vector<compiler::Node*> effects;
  std::vector<compiler::Node*> controls;

  void Add(compiler::Node* exception_value, compiler::Node* effect,
           compiler::Node* control) {
    exception_values.emplace_back(exception_value);
    effects.emplace_back(effect);
    controls.emplace_back(control);
  }

  size_t Size() const { return exception_values.size(); }
};

V8_EXPORT_PRIVATE void BuildTFGraph(
    AccountingAllocator* allocator, const WasmFeatures& enabled,
    const WasmModule* module, compiler::WasmGraphBuilder* builder,
    WasmFeatures* detected, const FunctionBody& body,
    std::vector<compiler::WasmLoopInfo>* loop_infos,
    DanglingExceptions* dangling_exceptions,
    compiler::NodeOriginTable* node_origins, int func_index,
    AssumptionsJournal* assumptions, InlinedStatus inlined_status);

}  // namespace wasm
}  // namespace internal
}  // namespace v8

#endif  // V8_WASM_GRAPH_BUILDER_INTERFACE_H_