From c80b0eaf9244c276df40052974ef3f7e69d6e95d Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 9 Feb 2023 06:16:26 -0800 Subject: [PATCH] Fully remove usage of timed runtime Summary: Re-land of D42923921 (https://github.com/facebook/react-native/commit/1c8179b9b199c46ebfed898253786cce63b201fc), which was backed out due to a flow-error. --- Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D43152663 fbshipit-source-id: 03b2fe096ac3b8b996d032b13c6d5c74ba2b1952 --- ReactCommon/cxxreact/BUCK | 4 ++- .../hermes/executor/HermesExecutorFactory.cpp | 14 ++++----- flow/JSITimerInternalType.js | 30 ------------------- 3 files changed, 9 insertions(+), 39 deletions(-) delete mode 100644 flow/JSITimerInternalType.js diff --git a/ReactCommon/cxxreact/BUCK b/ReactCommon/cxxreact/BUCK index c22ce5b7d0..9c8a168461 100644 --- a/ReactCommon/cxxreact/BUCK +++ b/ReactCommon/cxxreact/BUCK @@ -123,6 +123,9 @@ rn_xplat_cxx_library( for header in CXXREACT_PUBLIC_HEADERS ]), compiler_flags_pedantic = True, + exported_preprocessor_flags = [ + "-DWITH_FBSYSTRACE=1", + ], fbandroid_preprocessor_flags = get_android_inspector_flags(), fbobjc_compiler_flags = get_apple_compiler_flags(), fbobjc_force_static = True, @@ -134,7 +137,6 @@ rn_xplat_cxx_library( platforms = (ANDROID, APPLE, CXX), preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", ], tests = [ react_native_xplat_target("cxxreact/tests:tests"), diff --git a/ReactCommon/hermes/executor/HermesExecutorFactory.cpp b/ReactCommon/hermes/executor/HermesExecutorFactory.cpp index ef8bcae593..9d68c8c510 100644 --- a/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +++ b/ReactCommon/hermes/executor/HermesExecutorFactory.cpp @@ -27,12 +27,6 @@ namespace react { namespace { -std::unique_ptr makeHermesRuntimeSystraced( - const ::hermes::vm::RuntimeConfig &runtimeConfig) { - SystraceSection s("HermesExecutorFactory::makeHermesRuntimeSystraced"); - return hermes::makeHermesRuntime(runtimeConfig); -} - class HermesExecutorRuntimeAdapter : public facebook::hermes::inspector::RuntimeAdapter { public: @@ -189,8 +183,12 @@ void HermesExecutorFactory::setDebuggerName(const std::string &debuggerName) { std::unique_ptr HermesExecutorFactory::createJSExecutor( std::shared_ptr delegate, std::shared_ptr jsQueue) { - std::unique_ptr hermesRuntime = - makeHermesRuntimeSystraced(runtimeConfig_); + std::unique_ptr hermesRuntime; + { + SystraceSection s("makeHermesRuntime"); + hermesRuntime = hermes::makeHermesRuntime(runtimeConfig_); + } + HermesRuntime &hermesRuntimeRef = *hermesRuntime; auto decoratedRuntime = std::make_shared( std::move(hermesRuntime), diff --git a/flow/JSITimerInternalType.js b/flow/JSITimerInternalType.js deleted file mode 100644 index d6ace6a943..0000000000 --- a/flow/JSITimerInternalType.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -// Declarations for functionality exposed by Hermes' TimerStats decorator. -// -// For backwards-compatibility, code that uses such functionality must also -// check explicitly at run-time whether the object(s) and method(s) exist, and -// fail safely if not. - -/** - * JSITimerInternalType is the global object installed by Hermes' TimedRuntime - * decorator, and it is used to extract runtime timing information. - */ -declare type $JSITimerInternalType = { - /** - * Returns the counters that TimedRuntime keep track. - * There are no guarantees about what keys exist in it, but they can be - * printed for informational purposes. - * @return An object that maps strings to various types of performance - * statistics. - */ - +getTimes?: () => {[string]: number | string, ...}, -};