From a7c82f4564854e415d8bd2dd60e28c8e3c462343 Mon Sep 17 00:00:00 2001 From: Micha? Gregorczyk Date: Tue, 12 Apr 2016 08:01:54 -0700 Subject: [PATCH] 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 --- ReactAndroid/src/main/jni/react/JSCExecutor.cpp | 12 +++++------- ReactAndroid/src/main/jni/react/JSCHelpers.cpp | 14 +------------- ReactAndroid/src/main/jni/react/JSCHelpers.h | 3 +-- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/ReactAndroid/src/main/jni/react/JSCExecutor.cpp b/ReactAndroid/src/main/jni/react/JSCExecutor.cpp index 5444da6c4..7313e06c7 100644 --- a/ReactAndroid/src/main/jni/react/JSCExecutor.cpp +++ b/ReactAndroid/src/main/jni/react/JSCExecutor.cpp @@ -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()); - } + evaluateScript(m_context, jsScript, jsSourceURL); flush(); ReactMarker::logMarker("RUN_JS_BUNDLE_END"); ReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); diff --git a/ReactAndroid/src/main/jni/react/JSCHelpers.cpp b/ReactAndroid/src/main/jni/react/JSCHelpers.cpp index 27dca94f1..687c775db 100644 --- a/ReactAndroid/src/main/jni/react/JSCHelpers.cpp +++ b/ReactAndroid/src/main/jni/react/JSCHelpers.cpp @@ -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(); diff --git a/ReactAndroid/src/main/jni/react/JSCHelpers.h b/ReactAndroid/src/main/jni/react/JSCHelpers.h index 429ea3d20..31f1f615f 100644 --- a/ReactAndroid/src/main/jni/react/JSCHelpers.h +++ b/ReactAndroid/src/main/jni/react/JSCHelpers.h @@ -42,7 +42,6 @@ JSValueRef makeJSCException( JSValueRef evaluateScript( JSContextRef ctx, JSStringRef script, - JSStringRef sourceURL, - const char* cachePath = nullptr); + JSStringRef sourceURL); } }