Skip to content

Commit 8c9f366

Browse files
lavenzgfacebook-github-bot
authored andcommitted
Move methods from IHermesExtra to IHermes (#53473)
Summary: Pull Request resolved: #53473 This is a cleanup of IHermesExtra: 1. Move dumpSampledTraceToProfile() and debugJavasScript() to IHermes. I'm still keeping the empty DebugFlags, since changing that requires more changes. It's also possible that we may need it in the future. 2. Remove `dumpBasicBlockProfileTrace`. Use writeBasicBlockProfileTraceToFile` if users need to dump the profile. Changelog: [Internal] Reviewed By: tsaichien Differential Revision: D81075460 fbshipit-source-id: b81005e531809cfd870fd9bdb5c0e17864ed92fb
1 parent 89d9533 commit 8c9f366

File tree

1 file changed

+21
-0
lines changed
  • packages/react-native/ReactCommon/jsi/jsi

1 file changed

+21
-0
lines changed

packages/react-native/ReactCommon/jsi/jsi/hermes.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class GCExecTrace;
1818

1919
namespace facebook::hermes {
2020

21+
namespace sampling_profiler {
22+
class Profile;
23+
}
24+
2125
namespace debugger {
2226
class Debugger;
2327
}
@@ -33,10 +37,27 @@ class JSI_EXPORT IHermes : public jsi::ICast {
3337
0xa6f7,
3438
0x325096b39f47};
3539

40+
struct DebugFlags {
41+
// Looking for the .lazy flag? It's no longer necessary.
42+
// Source is evaluated lazily by default. See
43+
// RuntimeConfig::CompilationMode.
44+
};
45+
46+
/// Evaluate the given code in an unoptimized form, used for debugging.
47+
/// This will be no-op if the implementation does not have debugger enabled.
48+
virtual void debugJavaScript(
49+
const std::string& src,
50+
const std::string& sourceURL,
51+
const DebugFlags& debugFlags) = 0;
52+
3653
/// Return a ICast pointer to an object that be cast into the interface
3754
/// IHermesRootAPI. This root API object has static lifetime.
3855
virtual ICast* getHermesRootAPI() = 0;
3956

57+
/// Dump sampled stack trace for a given runtime to a data structure that can
58+
/// be used by third parties.
59+
virtual sampling_profiler::Profile dumpSampledTraceToProfile() = 0;
60+
4061
/// Serialize the sampled stack to the format expected by DevTools'
4162
/// Profiler.stop return type.
4263
virtual void sampledTraceToStreamInDevToolsFormat(std::ostream& stream) = 0;

0 commit comments

Comments
 (0)