aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-26 20:45:18 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-26 20:45:18 -0800
commitfe2172ea45cf3a9f48abcdb00853bbc1b416aec6 (patch)
treecb32303ded7579318cbcfa67e4a54d7ac2039e76
parentd5672aba5ef2d0fae7ab1759c0828234966bd0d9 (diff)
fix bug with typed arrays in memcpy
-rw-r--r--src/preamble.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 3c7286cc..8c954d0d 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -107,10 +107,6 @@ function assert(condition, text) {
}
}
-function Pointer_niceify(ptr) {
- return { slab: IHEAP, pos: ptr };
-}
-
// Creates a pointer for a certain slab and a certain address in that slab.
// If just a slab is given, will allocate room for it and copy it there. In
// other words, do whatever is necessary in order to return a pointer, that
@@ -374,17 +370,17 @@ function _atoi(s) {
function _llvm_memcpy_i32(dest, src, num, idunno) {
var curr;
for (var i = 0; i < num; i++) {
+#if USE_TYPED_ARRAYS
+ // TODO: optimize somehow - this is slower than without typed arrays
+ IHEAP[dest + i] = IHEAP[src + i];
+ FHEAP[dest + i] = FHEAP[src + i];
+#else
curr = HEAP[src + i] || 0; // memcpy sometimes copies uninitialized areas XXX: Investigate why initializing alloc'ed memory does not fix that too
#if SAFE_HEAP
SAFE_HEAP_STORE(dest + i, curr, null);
#else
HEAP[dest + i] = curr;
#endif
-#if USE_TYPED_ARRAYS
- // TODO: optimize somehow - this is slower than without typed arrays
- IHEAP[dest + i] = IHEAP[src + i];
- FHEAP[dest + i] = FHEAP[src + i];
-#endif
#endif
}
}