diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-05-26 13:32:57 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-05-26 13:32:57 -0700 |
commit | 78ee9a8f64d734405e8e85e03c3d3768fce45e41 (patch) | |
tree | 14f97e1a795561dfdc8a465aca09cb1979199f64 /src/library.js | |
parent | d3efb7dcb71f0d9d6df09fee687fa1dbd0bde9bf (diff) |
improve CHECK_* options, add initial version of AUTO_OPTIMIZE
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index 471bbc96..bd9491af 100644 --- a/src/library.js +++ b/src/library.js @@ -1297,9 +1297,15 @@ function reSign(value, bits, ignore) { if (value <= 0) return value; var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32 : Math.pow(2, bits-1); +#if CHECK_SIGNS + var noted = false; +#endif if (value >= half) { #if CHECK_SIGNS - if (!ignore) CorrectionsMonitor.note('ReSign'); + if (!ignore) { + CorrectionsMonitor.note('ReSign'); + noted = true; + } #endif value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts } @@ -1308,9 +1314,18 @@ function reSign(value, bits, ignore) { // without CHECK_SIGNS, we would just do the |0 shortcut, so check that that // would indeed give the exact same result. if (bits === 32 && (value|0) !== value && typeof value !== 'boolean') { - if (!ignore) CorrectionsMonitor.note('ReSign'); + if (!ignore) { + CorrectionsMonitor.note('ReSign'); + noted = true; + } } + if (!noted) CorrectionsMonitor.note('ReSign', true); #endif return value; } +// Just a stub. We don't care about noting compile-time corrections. But they are called. +var CorrectionsMonitor = { + note: function(){} +}; + |