diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 10:26:32 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 10:26:32 -0700 |
commit | 1e7414017b599d7b3b990922ca905ee679b81ff9 (patch) | |
tree | 78309c33c75f57bcf2f4a13054d1c7c47005c2d5 /src/parseTools.js | |
parent | 61cab495da3dd69cc46bef0ae8786ecec8050481 (diff) |
refactor chunkifying in makePointer
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 671aed69..2d0be302 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1539,7 +1539,6 @@ function makePointer(slab, pos, allocator, type, ptr) { } if (!fail) types = 'i8'; } - if (typeof slab == 'object') slab = '[' + slab.join(',') + ']'; // JS engines sometimes say array initializers are too large. Work around that by chunking and calling concat to combine at runtime var chunkSize = 10240; function chunkify(array) { @@ -1552,9 +1551,10 @@ function makePointer(slab, pos, allocator, type, ptr) { } return ret; } - if (typeof slab == 'string' && evaled && evaled.length > chunkSize && slab.length > chunkSize) { - slab = chunkify(evaled); + if (typeof slab == 'object' && slab.length > chunkSize) { + slab = chunkify(slab); } + if (typeof slab == 'object') slab = '[' + slab.join(',') + ']'; if (typeof types != 'string' && types.length > chunkSize) { types = chunkify(types); } else { |