@@ -2171,6 +2171,24 @@ def get_final():
2171
2171
open (final + '.mem.js' , 'w' ).write (src )
2172
2172
final += '.mem.js'
2173
2173
2174
+ log_time ('memory initializer' )
2175
+
2176
+ with ToolchainProfiler .profile_block ('binaryen' ):
2177
+ do_binaryen (target , options , memfile , wasm_target ,
2178
+ wasm_source_map_target , misc_temp_files )
2179
+
2180
+ log_time ('binaryen' )
2181
+ # If we are not emitting any JS then we are all done now
2182
+ if shared .Settings .SIDE_MODULE or final_suffix in WASM_ENDINGS :
2183
+ return
2184
+
2185
+ with ToolchainProfiler .profile_block ('final emitting' ):
2186
+ # Remove some trivial whitespace
2187
+ # TODO: do not run when compress has already been done on all parts of the code
2188
+ # src = open(final).read()
2189
+ # src = re.sub(r'\n+[ \n]*\n+', '\n', src)
2190
+ # open(final, 'w').write(src)
2191
+
2174
2192
if shared .Settings .USE_PTHREADS :
2175
2193
target_dir = os .path .dirname (os .path .abspath (target ))
2176
2194
worker_output = os .path .join (target_dir , shared .Settings .PTHREAD_WORKER_FILE )
@@ -2182,24 +2200,9 @@ def get_final():
2182
2200
minified_worker = building .acorn_optimizer (worker_output , ['minifyWhitespace' ], return_output = True )
2183
2201
open (worker_output , 'w' ).write (minified_worker )
2184
2202
2185
- log_time ('js opts' )
2186
-
2187
- with ToolchainProfiler .profile_block ('final emitting' ):
2188
- # Remove some trivial whitespace
2189
- # TODO: do not run when compress has already been done on all parts of the code
2190
- # src = open(final).read()
2191
- # src = re.sub(r'\n+[ \n]*\n+', '\n', src)
2192
- # open(final, 'w').write(src)
2193
-
2194
2203
# track files that will need native eols
2195
2204
generated_text_files_with_native_eols = []
2196
2205
2197
- do_binaryen (target , options , memfile , wasm_target ,
2198
- wasm_source_map_target , misc_temp_files )
2199
- # If we are building a wasm side module then we are all done now
2200
- if shared .Settings .SIDE_MODULE :
2201
- return
2202
-
2203
2206
if shared .Settings .MODULARIZE :
2204
2207
modularize ()
2205
2208
@@ -2228,8 +2231,6 @@ def get_final():
2228
2231
2229
2232
if final_suffix in JS_ENDINGS :
2230
2233
js_target = target
2231
- elif final_suffix in WASM_ENDINGS :
2232
- js_target = misc_temp_files .get (suffix = '.js' ).name
2233
2234
else :
2234
2235
js_target = unsuffixed (target ) + '.js'
2235
2236
0 commit comments