Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: src/wasm/wasm-module-builder.cc

Issue 2501873003: [wasm] Be more lenient on the names section. (Closed)
Patch Set: Fix builders to add empty import names. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module-builder.cc
diff --git a/src/wasm/wasm-module-builder.cc b/src/wasm/wasm-module-builder.cc
index eaa3451e3f9a5238351feeb9502298ba7324db96..290e98ecf8c224bb68f132669230541f23e4565b 100644
--- a/src/wasm/wasm-module-builder.cc
+++ b/src/wasm/wasm-module-builder.cc
@@ -509,7 +509,12 @@ void WasmModuleBuilder::WriteTo(ZoneBuffer& buffer) const {
buffer.write_size(4);
buffer.write(reinterpret_cast<const byte*>("name"), 4);
// Emit the names.
- buffer.write_size(functions_.size());
+ size_t count = functions_.size() + imports_.size();
+ buffer.write_size(count);
+ for (size_t i = 0; i < imports_.size(); i++) {
+ buffer.write_u8(0); // empty name for import
+ buffer.write_u8(0); // no local variables
+ }
for (auto function : functions_) {
buffer.write_size(function->name_.size());
if (function->name_.size() > 0) {
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698