PPC/s390: Add a debug v8 API SetDetachedWindowReason

Port 63dc55568b

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/+/1919954
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#65018}
This commit is contained in:
Milad Farazmand 2019-11-18 18:07:03 +00:00 committed by Commit Bot
parent 461b98f3e0
commit db18e49556
2 changed files with 34 additions and 0 deletions

View File

@ -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 {

View File

@ -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 {