Commit d51f4c82 authored by Brad Nelson's avatar Brad Nelson Committed by Commit Bot

[wasm] Adding public usage metric for WebAssembly.

BUG=v8:7068
R=kschimpf@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Iaf29d3696094722853fb67b29c697860752e256e
Reviewed-on: https://chromium-review.googlesource.com/763995
Commit-Queue: Eric Holk <eholk@chromium.org>
Reviewed-by: 's avatarEric Holk <eholk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49431}
parent 0df1471a
......@@ -7072,6 +7072,7 @@ class V8_EXPORT Isolate {
kErrorCaptureStackTrace = 43,
kErrorPrepareStackTrace = 44,
kErrorStackTraceLimit = 45,
kWebAssemblyInstantiation = 46,
// If you add new values here, you'll also need to update Chromium's:
// web_feature.mojom, UseCounterCallback.cpp, and enums.xml. V8 changes to
......
......@@ -342,11 +342,13 @@ void WebAssemblyInstantiateToPairCallback(
// new WebAssembly.Instance(module, imports) -> WebAssembly.Instance
void WebAssemblyInstance(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i_isolate->CountUsage(
v8::Isolate::UseCounterFeature::kWebAssemblyInstantiation);
MicrotasksScope does_not_run_microtasks(isolate,
MicrotasksScope::kDoNotRunMicrotasks);
HandleScope scope(args.GetIsolate());
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (i_isolate->wasm_instance_callback()(args)) return;
i::wasm::ScheduledErrorThrower thrower(i_isolate, "WebAssembly.Instance()");
......@@ -368,6 +370,8 @@ void WebAssemblyInstantiateStreaming(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i_isolate->CountUsage(
v8::Isolate::UseCounterFeature::kWebAssemblyInstantiation);
// we use i_isolate in DCHECKS in the ASSIGN statements.
USE(i_isolate);
MicrotasksScope runs_microtasks(isolate, MicrotasksScope::kRunMicrotasks);
......@@ -397,6 +401,8 @@ void WebAssemblyInstantiateStreaming(
void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i_isolate->CountUsage(
v8::Isolate::UseCounterFeature::kWebAssemblyInstantiation);
MicrotasksScope runs_microtasks(isolate, MicrotasksScope::kRunMicrotasks);
i::wasm::ScheduledErrorThrower thrower(i_isolate,
......
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