diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-12 16:38:58 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-12 16:38:58 -0800 |
commit | 8f42941647a97122aa5b357aeff5970f72a30019 (patch) | |
tree | 791172c9f2f07a610ed73eaa801e6891ed2dbea3 /emscripten.py | |
parent | 2aa6d93eddceca6d908e4903ce55952180c7d40d (diff) |
support for Math.imul
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/emscripten.py b/emscripten.py index e635b2bb..4ea5c768 100755 --- a/emscripten.py +++ b/emscripten.py @@ -301,9 +301,12 @@ def emscript(infile, settings, outfile, libraries=[]): return 'function %s(%s) { %s abort(%d); %s };\n' % (bad, params, coercions, i, ret) + raw.replace('[0,', '[' + bad + ',').replace(',0,', ',' + bad + ',').replace(',0,', ',' + bad + ',').replace(',0]', ',' + bad + ']').replace(',0]', ',' + bad + ']') function_tables_defs = '\n'.join([make_table(sig, raw) for sig, raw in last_forwarded_json['Functions']['tables'].iteritems()]) - asm_setup = '\n'.join(['var %s = %s;' % (f.replace('.', '_'), f) for f in ['Runtime.bitshift64', 'Math.floor', 'Math.min']]) + maths = ['Runtime.bitshift64', 'Math.floor', 'Math.min'] + if settings['USE_MATH_IMUL']: + maths += ['Math.imul'] + asm_setup = '\n'.join(['var %s = %s;' % (f.replace('.', '_'), f) for f in maths]) fundamentals = ['buffer', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint16Array', 'Uint32Array', 'Float32Array', 'Float64Array'] - basic_funcs = ['abort', 'assert', 'Runtime_bitshift64', 'Math_floor', 'Math_min'] + basic_funcs = ['abort', 'assert'] + [m.replace('.', '_') for m in maths] basic_vars = ['STACKTOP', 'STACK_MAX', 'tempDoublePtr', 'ABORT'] if not settings['NAMED_GLOBALS']: basic_vars += ['GLOBAL_BASE'] if forwarded_json['Types']['preciseI64MathUsed']: |