diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-10 15:02:11 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-10 15:02:11 -0700 |
commit | 7c39b40357a764fcf0a52d0c647d28c10af4d59f (patch) | |
tree | 159febcc4ccccdaa7ae0410c35e092c1e385e592 | |
parent | f8066edde43495c5ca6b869ff37f99a8290f30b5 (diff) |
larger pgo test, with asm measurements
-rwxr-xr-x | emcc | 2 | ||||
-rw-r--r-- | src/modules.js | 2 | ||||
-rwxr-xr-x | tests/runner.py | 16 |
3 files changed, 18 insertions, 2 deletions
@@ -129,8 +129,8 @@ while response_file: for index in range(1, len(sys.argv)): if sys.argv[index][0] == '@': # found one, loop again next time - print >>sys.stderr, 'emcc: using response file: %s' % response_file response_file = sys.argv[index][1:] + print >>sys.stderr, 'emcc: using response file: %s' % response_file if not os.path.exists(response_file): print >>sys.stderr, 'emcc: error: Response file not found: %s' % response_file exit(1) diff --git a/src/modules.js b/src/modules.js index e78b294f..65b8d437 100644 --- a/src/modules.js +++ b/src/modules.js @@ -315,7 +315,7 @@ var Functions = { } if (ASM_JS) { var curr = table[i]; - if (curr && !Functions.implementedFunctions[curr]) { + if (curr && curr != '0' && !Functions.implementedFunctions[curr]) { // This is a library function, we can't just put it in the function table, need a wrapper if (!wrapped[curr]) { var args = '', arg_coercions = '', call = curr + '(', retPre = '', retPost = ''; diff --git a/tests/runner.py b/tests/runner.py index b2bacb1b..33e6095a 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -9039,6 +9039,22 @@ f.close() assert debug_size > unminified_size assert 'function _malloc' in src + def test_asm_pgo(self): + Popen([PYTHON, EMXX, '-O2', '-s', 'ASM_JS=1', path_from_root('tests', 'hello_libcxx.cpp'), '-o', 'normal.js']).communicate() + self.assertContained('hello, world!', run_js(self.in_dir('normal.js'))) + + Popen([PYTHON, EMXX, '-O2', '-s', 'PGO=1', path_from_root('tests', 'hello_libcxx.cpp'), '-o', 'pgo.js']).communicate() + pgo_output = run_js(self.in_dir('pgo.js')) + self.assertContained('hello, world!', pgo_output) + + open('pgo_data', 'w').write(pgo_output.split('\n')[1]) + Popen([PYTHON, EMXX, '-O2', '-s', 'ASM_JS=1', path_from_root('tests', 'hello_libcxx.cpp'), '-o', 'pgoed.js', '@pgo_data']).communicate() + self.assertContained('hello, world!', run_js(self.in_dir('pgoed.js'))) + + before = len(open('normal.js').read()) + after = len(open('pgoed.js').read()) + assert after < 0.66 * before, [before, after] # expect a big size reduction + def test_l_link(self): # Linking with -lLIBNAME and -L/DIRNAME should work |