blob: d51bc085aae38f62dfc609244ed2bef10819e27f (
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
|
// Copyright 2017 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_WASM_WASM_CODE_WRAPPER_H_
#define V8_WASM_WASM_CODE_WRAPPER_H_
#include "src/handles.h"
namespace v8 {
namespace internal {
namespace wasm {
class WasmCode;
} // namespace wasm
class Code;
struct WasmContext;
class WasmInstanceObject;
// TODO(mtrofin): remove once we remove FLAG_wasm_jit_to_native
class WasmCodeWrapper {
public:
WasmCodeWrapper() {}
explicit WasmCodeWrapper(Handle<Code> code);
explicit WasmCodeWrapper(const wasm::WasmCode* code);
Handle<Code> GetCode() const;
const wasm::WasmCode* GetWasmCode() const;
bool is_null() const { return code_ptr_.wasm_code_ == nullptr; }
bool IsCodeObject() const;
bool is_liftoff() const;
Vector<uint8_t> instructions() const;
WasmInstanceObject* wasm_instance() const;
WasmContext* wasm_context() const;
#ifdef ENABLE_DISASSEMBLER
void Disassemble(const char* name, Isolate* isolate, std::ostream& os) const;
#endif
private:
union {
const wasm::WasmCode* wasm_code_;
Code** code_handle_;
} code_ptr_ = {};
};
} // namespace internal
} // namespace v8
#endif // V8_WASM_WASM_CODE_WRAPPER_H_
|