Kick out preparsing and add a way to configure jsc context
Reviewed By: tadeuzagallo Differential Revision: D3114935 fb-gh-sync-id: 4182d18014ea91f44679682d3b24be4a8165dc76 fbshipit-source-id: 4182d18014ea91f44679682d3b24be4a8165dc76
This commit is contained in:
parent
9ffb227fa6
commit
a7c82f4564
|
@ -187,6 +187,10 @@ void JSCExecutor::initOnJSVMThread() {
|
|||
#ifdef JSC_HAS_PERF_STATS_API
|
||||
addJSCPerfStatsHooks(m_context);
|
||||
#endif
|
||||
|
||||
#if defined(WITH_FB_JSC_TUNING) && !defined(WITH_JSC_INTERNAL)
|
||||
configureJSContextForAndroid(m_context, m_jscConfig, m_deviceCacheDir);
|
||||
#endif
|
||||
}
|
||||
|
||||
void JSCExecutor::terminateOnJSVMThread() {
|
||||
|
@ -238,13 +242,7 @@ void JSCExecutor::loadApplicationScript(
|
|||
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "JSCExecutor::loadApplicationScript",
|
||||
"sourceURL", sourceURL);
|
||||
#endif
|
||||
if (!jsSourceURL || !usePreparsingAndStringRef()) {
|
||||
evaluateScript(m_context, jsScript, jsSourceURL);
|
||||
} else {
|
||||
// If we're evaluating a script, get the device's cache dir
|
||||
// in which a cache file for that script will be stored.
|
||||
evaluateScript(m_context, jsScript, jsSourceURL, m_deviceCacheDir.c_str());
|
||||
}
|
||||
flush();
|
||||
ReactMarker::logMarker("RUN_JS_BUNDLE_END");
|
||||
ReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
|
||||
|
|
|
@ -35,21 +35,9 @@ JSValueRef makeJSCException(
|
|||
return JSValueToObject(ctx, exceptionString, NULL);
|
||||
}
|
||||
|
||||
JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef source, const char *cachePath) {
|
||||
JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef source) {
|
||||
JSValueRef exn, result;
|
||||
#if WITH_FBJSCEXTENSIONS
|
||||
// Only evaluate the script using pre-parsing cache if the script comes from
|
||||
// a bundle file and a cache path is given.
|
||||
if (source && cachePath){
|
||||
// If evaluating an application script, send it through `JSEvaluateScriptWithCache()`
|
||||
// to add cache support.
|
||||
result = JSEvaluateScriptWithCache(context, script, NULL, source, 0, &exn, cachePath);
|
||||
} else {
|
||||
result = JSEvaluateScript(context, script, NULL, source, 0, &exn);
|
||||
}
|
||||
#else
|
||||
result = JSEvaluateScript(context, script, NULL, source, 0, &exn);
|
||||
#endif
|
||||
if (result == nullptr) {
|
||||
Value exception = Value(context, exn);
|
||||
std::string exceptionText = exception.toString().str();
|
||||
|
|
|
@ -42,7 +42,6 @@ JSValueRef makeJSCException(
|
|||
JSValueRef evaluateScript(
|
||||
JSContextRef ctx,
|
||||
JSStringRef script,
|
||||
JSStringRef sourceURL,
|
||||
const char* cachePath = nullptr);
|
||||
JSStringRef sourceURL);
|
||||
|
||||
} }
|
||||
|
|
Loading…
Reference in New Issue