MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / compile_javascript_cached

Function compile_javascript_cached

tools/emscripten.py:339–353  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

337
338@ToolchainProfiler.profile()
339def compile_javascript_cached():
340 # Avoiding using the cache when generating struct info since
341 # this step is performed while the cache is locked.
342 # Sadly we have to skip the caching whenever we have user JS libraries. This is because
343 # these libraries can import arbitrary other JS files (either vis node's `import` or via #include)
344 has_user_libs = any(not lib.startswith(utils.path_from_root('src/')) for lib in settings.JS_LIBRARIES)
345 if DEBUG or settings.BOOTSTRAPPING_STRUCT_INFO or config.FROZEN_CACHE or has_user_libs:
346 return compile_javascript()
347
348 content_hash = generate_js_compiler_input_hash()
349
350 # Limit of the overall size of the cache.
351 # This code will get test coverage since a full test run of `other` or `core`
352 # generates ~1000 unique outputs.
353 return get_cached_file('js_output', f'{content_hash}.js', compile_javascript, cache_limit=500)
354
355
356def emscript(in_wasm, out_wasm, outfile_js, js_syms, finalize=True, base_metadata=None):

Callers 1

emscriptFunction · 0.85

Calls 3

compile_javascriptFunction · 0.85
get_cached_fileFunction · 0.85

Tested by

no test coverage detected