v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
local-decl-encoder.h
Go to the documentation of this file.
1
// Copyright 2017 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_LOCAL_DECL_ENCODER_H_
6
#define V8_WASM_LOCAL_DECL_ENCODER_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
#include "
src/common/globals.h
"
13
#include "
src/wasm/wasm-opcodes.h
"
14
#include "
src/zone/zone-containers.h
"
15
#include "
src/zone/zone.h
"
16
17
namespace
v8
{
18
namespace
internal
{
19
namespace
wasm
{
20
21
// A helper for encoding local declarations prepended to the body of a function.
22
class
V8_EXPORT_PRIVATE
LocalDeclEncoder
{
23
public
:
24
explicit
LocalDeclEncoder
(
Zone
* zone,
const
FunctionSig
* s =
nullptr
)
25
:
sig
(s), local_decls(zone), total(0) {}
26
27
// Prepend local declarations by creating a new buffer and copying data
28
// over. The new buffer must be delete[]'d by the caller.
29
void
Prepend(
Zone
* zone,
const
uint8_t**
start
,
const
uint8_t**
end
)
const
;
30
31
size_t
Emit(uint8_t* buffer)
const
;
32
33
// Add locals declarations to this helper. Return the index of the newly added
34
// local(s), with an optional adjustment for the parameters.
35
uint32_t AddLocals(uint32_t
count
,
ValueType
type);
36
37
size_t
Size()
const
;
38
39
bool
has_sig
()
const
{
return
sig
!=
nullptr
; }
40
const
FunctionSig
*
get_sig
()
const
{
return
sig
; }
41
void
set_sig
(
const
FunctionSig
* s) {
sig
=
s
; }
42
43
private
:
44
const
FunctionSig
*
sig
;
45
ZoneVector<std::pair<uint32_t, ValueType>
>
local_decls
;
46
size_t
total
;
47
};
48
49
}
// namespace wasm
50
}
// namespace internal
51
}
// namespace v8
52
53
#endif
// V8_WASM_LOCAL_DECL_ENCODER_H_
v8::internal::Signature< ValueType >
v8::internal::ZoneVector
Definition
zone-containers.h:53
v8::internal::Zone
Definition
zone.h:43
v8::internal::wasm::LocalDeclEncoder
Definition
local-decl-encoder.h:22
v8::internal::wasm::LocalDeclEncoder::set_sig
void set_sig(const FunctionSig *s)
Definition
local-decl-encoder.h:41
v8::internal::wasm::LocalDeclEncoder::LocalDeclEncoder
LocalDeclEncoder(Zone *zone, const FunctionSig *s=nullptr)
Definition
local-decl-encoder.h:24
v8::internal::wasm::LocalDeclEncoder::total
size_t total
Definition
local-decl-encoder.h:46
v8::internal::wasm::LocalDeclEncoder::get_sig
const FunctionSig * get_sig() const
Definition
local-decl-encoder.h:40
v8::internal::wasm::LocalDeclEncoder::has_sig
bool has_sig() const
Definition
local-decl-encoder.h:39
v8::internal::wasm::LocalDeclEncoder::local_decls
ZoneVector< std::pair< uint32_t, ValueType > > local_decls
Definition
local-decl-encoder.h:45
v8::internal::wasm::LocalDeclEncoder::sig
const FunctionSig * sig
Definition
local-decl-encoder.h:44
v8::internal::wasm::ValueType
Definition
value-type.h:878
globals.h
start
int start
Definition
debug-coverage.cc:595
end
int end
Definition
debug-coverage.cc:596
s
int s
Definition
mul-fft.cc:297
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::sig
kWasmInternalFunctionIndirectPointerTag kProtectedInstanceDataOffset sig
Definition
wasm-objects-inl.h:476
v8
Definition
api-arguments-inl.h:19
wasm
Definition
c-api.cc:87
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
v8::internal::count
Definition
v8-fast-api-calls.h:511
wasm-opcodes.h
zone-containers.h
zone.h
src
wasm
local-decl-encoder.h
Generated on Sun Apr 6 2025 21:08:58 for v8 by
1.12.0