diff --git a/React/Modules/RCTDevMenu.mm b/React/Modules/RCTDevMenu.mm index 3e2e1ed9e..95f29bf2c 100644 --- a/React/Modules/RCTDevMenu.mm +++ b/React/Modules/RCTDevMenu.mm @@ -540,7 +540,7 @@ RCT_EXPORT_MODULE() if (JSC_JSSamplingProfilerEnabled(self->_bridge.jsContext.JSGlobalContextRef)) { JSContext *context = self->_bridge.jsContext; // Allow to toggle the sampling profiler through RN's dev menu - [self->_bridge.devMenu addItem:[RCTDevMenuItem buttonItemWithTitle:@"Start / Stop JS Sampling Profiler" handler:^{ + [items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Start / Stop JS Sampling Profiler" handler:^{ JSGlobalContextRef globalContext = context.JSGlobalContextRef; // JSPokeSamplingProfiler() toggles the profiling process JSValueRef jsResult = JSC_JSPokeSamplingProfiler(globalContext); diff --git a/ReactCommon/cxxreact/JSCExecutor.cpp b/ReactCommon/cxxreact/JSCExecutor.cpp index d176c658e..65a7e719b 100644 --- a/ReactCommon/cxxreact/JSCExecutor.cpp +++ b/ReactCommon/cxxreact/JSCExecutor.cpp @@ -40,6 +40,9 @@ #ifdef WITH_JSC_EXTRA_TRACING #include "JSCLegacyProfiler.h" #include "JSCLegacyTracing.h" +#endif + +#if !defined(__APPLE__) && defined(WITH_JSC_EXTRA_TRACING) #include #endif @@ -278,7 +281,11 @@ void JSCExecutor::initOnJSVMThread() throw(JSException) { PerfLogging::installNativeHooks(m_context); #endif - initSamplingProfilerOnMainJSCThread(m_context); + #if defined(__APPLE__) || defined(WITH_JSC_EXTRA_TRACING) + if (JSC_JSSamplingProfilerEnabled(m_context)) { + initSamplingProfilerOnMainJSCThread(m_context); + } + #endif #ifdef WITH_FB_MEMORY_PROFILING addNativeMemoryHooks(m_context);