Commit 91ec9872 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[error] Add use counters for non-standard Error features

V8 provides non-standard Error API through:

Error.captureStackTrace
Error.prepareStackTrace
Error.stackTraceLimit

Let's add use counters to gauge how wide-spread these are used.

This is the V8 side of required changes.
The Chromium-side CL: https://crrev.com/c/753446

Bug: v8:6975
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I917cd6344a01670799f6cbf88a4bfff8e8d0d6ad
Reviewed-on: https://chromium-review.googlesource.com/753443Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49113}
parent 3510728f
......@@ -7074,9 +7074,13 @@ class V8_EXPORT Isolate {
kLabeledExpressionStatement = 40,
kLineOrParagraphSeparatorAsLineTerminator = 41,
kIndexAccessor = 42,
kErrorCaptureStackTrace = 43,
kErrorPrepareStackTrace = 44,
kErrorStackTraceLimit = 45,
// If you add new values here, you'll also need to update Chromium's:
// UseCounter.h, V8PerIsolateData.cpp, histograms.xml
// web_feature.mojom, UseCounterCallback.cpp, and enums.xml. V8 changes to
// this list need to be landed first, then changes on the Chromium side.
kUseCounterFeatureCount // This enum value must be last.
};
......
......@@ -42,6 +42,8 @@ BUILTIN(ErrorCaptureStackTrace) {
HandleScope scope(isolate);
Handle<Object> object_obj = args.atOrUndefined(isolate, 1);
isolate->CountUsage(v8::Isolate::kErrorCaptureStackTrace);
if (!object_obj->IsJSObject()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kInvalidArgument, object_obj));
......
......@@ -568,6 +568,11 @@ bool GetStackTraceLimit(Isolate* isolate, int* result) {
// Ensure that limit is not negative.
*result = Max(FastD2IChecked(stack_trace_limit->Number()), 0);
if (*result != FLAG_stack_trace_limit) {
isolate->CountUsage(v8::Isolate::kErrorStackTraceLimit);
}
return true;
}
......
......@@ -952,6 +952,8 @@ MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate,
if (prepare_stack_trace->IsJSFunction() && !in_recursion) {
PrepareStackTraceScope scope(isolate);
isolate->CountUsage(v8::Isolate::kErrorPrepareStackTrace);
Handle<JSArray> sites;
ASSIGN_RETURN_ON_EXCEPTION(isolate, sites, GetStackFrames(isolate, elems),
Object);
......
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