aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js3
-rw-r--r--src/settings.js1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index c297b278..0bacebd9 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1975,6 +1975,9 @@ function processMathop(item) {
if (ASM_JS) {
// special-case: there is no integer multiply in asm, because there is no true integer
// multiply in JS. While we wait for Math.imul, do double multiply
+ if (USE_MATH_IMUL) {
+ return 'Math.imul(' + idents[0] + ',' + idents[1] + ')';
+ }
return '(~~(+' + idents[0] + ' * +' + idents[1] + '))';
}
return handleOverflow(getFastValue(idents[0], '*', idents[1], item.type), bits);
diff --git a/src/settings.js b/src/settings.js
index b9dfa9e9..acf71c03 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -295,6 +295,7 @@ var HEADLESS = 0; // If 1, will include shim code that tries to 'fake' a browser
// keep your expectations low for this to work.
var ASM_JS = 0; // If 1, generate code in asm.js format
+var USE_MATH_IMUL = 0; // If 1, use Math.imul when useful
var NECESSARY_BLOCKADDRS = []; // List of (function, block) for all block addresses that are taken.