V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
local-decl-encoder.h
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
#include "src/globals.h"
9
#include "src/wasm/wasm-opcodes.h"
10
#include "src/zone/zone-containers.h"
11
#include "src/zone/zone.h"
12
13
namespace
v8
{
14
namespace
internal {
15
namespace
wasm {
16
17
// A helper for encoding local declarations prepended to the body of a
18
// function.
19
class
V8_EXPORT_PRIVATE
LocalDeclEncoder
{
20
public
:
21
explicit
LocalDeclEncoder
(
Zone
* zone,
FunctionSig
* s =
nullptr
)
22
: sig(s), local_decls(zone), total(0) {}
23
24
// Prepend local declarations by creating a new buffer and copying data
25
// over. The new buffer must be delete[]'d by the caller.
26
void
Prepend(
Zone
* zone,
const
byte** start,
const
byte** end)
const
;
27
28
size_t
Emit(byte* buffer)
const
;
29
30
// Add locals declarations to this helper. Return the index of the newly added
31
// local(s), with an optional adjustment for the parameters.
32
uint32_t
AddLocals(
uint32_t
count, ValueType
type
);
33
34
size_t
Size()
const
;
35
36
bool
has_sig()
const
{
return
sig !=
nullptr
; }
37
FunctionSig
* get_sig()
const
{
return
sig; }
38
void
set_sig(
FunctionSig
* s) { sig = s; }
39
40
private
:
41
FunctionSig
* sig;
42
ZoneVector<std::pair<uint32_t, ValueType>
> local_decls;
43
size_t
total;
44
};
45
46
}
// namespace wasm
47
}
// namespace internal
48
}
// namespace v8
49
50
#endif // V8_WASM_LOCAL_DECL_ENCODER_H_
v8::internal::wasm::LocalDeclEncoder
Definition:
local-decl-encoder.h:19
v8
Definition:
libplatform.h:13
v8::internal::Signature
Definition:
code-assembler.h:71
v8::internal::Zone
Definition:
zone.h:42
uint32_t
type
v8::internal::ZoneVector
Definition:
node-cache.h:17
v8
src
wasm
local-decl-encoder.h
Generated on Tue Dec 25 2018 14:40:00 by
1.8.14