diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-09 10:04:07 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-09 10:04:07 -0800 |
commit | 74a855a0d5a8d1708f47e6531a22ca6ae3f8f76e (patch) | |
tree | 33bb840ecd2b819474f394f8e3ef6b46b78816ed | |
parent | a43d5b5a146a4cfc654c2c1dbd05001e58977273 (diff) |
improve non-asm parsing of generated functions area to be identical in EMCC_DEBUG=1 and 2
-rwxr-xr-x | tests/runner.py | 2 | ||||
-rw-r--r-- | tools/js_optimizer.py | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/tests/runner.py b/tests/runner.py index 91260177..02558650 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -7311,6 +7311,8 @@ def process(filename): return output + self.emcc_args += ['--minify', '0'] # to compare the versions + def do_test(): self.do_run(open(path_from_root('tests', 'openjpeg', 'codec', 'j2k_to_image.c'), 'r').read(), 'Successfully generated', # The real test for valid output is in image_compare diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py index d089a989..b52f2324 100644 --- a/tools/js_optimizer.py +++ b/tools/js_optimizer.py @@ -148,12 +148,19 @@ def run_on_js(filename, passes, js_engine, jcache): if suffix: if not asm_registerize: pre = js[:start_funcs + len(start_funcs_marker)] - post = js[end_funcs:] + post = js[end_funcs + len(end_funcs_marker):] js = js[start_funcs + len(start_funcs_marker):end_funcs] if 'asm' not in passes: # can have Module[..] and inlining prevention code, push those to post - for line in js.split('\n'): + class Finals: + buf = [] + def process(line): if len(line) > 0 and not line.startswith((' ', 'function', '}')): - post = line + '\n' + post + Finals.buf.append(line) + return False + return True + js = '\n'.join(filter(process, js.split('\n'))) + post = '\n'.join(Finals.buf) + '\n' + post + post = end_funcs_marker + post else: # We need to split out the asm shell as well, for minification pre = js[:start_asm + len(start_asm_marker)] |