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

This reverts commit 78786a2f66.

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/+/1948718
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65332}
This commit is contained in:
Maya Lekova 2019-12-04 12:11:43 +01:00 committed by Commit Bot
parent 29af4273a5
commit fd33223c30
4 changed files with 4 additions and 58 deletions

View File

@ -8236,19 +8236,7 @@ class V8_EXPORT Isolate {
kRegExpExecCalledOnSlowRegExp = 79, kRegExpExecCalledOnSlowRegExp = 79,
kRegExpReplaceCalledOnSlowRegExp = 80, kRegExpReplaceCalledOnSlowRegExp = 80,
kDisplayNames = 81, kDisplayNames = 81,
// Temporary kCallInDetachedWindowBy* counters are for reporting function kSharedArrayBufferConstructed = 82,
// 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,
// 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

View File

@ -503,10 +503,6 @@ STATIC_ASSERT(NativeContext::kSize ==
void NativeContext::SetDetachedWindowReason( void NativeContext::SetDetachedWindowReason(
v8::Context::DetachedWindowReason reason) { v8::Context::DetachedWindowReason reason) {
set_detached_window_reason(Smi::FromEnum(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() v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason()
@ -515,11 +511,5 @@ v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason()
detached_window_reason().value()); 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 internal
} // namespace v8 } // namespace v8

View File

@ -369,7 +369,6 @@ enum ContextLookupFlags {
V(WEAKSET_ADD_INDEX, JSFunction, weakset_add) \ V(WEAKSET_ADD_INDEX, JSFunction, weakset_add) \
V(OSR_CODE_CACHE_INDEX, WeakFixedArray, osr_code_cache) \ V(OSR_CODE_CACHE_INDEX, WeakFixedArray, osr_code_cache) \
V(DETACHED_WINDOW_REASON_INDEX, Smi, detached_window_reason) \ 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) NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V)
// A table of all script contexts. Every loaded top-level script with top-level // 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); void SetDetachedWindowReason(v8::Context::DetachedWindowReason reason);
v8::Context::DetachedWindowReason GetDetachedWindowReason() const; v8::Context::DetachedWindowReason GetDetachedWindowReason() const;
// This can be off up to 1s in each direction.
int SecondsSinceDetachedWindow() const;
private: private:
STATIC_ASSERT(OffsetOfElementAt(EMBEDDER_DATA_INDEX) == STATIC_ASSERT(OffsetOfElementAt(EMBEDDER_DATA_INDEX) ==

View File

@ -87,38 +87,9 @@ RUNTIME_FUNCTION(Runtime_ReportDetachedWindowAccess) {
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
Handle<NativeContext> native_context(isolate->context().native_context(), Handle<NativeContext> native_context(isolate->context().native_context(),
isolate); isolate);
v8::Isolate::UseCounterFeature counter_main; // TODO(bartekn,chromium:1018156): Report this to Blink, for it to emit it
v8::Isolate::UseCounterFeature counter_10s; // via UKM. Use native_context->detached_window_reason().value()
v8::Isolate::UseCounterFeature counter_1min; // This will be addressed as the first step after this CL lands.
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);
}
// The return value isn't needed, but RUNTIME_FUNCTION sets it up. // The return value isn't needed, but RUNTIME_FUNCTION sets it up.
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();