diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-16 17:20:47 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-17 10:01:04 -0800 |
commit | e138af189b10854ba16cbc99843a171c59c6d331 (patch) | |
tree | 6c50ac845e1ea403175f2036e54c9007b9129513 /src | |
parent | 3c4f29d187ce68f6e0b21a59eb8399a7c6e6eb16 (diff) |
remove current memory initialization chunking via .concat(..)
Diffstat (limited to 'src')
-rw-r--r-- | src/parseTools.js | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 036ccfc1..a564f2e3 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1789,31 +1789,12 @@ function makePointer(slab, pos, allocator, type, ptr, finalMemoryInitialization) types = 'i8'; } - // JS engines sometimes say array initializers are too large. Work around that by chunking and calling concat to combine at runtime - var chunkSize = JS_CHUNK_SIZE; - function chunkify(array) { - // break very large slabs into parts - var ret = ''; - var index = 0; - while (index < array.length) { - ret = (ret ? ret + '.concat(' : '') + '[' + array.slice(index, index + chunkSize).map(JSON.stringify) + ']' + (ret ? ')\n' : ''); - index += chunkSize; - } - return ret; - } - if (typeof slab == 'object' && slab.length > chunkSize) { - slab = chunkify(slab); - } if (typeof types == 'object') { while (types.length < slab.length) types.push(0); } - if (typeof types != 'string' && types.length > chunkSize) { - types = chunkify(types); - } else { - types = JSON.stringify(types); - } + types = JSON.stringify(types); if (typeof slab == 'object') slab = '[' + slab.join(',') + ']'; - return 'allocate(' + slab + ', ' + types + (allocator ? ', ' + allocator : '') + (allocator == 'ALLOC_NONE' ? ', ' + ptr : '') + ')'; + return 'allocate(' + slab + ', ' + types + (allocator ? ', ' + allocator : '') + (allocator == 'ALLOC_NONE' ? ', ' + ptr : '') + ');'; } function makeGetSlabs(ptr, type, allowMultiple, unsigned) { |