diff --git a/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/UnpackingJSBundleLoader.java b/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/UnpackingJSBundleLoader.java index e4cf1362824..0b4f7d2323c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/UnpackingJSBundleLoader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/cxxbridge/UnpackingJSBundleLoader.java @@ -40,10 +40,16 @@ public class UnpackingJSBundleLoader extends JSBundleLoader { /** * Flag passed to loadScriptFromOptimizedBundle to let the bridge know that - * the unpacked unpacked js source file. + * the unpacker unpacked js source file. */ public static final int UNPACKED_JS_SOURCE = (1 << 0); + /** + * Flag passed to loadScriptFromOptimizedBundle to let the bridge know that + * the unpacker unpacked bytecode cache files. + */ + public static final int UNPACKED_BC_CACHE = (1 << 1); + /** * Name of the lock files. Multiple processes can be spawned off the same app * and we need to guarantee that at most one unpacks files at any time. To diff --git a/ReactCommon/cxxreact/Executor.h b/ReactCommon/cxxreact/Executor.h index 62b2004c56e..d1e55ba9714 100644 --- a/ReactCommon/cxxreact/Executor.h +++ b/ReactCommon/cxxreact/Executor.h @@ -21,6 +21,7 @@ namespace react { enum { UNPACKED_JS_SOURCE = (1 << 0), + UNPACKED_BC_CACHE = (1 << 1), }; class JSExecutor; diff --git a/ReactCommon/cxxreact/JSCExecutor.cpp b/ReactCommon/cxxreact/JSCExecutor.cpp index b2b50fdc6ac..a86617e1728 100644 --- a/ReactCommon/cxxreact/JSCExecutor.cpp +++ b/ReactCommon/cxxreact/JSCExecutor.cpp @@ -275,6 +275,10 @@ void JSCExecutor::loadApplicationScript( return loadApplicationScript(std::move(jsScriptBigString), sourceURL); } + if (flags & UNPACKED_BC_CACHE) { + configureJSCBCCache(m_context, bundlePath); + } + String jsSourceURL(sourceURL.c_str()); JSSourceCodeRef sourceCode = JSCreateSourceCode( jsScriptBigString->fd(),