diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 18:37:00 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 18:37:00 -0700 |
commit | bae4c91d0acf4fd70e0c17ad178b07d2eb6345d9 (patch) | |
tree | 8a02a4334992a4589896307279edfae1c2eeab83 /src/jsifier.js | |
parent | 10f70b2a9bd7b0a1fdc3c140bf3c00ebad8420a9 (diff) |
pre-apply {{{ FI_* }}} as well
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index ac3d1955..ce089334 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1505,12 +1505,18 @@ function JSify(data, functionsOnly, givenFunctions) { if (memoryInitialization.length > 0) { // apply postsets directly into the big memory initialization itemsDict.GlobalVariablePostSet = itemsDict.GlobalVariablePostSet.filter(function(item) { - var m - if (m = /^HEAP([\dFU]+)\[([()>\d]+)\] *= *([()|\d]+);?$/.exec(item.JS)) { + var m; + if (m = /^HEAP([\dFU]+)\[([()>\d]+)\] *= *([()|\d{}\w_' ]+);?$/.exec(item.JS)) { var type = getTypeFromHeap(m[1]); var bytes = Runtime.getNativeTypeSize(type); var target = eval(m[2]) << log2(bytes); - var value = eval(m[3]); + var value = m[3]; + try { + value = eval(value); + } catch(e) { + // possibly function table {{{ FT_* }}} etc. + if (value.indexOf('{{ ') < 0) return true; + } writeInt8s(memoryInitialization, target - TOTAL_STACK, value, type); return false; } |