Commit fd33223c authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Revert "Introduce and emit "function calls in detached window" use counters."

This reverts commit 78786a2f.

Reason for revert: Possible culprit for https://bugs.chromium.org/p/chromium/issues/detail?id=1029863

Original change's description:
> Introduce and emit "function calls in detached window" use counters.
> 
> Bug: chromium:1018156
> Change-Id: I2133bd8fc4ae4d9ce3c16c50887beb677d979e18
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924000
> Commit-Queue: Bartek Nowierski <bartekn@chromium.org>
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#65272}

TBR=ulan@chromium.org,tasak@google.com,jgruber@chromium.org,bartekn@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1018156
Change-Id: I78465f5e979b219079bd4156bb7277b3a968c85d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1948718Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65332}
parent 29af4273
......@@ -8236,19 +8236,7 @@ class V8_EXPORT Isolate {
kRegExpExecCalledOnSlowRegExp = 79,
kRegExpReplaceCalledOnSlowRegExp = 80,
kDisplayNames = 81,
// Temporary kCallInDetachedWindowBy* counters are for reporting function
// calls within contexts marked using |SetDetachedWindowReason|.
// TODO(bartekn,chromium:1018156): Remove once not needed.
kCallInDetachedWindowByNavigation = 82,
kCallInDetachedWindowByNavigationAfter10s = 83,
kCallInDetachedWindowByNavigationAfter1min = 84,
kCallInDetachedWindowByClosing = 85,
kCallInDetachedWindowByClosingAfter10s = 86,
kCallInDetachedWindowByClosingAfter1min = 87,
kCallInDetachedWindowByOtherReason = 88,
kCallInDetachedWindowByOtherReasonAfter10s = 89,
kCallInDetachedWindowByOtherReasonAfter1min = 90,
kSharedArrayBufferConstructed = 91,
kSharedArrayBufferConstructed = 82,
// 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
......
......@@ -503,10 +503,6 @@ STATIC_ASSERT(NativeContext::kSize ==
void NativeContext::SetDetachedWindowReason(
v8::Context::DetachedWindowReason reason) {
set_detached_window_reason(Smi::FromEnum(reason));
Isolate* isolate = GetIsolate();
set_detached_window_time_in_seconds(
Smi::FromInt(static_cast<int>(isolate->time_millis_since_init() / 1000)));
}
v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason()
......@@ -515,11 +511,5 @@ v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason()
detached_window_reason().value());
}
int NativeContext::SecondsSinceDetachedWindow() const {
Isolate* isolate = GetIsolate();
return static_cast<int>(isolate->time_millis_since_init() / 1000 -
detached_window_time_in_seconds().value());
}
} // namespace internal
} // namespace v8
......@@ -369,7 +369,6 @@ enum ContextLookupFlags {
V(WEAKSET_ADD_INDEX, JSFunction, weakset_add) \
V(OSR_CODE_CACHE_INDEX, WeakFixedArray, osr_code_cache) \
V(DETACHED_WINDOW_REASON_INDEX, Smi, detached_window_reason) \
V(DETACHED_WINDOW_TIME_INDEX, Smi, detached_window_time_in_seconds) \
NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V)
// A table of all script contexts. Every loaded top-level script with top-level
......@@ -735,8 +734,6 @@ class NativeContext : public Context {
void SetDetachedWindowReason(v8::Context::DetachedWindowReason reason);
v8::Context::DetachedWindowReason GetDetachedWindowReason() const;
// This can be off up to 1s in each direction.
int SecondsSinceDetachedWindow() const;
private:
STATIC_ASSERT(OffsetOfElementAt(EMBEDDER_DATA_INDEX) ==
......
......@@ -87,38 +87,9 @@ RUNTIME_FUNCTION(Runtime_ReportDetachedWindowAccess) {
DCHECK_EQ(0, args.length());
Handle<NativeContext> native_context(isolate->context().native_context(),
isolate);
v8::Isolate::UseCounterFeature counter_main;
v8::Isolate::UseCounterFeature counter_10s;
v8::Isolate::UseCounterFeature counter_1min;
switch (native_context->GetDetachedWindowReason()) {
case v8::Context::kWindowNotDetached:
// We should never get here. Just exit early in case we do.
return ReadOnlyRoots(isolate).undefined_value();
case v8::Context::kDetachedWindowByNavigation:
counter_main = v8::Isolate::kCallInDetachedWindowByNavigation;
counter_10s = v8::Isolate::kCallInDetachedWindowByNavigationAfter10s;
counter_1min = v8::Isolate::kCallInDetachedWindowByNavigationAfter1min;
break;
case v8::Context::kDetachedWindowByClosing:
counter_main = v8::Isolate::kCallInDetachedWindowByClosing;
counter_10s = v8::Isolate::kCallInDetachedWindowByClosingAfter10s;
counter_1min = v8::Isolate::kCallInDetachedWindowByClosingAfter1min;
break;
case v8::Context::kDetachedWindowByOtherReason:
counter_main = v8::Isolate::kCallInDetachedWindowByOtherReason;
counter_10s = v8::Isolate::kCallInDetachedWindowByOtherReasonAfter10s;
counter_1min = v8::Isolate::kCallInDetachedWindowByOtherReasonAfter1min;
break;
}
isolate->CountUsage(counter_main);
// This can be off by up to 1s in each direction, but that's ok.
int secs_passed = native_context->SecondsSinceDetachedWindow();
if (secs_passed >= 10) {
isolate->CountUsage(counter_10s);
}
if (secs_passed >= 60) {
isolate->CountUsage(counter_1min);
}
// TODO(bartekn,chromium:1018156): Report this to Blink, for it to emit it
// via UKM. Use native_context->detached_window_reason().value()
// This will be addressed as the first step after this CL lands.
// The return value isn't needed, but RUNTIME_FUNCTION sets it up.
return ReadOnlyRoots(isolate).undefined_value();
......
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