aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-19 16:13:46 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-19 16:13:46 -0800
commite809edad676e1cf4d93e624b39bbaca80318cbf6 (patch)
treecb10024c16631a7371697e90244bd114e70a6069
parent7654dfe43471b752c80f6cb2976ace95d60a1319 (diff)
support 0x[a-f] as well in +X to X.0 correction for asm
-rw-r--r--tools/js-optimizer.js2
-rw-r--r--tools/test-js-optimizer-asm-last-output.js4
-rw-r--r--tools/test-js-optimizer-asm-last.js4
3 files changed, 9 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index c779b4e6..4a92d3cf 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -2163,7 +2163,7 @@ function prepDotZero(ast) {
});
}
function fixDotZero(js) {
- return js.replace(/DOT\$ZERO\(((0x)?[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)\)/g, function(m, num) {
+ return js.replace(/DOT\$ZERO\(((0x)?[-+]?[0-9a-f]*\.?[0-9]+([eE][-+]?[0-9]+)?)\)/g, function(m, num) {
if (num.substr(0, 2) == '0x') {
if (num[2] == '-') num = '-0x' + num.substr(3); // uglify generates 0x-8000 for some reason
return eval(num) + '.0';
diff --git a/tools/test-js-optimizer-asm-last-output.js b/tools/test-js-optimizer-asm-last-output.js
index 405cd929..c10cc6b0 100644
--- a/tools/test-js-optimizer-asm-last-output.js
+++ b/tools/test-js-optimizer-asm-last-output.js
@@ -26,6 +26,10 @@ function finall(x) {
a = -9223372036854776000.0;
a = -9223372036854776000.0;
a = -0x8000000000000000;
+ a = 999999984306749400.0;
+ a = -999999984306749400.0;
+ a = -999999984306749400.0;
+ a = -0xde0b6b000000000;
return 12.0e10;
}
diff --git a/tools/test-js-optimizer-asm-last.js b/tools/test-js-optimizer-asm-last.js
index 794e90c0..6e97b687 100644
--- a/tools/test-js-optimizer-asm-last.js
+++ b/tools/test-js-optimizer-asm-last.js
@@ -26,6 +26,10 @@ function finall(x) {
a = +-0x8000000000000000;
a = -+0x8000000000000000;
a = -0x8000000000000000;
+ a = +0xde0b6b000000000;
+ a = +-0xde0b6b000000000;
+ a = -+0xde0b6b000000000;
+ a = -0xde0b6b000000000;
return +12e10;
}
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["finall"]