diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 10:10:40 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 10:10:40 -0700 |
commit | cbc15905a139ba81249aed4c8f3d5196e89a0784 (patch) | |
tree | 81d882ad4841aabc57d56143d3861150b97fd7b9 /src | |
parent | 1613b96ed8d1f85b8c58fa0da6c0527075d01d82 (diff) |
compress in makePointer only in non-ta2, in preparation for consolidating all ta2 allocations
Diffstat (limited to 'src')
-rw-r--r-- | src/parseTools.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 6818e442..671aed69 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1472,19 +1472,19 @@ function makePointer(slab, pos, allocator, type, ptr) { } } // compress type info and data if possible - var de; - try { - // compress all-zeros into a number (which will become zeros(..)). - // note that we cannot always eval the slab, e.g., if it contains ident,0,0 etc. In that case, no compression TODO: ensure we get arrays here, not str - var evaled = typeof slab === 'string' ? eval(slab) : slab; - de = dedup(evaled); - if (de.length === 1 && de[0] == 0) { - slab = types.length; - } - // TODO: if not all zeros, at least filter out items with type === 0. requires cleverness to know how to skip at runtime though. also - // be careful of structure padding - } catch(e){} if (USE_TYPED_ARRAYS != 2) { + var de; + try { + // compress all-zeros into a number (which will become zeros(..)). + // note that we cannot always eval the slab, e.g., if it contains ident,0,0 etc. In that case, no compression TODO: ensure we get arrays here, not str + var evaled = typeof slab === 'string' ? eval(slab) : slab; + de = dedup(evaled); + if (de.length === 1 && de[0] == 0) { + slab = types.length; + } + // TODO: if not all zeros, at least filter out items with type === 0. requires cleverness to know how to skip at runtime though. also + // be careful of structure padding + } catch(e){} de = dedup(types); if (de.length === 1) { types = de[0]; |