aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-23 16:58:43 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-23 16:58:43 -0800
commit4f33436231371f7fe5402c0c0a22076820aa76b8 (patch)
tree46c9247cb36a1a5338e08aa8a8dcfc74ab6a1380 /src/preamble.js
parent9c137edf45254c0bf73e00c2ffae9994f967e17e (diff)
refactor tempDouble to use space in normal memory, not a separate buffer
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 229699a9..d86cd745 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -344,14 +344,6 @@ var tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI
#if I64_MODE == 1
var tempI64, tempI64b;
#endif
-#if DOUBLE_MODE == 1
-#if USE_TYPED_ARRAYS == 2
-var tempDoubleBuffer = new ArrayBuffer(8);
-//var tempDoubleI8 = new Int8Array(tempDoubleBuffer);
-var tempDoubleI32 = new Int32Array(tempDoubleBuffer);
-var tempDoubleF64 = new Float64Array(tempDoubleBuffer);
-#endif
-#endif
function abort(text) {
print(text + ':\n' + (new Error).stack);
@@ -647,6 +639,15 @@ Module['HEAPF32'] = HEAPF32;
STACK_ROOT = STACKTOP = Runtime.alignMemory(STATICTOP);
STACK_MAX = STACK_ROOT + TOTAL_STACK;
+#if DOUBLE_MODE == 1
+#if USE_TYPED_ARRAYS == 2
+var tempDoublePtr = Runtime.alignMemory(STACK_MAX, 8);
+var tempDoubleI32 = HEAP32.subarray(tempDoublePtr >> 2);
+var tempDoubleF64 = new Float64Array(tempDoubleI32.buffer);
+STACK_MAX = tempDoublePtr + 8;
+#endif
+#endif
+
STATICTOP = alignMemoryPage(STACK_MAX);
function callRuntimeCallbacks(callbacks) {