Commit 35e58232 authored by Simon Zünd's avatar Simon Zünd Committed by V8 LUCI CQ

[inspector] Add use counter for async stack tagging API

We count the calls to `createTask` to track adoption.

Chromium CL: https://crrev.com/c/3894138

R=kimanh@chromium.org

Bug: chromium:1334585
Change-Id: I091f738e5b0dfdbb5843cda09eed7d3f906ea681
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3892783
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarKim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83199}
parent 0b455d08
...@@ -535,6 +535,7 @@ class V8_EXPORT Isolate { ...@@ -535,6 +535,7 @@ class V8_EXPORT Isolate {
kFunctionPrototypeArguments = 113, kFunctionPrototypeArguments = 113,
kFunctionPrototypeCaller = 114, kFunctionPrototypeCaller = 114,
kTurboFanOsrCompileStarted = 115, kTurboFanOsrCompileStarted = 115,
kAsyncStackTaggingCreateTaskCall = 116,
// If you add new values here, you'll also need to update Chromium's: // If you add new values here, you'll also need to update Chromium's:
// web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
......
...@@ -1434,6 +1434,11 @@ bool isExperimentalAsyncStackTaggingApiEnabled() { ...@@ -1434,6 +1434,11 @@ bool isExperimentalAsyncStackTaggingApiEnabled() {
return v8::internal::FLAG_experimental_async_stack_tagging_api; return v8::internal::FLAG_experimental_async_stack_tagging_api;
} }
void RecordAsyncStackTaggingCreateTaskCall(v8::Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->CountUsage(v8::Isolate::kAsyncStackTaggingCreateTaskCall);
}
std::unique_ptr<PropertyIterator> PropertyIterator::Create( std::unique_ptr<PropertyIterator> PropertyIterator::Create(
Local<Context> context, Local<Object> object, bool skip_indices) { Local<Context> context, Local<Object> object, bool skip_indices) {
internal::Isolate* isolate = internal::Isolate* isolate =
......
...@@ -733,6 +733,8 @@ MaybeLocal<Message> GetMessageFromPromise(Local<Promise> promise); ...@@ -733,6 +733,8 @@ MaybeLocal<Message> GetMessageFromPromise(Local<Promise> promise);
bool isExperimentalAsyncStackTaggingApiEnabled(); bool isExperimentalAsyncStackTaggingApiEnabled();
void RecordAsyncStackTaggingCreateTaskCall(v8::Isolate* isolate);
} // namespace debug } // namespace debug
} // namespace v8 } // namespace v8
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "include/v8-inspector.h" #include "include/v8-inspector.h"
#include "include/v8-microtask-queue.h" #include "include/v8-microtask-queue.h"
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/debug/debug-interface.h"
#include "src/inspector/injected-script.h" #include "src/inspector/injected-script.h"
#include "src/inspector/inspected-context.h" #include "src/inspector/inspected-context.h"
#include "src/inspector/string-util.h" #include "src/inspector/string-util.h"
...@@ -490,6 +491,9 @@ void V8Console::memorySetterCallback( ...@@ -490,6 +491,9 @@ void V8Console::memorySetterCallback(
void V8Console::createTask(const v8::FunctionCallbackInfo<v8::Value>& info) { void V8Console::createTask(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate(); v8::Isolate* isolate = info.GetIsolate();
v8::debug::RecordAsyncStackTaggingCreateTaskCall(isolate);
if (info.Length() < 1 || !info[0]->IsString() || if (info.Length() < 1 || !info[0]->IsString() ||
!info[0].As<v8::String>()->Length()) { !info[0].As<v8::String>()->Length()) {
isolate->ThrowError("First argument must be a non-empty string."); isolate->ThrowError("First argument must be a non-empty string.");
......
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