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

Unified Diff: test/mjsunit/wasm/wasm-module-builder.js

Issue 1896863003: [wasm] Binary 11: Module changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months 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 | « test/mjsunit/wasm/wasm-constants.js ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/wasm-module-builder.js
diff --git a/test/mjsunit/wasm/wasm-module-builder.js b/test/mjsunit/wasm/wasm-module-builder.js
index 1c138909209e74db55ded549f151c984d7585405..2e8c23ee2ed7b87de359827fb42ca95b55b2764f 100644
--- a/test/mjsunit/wasm/wasm-module-builder.js
+++ b/test/mjsunit/wasm/wasm-module-builder.js
@@ -53,7 +53,7 @@ WasmModuleBuilder.prototype.addExplicitSection = function(bytes) {
return this;
}
-// Add a signature; format is [rettype, param0, param1, ...]
+// Add a signature; format is [param_count, param0, param1, ..., retcount, ret0]
WasmModuleBuilder.prototype.addSignature = function(sig) {
// TODO: canonicalize signatures?
this.signatures.push(sig);
@@ -132,12 +132,14 @@ function emit_bytes(bytes, data) {
}
function emit_section(bytes, section_code, content_generator) {
- // Start the section in a temporary buffer: its full length isn't know yet.
+ // Emit section name.
+ emit_string(bytes, section_names[section_code]);
+ // Emit the section to a temporary buffer: its full length isn't know yet.
var tmp_bytes = [];
- emit_string(tmp_bytes, section_names[section_code]);
content_generator(tmp_bytes);
- // Now that we know the section length, emit it and copy the section.
+ // Emit section length.
emit_varint(bytes, tmp_bytes.length);
+ // Copy the temporary buffer.
Array.prototype.push.apply(bytes, tmp_bytes);
}
@@ -155,8 +157,7 @@ WasmModuleBuilder.prototype.toArray = function(debug) {
emit_section(bytes, kDeclSignatures, function(bytes) {
emit_varint(bytes, wasm.signatures.length);
for (sig of wasm.signatures) {
- var params = sig.length - 1;
- emit_varint(bytes, params);
+ emit_u8(bytes, kWasmFunctionTypeForm);
for (var j = 0; j < sig.length; j++) {
emit_u8(bytes, sig[j]);
}
« no previous file with comments | « test/mjsunit/wasm/wasm-constants.js ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698