[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/+/3695563 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/main@{#81055}
This commit is contained in:
parent
3614c8609d
commit
26999f997b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user