aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc10
-rwxr-xr-xemscripten.py6
2 files changed, 10 insertions, 6 deletions
diff --git a/emcc b/emcc
index b9dcf8ab..afe4f22b 100755
--- a/emcc
+++ b/emcc
@@ -1142,6 +1142,16 @@ try:
execute(shlex.split(js_transform, posix=posix) + [os.path.abspath(final)])
if DEBUG: save_intermediate('transformed')
+ if shared.Settings.ASM_JS: # XXX temporary wrapping for testing purposes
+ unwrapped = open(final).read()
+ final += '.asmwrap.js'
+ open(final, 'w').write('''
+(function() { // prevent new Function from seeing the global scope
+%s
+}).apply(null, arguments);
+''' % unwrapped)
+ if DEBUG: save_intermediate('asmwrap')
+
# It is useful to run several js optimizer passes together, to save on unneeded unparsing/reparsing
js_optimizer_queue = []
def flush_js_optimizer_queue():
diff --git a/emscripten.py b/emscripten.py
index 83ef740f..8ead6e58 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -267,9 +267,6 @@ def emscript(infile, settings, outfile, libraries=[]):
def blockaddrsize(js):
return re.sub(r'{{{ BA_([\w\d_$]+)\|([\w\d_$]+) }}}', lambda m: str(blockaddrs[m.groups(0)[0]][m.groups(0)[1]]), js)
- if settings.get('ASM_JS'):
- outfile.write('(function() {\n'); # prevent new Function from seeing the global scope
-
#if DEBUG: outfile.write('// pre\n')
outfile.write(blockaddrsize(indexize(pre)))
pre = None
@@ -388,9 +385,6 @@ Runtime.stackRestore = function(top) { asm.stackRestore(top) };
outfile.write(indexize(post))
if DEBUG: print >> sys.stderr, ' emscript: phase 3 took %s seconds' % (time.time() - t)
- if settings.get('ASM_JS'):
- outfile.write('}).apply(null, arguments);\n');
-
outfile.close()