v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
c-api.h
Go to the documentation of this file.
1// Copyright 2019 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_WASM_C_API_H_
6#define V8_WASM_C_API_H_
7
8#if !V8_ENABLE_WEBASSEMBLY
9#error This header should only be included if WebAssembly is enabled.
10#endif // !V8_ENABLE_WEBASSEMBLY
11
12#if !defined(BUILDING_V8_SHARED) && !defined(USING_V8_SHARED)
13#define LIBWASM_STATIC 1
14#endif
15
16#include "include/v8-isolate.h"
18#include "src/common/globals.h"
19#include "src/handles/handles.h"
20#include "third_party/wasm-api/wasm.hh"
21
22namespace v8 {
23namespace internal {
24
25class JSWeakMap;
26
27} // namespace internal
28} // namespace v8
29
30namespace wasm {
31
32class StoreImpl {
33 public:
34 ~StoreImpl();
35
36 void destroy();
37
38 v8::Isolate* isolate() const { return isolate_; }
40 return reinterpret_cast<i::Isolate*>(isolate_);
41 }
42
44
45 static StoreImpl* get(i::Isolate* isolate) {
46 return static_cast<StoreImpl*>(
47 reinterpret_cast<v8::Isolate*>(isolate)->GetData(0));
48 }
49
50 void SetHostInfo(i::DirectHandle<i::Object> object, void* info,
51 void (*finalizer)(void*));
53
54 private:
55 friend own<Store> Store::make(Engine*);
56
57 StoreImpl() = default;
58
63};
64
65} // namespace wasm
66
67#endif // V8_WASM_C_API_H_
V8_INLINE Local< T > Get(Isolate *isolate) const
V8_INLINE void * GetData(uint32_t slot)
void destroy()
Definition c-api.cc:469
v8::Eternal< v8::Context > context_
Definition c-api.h:61
static StoreImpl * get(i::Isolate *isolate)
Definition c-api.h:45
i::IndirectHandle< i::JSWeakMap > host_info_map_
Definition c-api.h:62
v8::Isolate * isolate() const
Definition c-api.h:38
i::Isolate * i_isolate() const
Definition c-api.h:39
v8::Isolate::CreateParams create_params_
Definition c-api.h:59
void SetHostInfo(i::DirectHandle< i::Object > object, void *info, void(*finalizer)(void *))
Definition c-api.cc:500
void * GetHostInfo(i::DirectHandle< i::Object > key)
Definition c-api.cc:515
v8::Local< v8::Context > context() const
Definition c-api.h:43
friend own< Store > Store::make(Engine *)
StoreImpl()=default
v8::Isolate * isolate_
Definition c-api.h:60
Definition c-api.cc:87
std::unique_ptr< ValueMirror > key