diff --git a/test/code_size/hello_webgl2_wasm2js.json b/test/code_size/hello_webgl2_wasm2js.json index 0a57b2070a52b..ab5af65690948 100644 --- a/test/code_size/hello_webgl2_wasm2js.json +++ b/test/code_size/hello_webgl2_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 567, "a.html.gz": 379, - "a.js": 17760, - "a.js.gz": 7958, + "a.js": 17790, + "a.js.gz": 7987, "a.mem": 3123, "a.mem.gz": 2693, - "total": 21450, - "total_gz": 11030 + "total": 21480, + "total_gz": 11059 } diff --git a/test/code_size/hello_webgl_wasm2js.json b/test/code_size/hello_webgl_wasm2js.json index b7ba9ddff6798..6cec3f46e97fc 100644 --- a/test/code_size/hello_webgl_wasm2js.json +++ b/test/code_size/hello_webgl_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 567, "a.html.gz": 379, - "a.js": 17239, - "a.js.gz": 7781, + "a.js": 17263, + "a.js.gz": 7819, "a.mem": 3123, "a.mem.gz": 2693, - "total": 20929, - "total_gz": 10853 + "total": 20953, + "total_gz": 10891 } diff --git a/test/code_size/hello_world_wasm2js.js b/test/code_size/hello_world_wasm2js.js index c93291a460944..90abfb3c8c621 100644 --- a/test/code_size/hello_world_wasm2js.js +++ b/test/code_size/hello_world_wasm2js.js @@ -1,59 +1,64 @@ -var b = Module, g = new function(a) { - this.buffer = new ArrayBuffer(65536 * a.initial); -}({ - initial: 256, - maximum: 256 -}), k = g.buffer, d = new Uint8Array(k), l = new TextDecoder("utf8"), m; +var c = Module, g, h, k = new TextDecoder("utf8"), l; -function c(a) { - this.exports = function(h) { - function n(f) { - f.set = function(e, p) { - this[e] = p; +function d(b) { + this.exports = function(f) { + function m(e) { + e.set = function(a, n) { + this[a] = n; }; - f.get = function(e) { - return this[e]; + e.get = function(a) { + return this[a]; }; - return f; + return e; } - return function(f) { - var e = f.a.a; + return function(e) { + var a = new ArrayBuffer(16777216), n = e.a.a; + e = m([]); return { - b: function() {}, - c: function(p, q) { - e(1024); + b: Object.create(Object.prototype, { + grow: {}, + buffer: { + get: function() { + return a; + } + } + }), + c: function() {}, + d: function(p, q) { + n(1024); return 0; }, - d: n([]) + e: e }; - }(h); - }(a); + }(f); + }(b); } -(function(a, h) { +(function(b, f) { return { - then: function(n) { - n({ - instance: new c(h) + then: function(m) { + m({ + instance: new d(f) }); } }; -})(b.wasm, { +})(c.wasm, { a: { - a: a => { - var h = console, n = h.log; - if (a) { - for (var f = a + void 0, e = a; !(e >= f) && d[e]; ) ++e; - a = l.decode(d.subarray(a, e)); - } else a = ""; - n.call(h, a); - }, - memory: g + a: b => { + var f = console, m = f.log; + if (b) { + for (var e = b + void 0, a = b; !(a >= e) && g[a]; ) ++a; + b = k.decode(g.subarray(b, a)); + } else b = ""; + m.call(f, b); + } } -}).then((a => { - a = a.instance.exports; - m = a.c; - d.set(new Uint8Array(b.mem), 1024); - a.b(); - m(); +}).then((b => { + b = b.instance.exports; + l = b.d; + h = b.b; + g = new Uint8Array(h.buffer); + g.set(new Uint8Array(c.mem), 1024); + b.c(); + l(); })); \ No newline at end of file diff --git a/test/code_size/hello_world_wasm2js.json b/test/code_size/hello_world_wasm2js.json index 6317ae8e69f2b..6c26b7a43f595 100644 --- a/test/code_size/hello_world_wasm2js.json +++ b/test/code_size/hello_world_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 671, "a.html.gz": 430, - "a.js": 692, - "a.js.gz": 430, + "a.js": 708, + "a.js.gz": 444, "a.mem": 6, "a.mem.gz": 32, - "total": 1369, - "total_gz": 892 + "total": 1385, + "total_gz": 906 } diff --git a/test/code_size/random_printf_wasm2js.json b/test/code_size/random_printf_wasm2js.json index 4f5a16e576285..04fef72bf4570 100644 --- a/test/code_size/random_printf_wasm2js.json +++ b/test/code_size/random_printf_wasm2js.json @@ -1,6 +1,6 @@ { - "a.html": 17264, - "a.html.gz": 7529, - "total": 17264, - "total_gz": 7529 + "a.html": 17279, + "a.html.gz": 7541, + "total": 17279, + "total_gz": 7541 } diff --git a/tools/link.py b/tools/link.py index ab1f3293392ec..e4b0517b4d14b 100644 --- a/tools/link.py +++ b/tools/link.py @@ -1445,8 +1445,7 @@ def check_memory_setting(setting): (options.shell_path == DEFAULT_SHELL_HTML or options.shell_path == utils.path_from_root('src/shell_minimal.html')): exit_with_error(f'Due to collision in variable name "Module", the shell file "{options.shell_path}" is not compatible with build options "-sMODULARIZE -sEXPORT_NAME=Module". Either provide your own shell file, change the name of the export to something else to avoid the name collision. (see https://github.com/emscripten-core/emscripten/issues/7950 for details)') - # TODO(sbc): Remove WASM2JS here once the size regression it would introduce has been fixed. - if settings.SHARED_MEMORY or settings.RELOCATABLE or settings.ASYNCIFY_LAZY_LOAD_CODE or settings.WASM2JS: + if settings.SHARED_MEMORY or settings.RELOCATABLE or settings.ASYNCIFY_LAZY_LOAD_CODE: settings.IMPORTED_MEMORY = 1 if settings.WASM_BIGINT: