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
This commit is contained in:
Dan Caspi 2017-05-31 11:04:00 -07:00 committed by Facebook Github Bot
parent 57bb955ba1
commit 578227d83b
3 changed files with 9 additions and 1 deletions

View File

@ -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 <objc/objc.h>
@ -64,6 +65,7 @@ struct JSCWrapper {
// JSContext
JSC_WRAPPER_METHOD(JSContextGetGlobalContext);
JSC_WRAPPER_METHOD(JSContextGetGlobalObject);
JSC_WRAPPER_METHOD(FBJSContextStartGCTimers);
// JSEvaluate
JSC_WRAPPER_METHOD(JSEvaluateScript);

View File

@ -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__)

View File

@ -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 =