aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-11-21 23:03:08 -0800
committerAlon Zakai <azakai@mozilla.com>2010-11-21 23:03:08 -0800
commit76c55fb93de2861d19fb7c7664c325554d43ff9c (patch)
tree912a93d5bb9cad62620870118489d521faea5f5a /src
parentad9cb98dba27655710b7df337ea276ad68b9bac9 (diff)
optimize SAFE_HEAP for speed and enable additional tests
Diffstat (limited to 'src')
-rw-r--r--src/preamble.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 16b55d53..3993bd96 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -25,19 +25,20 @@ function SAFE_HEAP_ACCESS(dest, type, store) {
// Note that this will pass even with unions: You can store X, load X, then store Y and load Y.
// You cannot, however, do the nonportable act of store X and load Y!
if (store) {
- HEAP_HISTORY[dest] = [{ type: type, /*stack: new Error().stack */ }]; // |stack| is useful for debugging
+ HEAP_HISTORY[dest] = type; // [{ type: type, stack: new Error().stack }]; // |stack| is useful for debugging. Also uncomment the lines later down
} else {
if (!HEAP[dest] && HEAP[dest] !== 0 && HEAP[dest] !== false) { // false can be the result of a mathop comparator
throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n');
}
var history = HEAP_HISTORY[dest];
- assert((history && history[0]) /* || HEAP[dest] === 0 */, "Loading from where there was no store! " + dest + ',' + HEAP[dest] + ',' + type + ', \n\n' + new Error().stack + '\n');
- if (history[0].type && history[0].type !== type) {
+ if (history === null) return;
+ assert(history);
+// assert((history && history[0]) /* || HEAP[dest] === 0 */, "Loading from where there was no store! " + dest + ',' + HEAP[dest] + ',' + type + ', \n\n' + new Error().stack + '\n');
+// if (history[0].type !== type) {
+ if (history !== type) {
print('Load-store consistency assumption failure! ' + dest);
print('\n');
- print(history.map(function(item) {
- return item.type + ' :: ' + JSON.stringify(item.stack);
- }).join('\n\n'));
+ print(JSON.stringify(history));
print('\n');
print('LOAD: ' + type + ', ' + new Error().stack);
print('\n');