Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tests/optimizer/constructor-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ function instantiate(o, p, q) {
function i() {
return g(10, 20) + h(30);
}



function g(a, b) {
return h(a + b);
}

function h(a) {
return a + 1;
}


// EMSCRIPTEN_END_FUNCS

return {
Expand Down
6 changes: 3 additions & 3 deletions tests/optimizer/test-js-optimizer-minifyLocals-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function d(f, g, h) {
}

function l() {
a : while (1) {
b : while (1) {
a: while (1) {
b: while (1) {
if (c()) {
if (d()) {
break a;
Expand All @@ -36,5 +36,5 @@ function l() {
}
}
}
a : while (1) {}
a: while (1) {}
}
40 changes: 25 additions & 15 deletions tests/optimizer/wasm2js-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function E(a, b, c) {
return;
}
e = a + c | 0;
a : {
a: {
if (!((a ^ b) & 3)) {
b : {
b: {
if ((c | 0) < 1) {
c = a;
break b;
Expand All @@ -66,7 +66,7 @@ function E(a, b, c) {
}
}
a = e & -4;
c : {
c: {
if (a >>> 0 < 64) {
break c;
}
Expand Down Expand Up @@ -148,6 +148,7 @@ function E(a, b, c) {
}
}
}

function H(a, b, c) {
a = a | 0;
b = b | 0;
Expand All @@ -165,9 +166,9 @@ function H(a, b, c) {
e = b + c | 0;
i = 2;
b = d + 16 | 0;
a : {
b : {
c : {
a: {
b: {
c: {
if (!D(x(f[a + 60 >> 2], d + 16 | 0, 2, d + 12 | 0) | 0)) {
while (1) {
g = f[d + 12 >> 2];
Expand Down Expand Up @@ -216,12 +217,13 @@ function H(a, b, c) {
z = d + 32 | 0;
return a | 0;
}

function B(a, b) {
var e = 0, h = 0, i = 0, j = 0, k = 0;
P();
j = 1024;
e = f[b + 16 >> 2];
a : {
a: {
if (!e) {
if (C(b)) {
break a;
Expand All @@ -232,7 +234,7 @@ function B(a, b) {
if (e - i >>> 0 < a >>> 0) {
return c[f[b + 36 >> 2]](b, 1024, a) | 0;
}
b : {
b: {
if (d[b + 75 | 0] < 0) {
break b;
}
Expand Down Expand Up @@ -263,13 +265,14 @@ function B(a, b) {
}
return h;
}

function L(a) {
var b = 0, e = 0, g = 0;
b = z - 16 | 0;
z = b;
d[b + 15 | 0] = 10;
e = f[a + 16 >> 2];
a : {
a: {
if (!e) {
if (C(a)) {
break a;
Expand All @@ -288,6 +291,7 @@ function L(a) {
}
z = b + 16 | 0;
}

function J() {
var a = 0, b = 0, c = 0;
b = 1024;
Expand All @@ -314,16 +318,17 @@ function J() {
}
return b - 1024 | 0;
}

function K() {
var a = 0, b = 0;
a = f[260];
a;
b = J();
a : {
a: {
if ((((M(b, a) | 0) != (b | 0) ? -1 : 0) | 0) < 0) {
break a;
}
b : {
b: {
if (g[a + 75 | 0] == 10) {
break b;
}
Expand All @@ -338,6 +343,7 @@ function K() {
L(a);
}
}

function C(a) {
var b = 0;
b = g[a + 74 | 0];
Expand All @@ -355,11 +361,12 @@ function C(a) {
f[a + 16 >> 2] = b + f[a + 48 >> 2];
return 0;
}

function M(a, b) {
var c = 0, d = 0;
c = a;
d = c;
a : {
a: {
if (f[b + 76 >> 2] <= -1) {
b = B(c, b);
break a;
Expand All @@ -371,6 +378,7 @@ function M(a, b) {
}
return b;
}

function F(a, b, c, d) {
a = a | 0;
b = b | 0;
Expand All @@ -379,31 +387,33 @@ function F(a, b, c, d) {
A = 0;
return 0;
}

function D(a) {
if (!a) {
return 0;
}
f[300] = a;
return -1;
}

function N(a, b) {
a = a | 0;
b = b | 0;
K();
return 0;
}

function I(a) {
a = a | 0;
return u() | 0;
}

function G(a) {
a = a | 0;
return 0;
}
function O() {}



function O() {}

// EMSCRIPTEN_END_FUNCS

Expand Down
3 changes: 2 additions & 1 deletion tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,8 @@ def test_js_optimizer(self):
'growableHeap',
'unsignPointers',
'asanify',
'safeHeap'
'safeHeap',
'minifyLocals',
]
for input, expected, passes in [
(path_from_root('tests', 'optimizer', 'test-js-optimizer-minifyGlobals.js'), open(path_from_root('tests', 'optimizer', 'test-js-optimizer-minifyGlobals-output.js')).read(),
Expand Down
Loading