From 578227d83be60981088e7e3ff85c6e071fa534f3 Mon Sep 17 00:00:00 2001 From: Dan Caspi Date: Wed, 31 May 2017 11:04:00 -0700 Subject: [PATCH] Adding the ability to run GC on a different thread than the one JSContext was created in Reviewed By: javache Differential Revision: D5121232 fbshipit-source-id: 28df89271c9d3f421ca27cf309ca0d3c756beba2 --- ReactCommon/jschelpers/JSCWrapper.h | 2 ++ ReactCommon/jschelpers/JavaScriptCore.h | 3 ++- ReactCommon/jschelpers/systemJSCWrapper.cpp | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ReactCommon/jschelpers/JSCWrapper.h b/ReactCommon/jschelpers/JSCWrapper.h index aa4053784..95eb6e9cd 100644 --- a/ReactCommon/jschelpers/JSCWrapper.h +++ b/ReactCommon/jschelpers/JSCWrapper.h @@ -37,6 +37,7 @@ JSC_IMPORT JSValueRef JSEvaluateBytecodeBundle(JSContextRef, JSObjectRef, int, J JSC_IMPORT bool JSSamplingProfilerEnabled(); JSC_IMPORT void JSStartSamplingProfilingOnMainJSCThread(JSGlobalContextRef); JSC_IMPORT JSValueRef JSPokeSamplingProfiler(JSContextRef); +JSC_IMPORT void FBJSContextStartGCTimers(JSContextRef); #if defined(__APPLE__) #import @@ -64,6 +65,7 @@ struct JSCWrapper { // JSContext JSC_WRAPPER_METHOD(JSContextGetGlobalContext); JSC_WRAPPER_METHOD(JSContextGetGlobalObject); + JSC_WRAPPER_METHOD(FBJSContextStartGCTimers); // JSEvaluate JSC_WRAPPER_METHOD(JSEvaluateScript); diff --git a/ReactCommon/jschelpers/JavaScriptCore.h b/ReactCommon/jschelpers/JavaScriptCore.h index 737cf828c..076386b57 100644 --- a/ReactCommon/jschelpers/JavaScriptCore.h +++ b/ReactCommon/jschelpers/JavaScriptCore.h @@ -75,8 +75,9 @@ jsc_poison(JSContextGroupCreate JSContextGroupRelease JSContextGroupRetain // JSContext #define JSC_JSContextGetGlobalContext(...) __jsc_wrapper(JSContextGetGlobalContext, __VA_ARGS__) #define JSC_JSContextGetGlobalObject(...) __jsc_wrapper(JSContextGetGlobalObject, __VA_ARGS__) +#define JSC_FBJSContextStartGCTimers(...) __jsc_wrapper(FBJSContextStartGCTimers, __VA_ARGS__) -jsc_poison(JSContextGetGlobalContext JSContextGetGlobalObject JSContextGetGroup) +jsc_poison(JSContextGetGlobalContext JSContextGetGlobalObject JSContextGetGroup FBJSContextStartGCTimers) // JSEvaluate #define JSC_JSEvaluateScript(...) __jsc_wrapper(JSEvaluateScript, __VA_ARGS__) diff --git a/ReactCommon/jschelpers/systemJSCWrapper.cpp b/ReactCommon/jschelpers/systemJSCWrapper.cpp index 142726bcd..4b04a43cb 100644 --- a/ReactCommon/jschelpers/systemJSCWrapper.cpp +++ b/ReactCommon/jschelpers/systemJSCWrapper.cpp @@ -33,6 +33,8 @@ UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSInspectorGetInstance) UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(configureJSCForIOS) +UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(FBJSContextStartGCTimers) + bool JSSamplingProfilerEnabled() { return false; } @@ -56,6 +58,9 @@ const JSCWrapper* systemJSCWrapper() { .JSContextGetGlobalContext = JSContextGetGlobalContext, .JSContextGetGlobalObject = JSContextGetGlobalObject, + .FBJSContextStartGCTimers = + (decltype(&FBJSContextStartGCTimers)) + Unimplemented_FBJSContextStartGCTimers, .JSEvaluateScript = JSEvaluateScript, .JSEvaluateBytecodeBundle =