summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/local-decl-encoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/wasm/local-decl-encoder.cc')
-rw-r--r--deps/v8/src/wasm/local-decl-encoder.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/deps/v8/src/wasm/local-decl-encoder.cc b/deps/v8/src/wasm/local-decl-encoder.cc
index 8130cbb6a4..e7d1c5f21b 100644
--- a/deps/v8/src/wasm/local-decl-encoder.cc
+++ b/deps/v8/src/wasm/local-decl-encoder.cc
@@ -41,6 +41,9 @@ size_t LocalDeclEncoder::Emit(byte* buffer) const {
*pos = locals_type.depth();
++pos;
}
+ if (locals_type.is_rtt()) {
+ LEBHelper::write_u32v(&pos, locals_type.ref_index());
+ }
if (locals_type.encoding_needs_heap_type()) {
LEBHelper::write_i32v(&pos, locals_type.heap_type().code());
}
@@ -66,12 +69,14 @@ uint32_t LocalDeclEncoder::AddLocals(uint32_t count, ValueType type) {
size_t LocalDeclEncoder::Size() const {
size_t size = LEBHelper::sizeof_u32v(local_decls.size());
for (auto p : local_decls) {
- size += LEBHelper::sizeof_u32v(p.first) + // number of locals
- 1 + // Opcode
- (p.second.has_depth() ? 1 : 0) + // Inheritance depth
- (p.second.encoding_needs_heap_type()
- ? LEBHelper::sizeof_i32v(p.second.heap_type().code())
- : 0); // ref. index
+ size +=
+ LEBHelper::sizeof_u32v(p.first) + // number of locals
+ 1 + // Opcode
+ (p.second.has_depth() ? 1 : 0) + // Inheritance depth
+ (p.second.encoding_needs_heap_type()
+ ? LEBHelper::sizeof_i32v(p.second.heap_type().code())
+ : 0) +
+ (p.second.is_rtt() ? LEBHelper::sizeof_u32v(p.second.ref_index()) : 0);
}
return size;
}