aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-09-13 02:14:32 +0300
committermax99x <max99x@gmail.com>2011-09-13 02:14:32 +0300
commitc5e5c90cd111c08b3d91d1bc89ba7d33a308cbc7 (patch)
tree5c6033729c4a4c5593fcd87bd9ffa6debf21f285 /src/preamble.js
parent91e29b31f280b879b10debf2194c2b87d94857cf (diff)
parent534cc7f05846daa88f2d3f2d149d9768262033e9 (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: src/intertyper.js tests/runner.py
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 9e0f5ce3..35bb75d7 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -320,7 +320,7 @@ function setValue(ptr, value, type) {
default: abort('invalid type for setValue: ' + type);
}
}
-this['setValue'] = setValue;
+Module['setValue'] = setValue;
// Parallel to setValue.
@@ -338,7 +338,7 @@ function getValue(ptr, type) {
}
return null;
}
-this['getValue'] = getValue;
+Module['getValue'] = getValue;
// Allocates memory for some data and initializes it properly.
@@ -428,7 +428,8 @@ var STACK_ROOT, STACKTOP, STACK_MAX;
var STATICTOP;
var HAS_TYPED_ARRAYS = false;
-var TOTAL_MEMORY = 50*1024*1024;
+var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || {{{ TOTAL_MEMORY }}};
+var FAST_MEMORY = Module['FAST_MEMORY'] || {{{ FAST_MEMORY }}};
// Initialize the runtime's memory
#if USE_TYPED_ARRAYS
@@ -459,9 +460,8 @@ if (HAS_TYPED_ARRAYS) {
} else
#endif
{
- // Without this optimization, Chrome is slow. Sadly, the constant here needs to be tweaked depending on the code being run...
- var FAST_MEMORY = TOTAL_MEMORY/32;
- HEAP = new Array(FAST_MEMORY);
+ // Make sure that our HEAP is implemented as a flat array.
+ HEAP = new Array(TOTAL_MEMORY);
for (var i = 0; i < FAST_MEMORY; i++) {
HEAP[i] = 0; // XXX We do *not* use {{| makeSetValue(0, 'i', 0, 'null') |}} here, since this is done just to optimize runtime speed
}