Commit 26999f99 authored by Camillo's avatar Camillo Committed by V8 LUCI CQ

[runtime] Throw error if RCS runtime function is used without RCS

%GetAndResetRuntimeCallStats(...) is changed to throw:
- if the RCS compile-time flag was not set
- if --runtime-call-stats / tracing RCS is not enabled

This avoids a few debug cycles when trying to get RCS with official
release builds that don't ship it.

Change-Id: I92b1271b34b76439c2a5cddff853619c983549bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3695563Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81055}
parent 3614c860
......@@ -570,6 +570,14 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
HandleScope scope(isolate);
DCHECK_LE(args.length(), 2);
#ifdef V8_RUNTIME_CALL_STATS
if (!FLAG_runtime_call_stats) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kInvalid,
isolate->factory()->NewStringFromAsciiChecked(
"Runtime Call"),
isolate->factory()->NewStringFromAsciiChecked(
"--runtime-call-stats is not set")));
}
// Append any worker thread runtime call stats to the main table before
// printing.
isolate->counters()->worker_thread_runtime_call_stats()->AddToMainTable(
......@@ -612,8 +620,15 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
} else {
std::fflush(f);
}
#endif // V8_RUNTIME_CALL_STATS
return ReadOnlyRoots(isolate).undefined_value();
#else // V8_RUNTIME_CALL_STATS
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kInvalid,
isolate->factory()->NewStringFromAsciiChecked(
"Runtime Call"),
isolate->factory()->NewStringFromAsciiChecked(
"RCS was disabled at compile-time")));
#endif // V8_RUNTIME_CALL_STATS
}
RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment