infrastructure to build and use native optimizer
This commit is contained in:
Родитель
1ff2cd29e1
Коммит
f841398e9c
3
emcc
3
emcc
|
@ -1369,7 +1369,6 @@ try:
|
|||
js_optimizer_extra_info = {}
|
||||
js_optimizer_queue_history = []
|
||||
js_optimizer_blacklist = (os.environ.get('EMCC_JSOPT_BLACKLIST') or '').split(',')
|
||||
NATIVE_OPTIMIZER_PASSES = set() # ['optimizeFrounds'])
|
||||
|
||||
def flush_js_optimizer_queue(title='js_opts'):
|
||||
global final, js_optimizer_queue, js_optimizer_extra_info, js_optimizer_queue_history
|
||||
|
@ -1401,7 +1400,7 @@ try:
|
|||
curr = []
|
||||
native = False
|
||||
for p in passes:
|
||||
if p not in NATIVE_OPTIMIZER_PASSES:
|
||||
if p not in shared.js_optimizer.NATIVE_PASSES:
|
||||
if native:
|
||||
chunks.append(['receiveJSON'] + curr + ['emitJSON'])
|
||||
curr = []
|
||||
|
|
|
@ -9,6 +9,8 @@ __rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|||
def path_from_root(*pathelems):
|
||||
return os.path.join(__rootpath__, *pathelems)
|
||||
|
||||
NATIVE_PASSES = set() # ['optimizeFrounds'])
|
||||
|
||||
JS_OPTIMIZER = path_from_root('tools', 'js-optimizer.js')
|
||||
|
||||
NUM_CHUNKS_PER_CORE = 3
|
||||
|
@ -273,10 +275,22 @@ EMSCRIPTEN_FUNCS();
|
|||
filenames = []
|
||||
|
||||
if len(filenames) > 0:
|
||||
# XXX Use '--nocrankshaft' to disable crankshaft to work around v8 bug 1895, needed for older v8/node (node 0.6.8+ should be ok)
|
||||
commands = map(lambda filename: js_engine +
|
||||
[JS_OPTIMIZER, filename, 'noPrintMetadata'] +
|
||||
(['--debug'] if source_map else []) + passes, filenames)
|
||||
if len(NATIVE_PASSES.intersection(passes)) == 0:
|
||||
commands = map(lambda filename: js_engine +
|
||||
[JS_OPTIMIZER, filename, 'noPrintMetadata'] +
|
||||
(['--debug'] if source_map else []) + passes, filenames)
|
||||
else:
|
||||
# use the native optimizer
|
||||
assert not source_map # XXX need to use js optimizer
|
||||
def create_optimizer():
|
||||
shared.logging.debug('building native optimizer')
|
||||
output = shared.Cache.get_path('optimizer.exe')
|
||||
shared.try_delete(output)
|
||||
subprocess.Popen([shared.CLANG, shared.path_from_root('tools', 'optimizer', 'optimizer.cpp'), '-I' + shared.path_from_root('tools', 'optimizer', 'rapidjson'), '-std=c++11', '-o', output]).communicate()
|
||||
assert os.path.exists(output)
|
||||
return output
|
||||
native_optimizer = shared.Cache.get('optimizer.exe', create_optimizer, extension='exe')
|
||||
commands = map(lambda filename: [native_optimizer, filename] + passes, filenames)
|
||||
#print [' '.join(command) for command in commands]
|
||||
|
||||
cores = min(cores, len(filenames))
|
||||
|
|
Загрузка…
Ссылка в новой задаче