Commit db18e495 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC/s390: Add a debug v8 API SetDetachedWindowReason

Port 63dc5556

Original Commit Message:

    A window is a Blink concept. This API marks the context as backing
    a detached window. This doesn't necessarily mean that the context is
    detached.

    Every time a JS function is called within a context that has a non-zero
    DetachedWindowReason, Runtime::kReportDetachedWindowAccess is invoked,
    which will report this call to Blink via a callback, which in turn can
    report number of such calls via UKM metrics.

R=bartekn@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I2243898115287e103ba5700499b9547fe155dceb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1919954Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#65018}
parent 461b98f3
......@@ -2036,6 +2036,14 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
Operand(SharedFunctionInfo::IsStrictBit::kMask |
SharedFunctionInfo::IsNativeBit::kMask));
__ bne(&done_convert, cr0);
// Check if the window is marked as detached.
Label detached_window, after_detached_window;
__ LoadNativeContextSlot(Context::DETACHED_WINDOW_REASON_INDEX, r6);
__ CmpSmiLiteral(r6, Smi::zero(), r0);
__ bne(&detached_window);
__ bind(&after_detached_window);
{
// ----------- S t a t e -------------
// -- r3 : the number of arguments (not including the receiver)
......@@ -2109,6 +2117,15 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
__ push(r4);
__ CallRuntime(Runtime::kThrowConstructorNonCallableError);
}
__ bind(&detached_window);
{
FrameScope frame(masm, StackFrame::INTERNAL);
__ PushCallerSaved(kDontSaveFPRegs, r6);
__ CallRuntime(Runtime::kReportDetachedWindowAccess);
__ PopCallerSaved(kDontSaveFPRegs, r6);
}
__ jmp(&after_detached_window);
}
namespace {
......
......@@ -2094,6 +2094,14 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
Operand(SharedFunctionInfo::IsStrictBit::kMask |
SharedFunctionInfo::IsNativeBit::kMask));
__ bne(&done_convert);
// Check if the window is marked as detached.
Label detached_window, after_detached_window;
__ LoadNativeContextSlot(Context::DETACHED_WINDOW_REASON_INDEX, r5);
__ CmpSmiLiteral(r5, Smi::zero(), r0);
__ bne(&detached_window);
__ bind(&after_detached_window);
{
// ----------- S t a t e -------------
// -- r2 : the number of arguments (not including the receiver)
......@@ -2167,6 +2175,15 @@ void Builtins::Generate_CallFunction(MacroAssembler* masm,
__ push(r3);
__ CallRuntime(Runtime::kThrowConstructorNonCallableError);
}
__ bind(&detached_window);
{
FrameScope frame(masm, StackFrame::INTERNAL);
__ PushCallerSaved(kDontSaveFPRegs, r5);
__ CallRuntime(Runtime::kReportDetachedWindowAccess);
__ PopCallerSaved(kDontSaveFPRegs, r5);
}
__ jmp(&after_detached_window);
}
namespace {
......
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