diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-06-20 18:15:36 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-06-20 18:15:36 -0700 |
commit | c3ed656997ea4515d846debf45121af1bd174a51 (patch) | |
tree | de84436eba40aedf96ca8c091c743e0d7d79e965 /src/jsifier.js | |
parent | 0ad87244178badf26cd5c8e0ed88116e87026472 (diff) | |
parent | 97d19be7f46bb3b0862e575fc6e06abafca74df7 (diff) |
Merge branch 'incoming'
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 156fd65d..e9bc9a79 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -328,7 +328,7 @@ function JSify(data, functionsOnly, givenFunctions) { var js = (index !== null ? '' : item.ident + '=') + constant; if (js) js += ';'; - if (!ASM_JS && (EXPORT_ALL || (item.ident in EXPORTED_GLOBALS))) { + if (!ASM_JS && NAMED_GLOBALS && (EXPORT_ALL || (item.ident in EXPORTED_GLOBALS))) { js += '\nModule["' + item.ident + '"] = ' + item.ident + ';'; } if (BUILD_AS_SHARED_LIB == 2 && !item.private_) { @@ -1185,8 +1185,13 @@ function JSify(data, functionsOnly, givenFunctions) { if (disabled) { ret = call_ + ';'; } else if (ASM_JS) { + if (item.type != 'void') call_ = asmCoercion(call_, item.type); // ensure coercion to ffi in comma operator call_ = call_.replace('; return', ''); // we auto-add returns when aborting, but do not need them here - ret = '(__THREW__ = 0,' + call_ + ');'; + if (item.type == 'void') { + ret = '__THREW__ = 0;' + call_ + ';'; + } else { + ret = '(__THREW__ = 0,' + call_ + ');'; + } } else { ret = '(function() { try { __THREW__ = 0; return ' + call_ + ' ' @@ -1310,8 +1315,10 @@ function JSify(data, functionsOnly, givenFunctions) { assert(TARGET_LE32); var ident = item.value.ident; var move = Runtime.STACK_ALIGN; - return '(tempInt=' + makeGetValue(ident, 4, '*') + ',' + - makeSetValue(ident, 4, 'tempInt + ' + move, '*') + ',' + + + // store current list offset in tempInt, advance list offset by STACK_ALIGN, return list entry stored at tempInt + return '(tempInt=' + makeGetValue(ident, Runtime.QUANTUM_SIZE, '*') + ',' + + makeSetValue(ident, Runtime.QUANTUM_SIZE, 'tempInt + ' + move, '*') + ',' + makeGetValue(makeGetValue(ident, 0, '*'), 'tempInt', item.type) + ')'; }); |