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
|
#ifdef JSC_HAS_PERF_STATS_API
|
||||||
addJSCPerfStatsHooks(m_context);
|
addJSCPerfStatsHooks(m_context);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(WITH_FB_JSC_TUNING) && !defined(WITH_JSC_INTERNAL)
|
||||||
|
configureJSContextForAndroid(m_context, m_jscConfig, m_deviceCacheDir);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void JSCExecutor::terminateOnJSVMThread() {
|
void JSCExecutor::terminateOnJSVMThread() {
|
||||||
|
@ -238,13 +242,7 @@ void JSCExecutor::loadApplicationScript(
|
||||||
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "JSCExecutor::loadApplicationScript",
|
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "JSCExecutor::loadApplicationScript",
|
||||||
"sourceURL", sourceURL);
|
"sourceURL", sourceURL);
|
||||||
#endif
|
#endif
|
||||||
if (!jsSourceURL || !usePreparsingAndStringRef()) {
|
evaluateScript(m_context, jsScript, jsSourceURL);
|
||||||
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();
|
flush();
|
||||||
ReactMarker::logMarker("RUN_JS_BUNDLE_END");
|
ReactMarker::logMarker("RUN_JS_BUNDLE_END");
|
||||||
ReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
|
ReactMarker::logMarker("CREATE_REACT_CONTEXT_END");
|
||||||
|
|
|
@ -35,21 +35,9 @@ JSValueRef makeJSCException(
|
||||||
return JSValueToObject(ctx, exceptionString, NULL);
|
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;
|
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);
|
result = JSEvaluateScript(context, script, NULL, source, 0, &exn);
|
||||||
#endif
|
|
||||||
if (result == nullptr) {
|
if (result == nullptr) {
|
||||||
Value exception = Value(context, exn);
|
Value exception = Value(context, exn);
|
||||||
std::string exceptionText = exception.toString().str();
|
std::string exceptionText = exception.toString().str();
|
||||||
|
|
|
@ -42,7 +42,6 @@ JSValueRef makeJSCException(
|
||||||
JSValueRef evaluateScript(
|
JSValueRef evaluateScript(
|
||||||
JSContextRef ctx,
|
JSContextRef ctx,
|
||||||
JSStringRef script,
|
JSStringRef script,
|
||||||
JSStringRef sourceURL,
|
JSStringRef sourceURL);
|
||||||
const char* cachePath = nullptr);
|
|
||||||
|
|
||||||
} }
|
} }
|
||||||
|
|
Loading…
Reference in New Issue