Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Preserve asm.js code * Actually TEST what we want to fix, and fix the implementation. Note: If we add "initial values" to instance variables in TypeScript, they are assigned AFTER the constructor is done, while "initialise" is done DURING the constructor call
- Loading branch information
1 parent
a54155d
commit 13d807f
Showing
4 changed files
with
101 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
description: 'Preserves asm.js code (#3360)' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function asmjs_included_1() { | ||
'use asm'; | ||
|
||
function noop(e) { | ||
// this is crucial | ||
e = e | 0; | ||
} | ||
|
||
return { noop: noop }; | ||
} | ||
|
||
function asmjs_included_2() { | ||
'use asm'; | ||
|
||
function noop(e) { | ||
e = e | 0; | ||
|
||
switch (e | 0) { | ||
case 10: | ||
return 10; | ||
|
||
default: | ||
return e | 0; | ||
} | ||
|
||
// this is crucial | ||
return e | 0; | ||
} | ||
|
||
return { noop: noop }; | ||
} | ||
|
||
console.log(asmjs_included_1().noop(3)); | ||
console.log(asmjs_included_2().noop(3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function asmjs_included_1() { | ||
'use asm'; | ||
|
||
function noop(e) { | ||
// this is crucial | ||
e = e | 0; | ||
} | ||
|
||
return { noop: noop }; | ||
} | ||
|
||
function asmjs_included_2() { | ||
'use asm'; | ||
|
||
function noop(e) { | ||
e = e | 0; | ||
|
||
switch (e | 0) { | ||
case 10: | ||
return 10; | ||
|
||
default: | ||
return e | 0; | ||
} | ||
|
||
// this is crucial | ||
return e | 0; | ||
} | ||
|
||
return { noop: noop }; | ||
} | ||
|
||
function asmjs_removed() { | ||
'use asm'; | ||
|
||
function noop(e) { | ||
e = e | 0; | ||
} | ||
|
||
return { noop: noop }; | ||
} | ||
|
||
console.log(asmjs_included_1().noop(3)); | ||
console.log(asmjs_included_2().noop(3)); |