Commit fbf04c37 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: Reland of [interpreter] Add explicit OSR polling bytecode. (patchset...

PPC/s390: Reland of [interpreter] Add explicit OSR polling bytecode. (patchset #1 id:1 of https://codereview.chromium.org/2184553003/ )

Port e1ad114e

Original commit message:

    Reason for revert:
    Fix has been landed.

    Original issue's description:
    > Revert of [interpreter] Add explicit OSR polling bytecode. (patchset #6 id:100001 of https://codereview.chromium.org/2172233002/ )
    >
    > Reason for revert:
    > Bunch of breakages. Maybe bad interaction with https://chromium.googlesource.com/v8/v8/+/e520e5da5550f0d1a975e87d6e66a2edecbb0c8e ?
    >
    > E.g.:
    > https://build.chromium.org/p/client.v8/builders/V8%20Linux64/builds/11607
    >
    > Original issue's description:
    > > [interpreter] Add explicit OSR polling bytecode.
    > >
    > > This adds an explicit {OsrPoll} bytecode into every loop header which
    > > triggers on-stack replacement when armed. Note that each such bytecode
    > > stores the static loop depths as an operand, and hence can be armed for
    > > specific loop depths.
    > >
    > > This also adds builtin code that triggers OSR compilation and switches
    > > execution over to optimized code in case compilation succeeds. In case
    > > compilation fails, the bytecode dispatch just continues unhindered.
    > >
    > > R=rmcilroy@chromium.org
    > > TEST=mjsunit/ignition/osr-from-bytecode
    > > BUG=v8:4764
    > >
    > > Committed: https://crrev.com/a55beb68e0ededb3773affa294a71edc50621458
    > > Cr-Commit-Position: refs/heads/master@{#38043}
    >
    > TBR=rmcilroy@chromium.org,mstarzinger@chromium.org
    > # Skipping CQ checks because original CL landed less than 1 days ago.
    > NOPRESUBMIT=true
    > NOTREECHECKS=true
    > NOTRY=true
    > BUG=v8:4764
    >
    > Committed: https://crrev.com/439aa2c6d708bfd95db725bd6f97c4c49bbc51fc
    > Cr-Commit-Position: refs/heads/master@{#38044}

R=mstarzinger@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=v8:4764
LOG=N

Review-Url: https://codereview.chromium.org/2182173002
Cr-Commit-Position: refs/heads/master@{#38063}
parent 7588e803
......@@ -1746,9 +1746,16 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kThrowIllegalInvocation);
}
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
static void Generate_OnStackReplacementHelper(MacroAssembler* masm,
bool has_handler_frame) {
// Lookup the function in the JavaScript frame.
__ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
if (has_handler_frame) {
__ LoadP(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ LoadP(r3, MemOperand(r3, JavaScriptFrameConstants::kFunctionOffset));
} else {
__ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
// Pass function as argument.
......@@ -1756,7 +1763,7 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
__ CallRuntime(Runtime::kCompileForOnStackReplacement);
}
// If the code object is null, just return to the unoptimized code.
// If the code object is null, just return to the caller.
Label skip;
__ CmpSmiLiteral(r3, Smi::FromInt(0), r0);
__ bne(&skip);
......@@ -1764,6 +1771,12 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
__ bind(&skip);
// Drop any potential handler frame that is be sitting on top of the actual
// JavaScript frame. This is the case then OSR is triggered from bytecode.
if (has_handler_frame) {
__ LeaveFrame(StackFrame::STUB);
}
// Load deoptimization data from the code object.
// <deopt_data> = <code>[#deoptimization_data_offset]
__ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset));
......@@ -1792,6 +1805,14 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
}
}
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
Generate_OnStackReplacementHelper(masm, false);
}
void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
Generate_OnStackReplacementHelper(masm, true);
}
// static
void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
int field_index) {
......
......@@ -1757,9 +1757,16 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kThrowIllegalInvocation);
}
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
static void Generate_OnStackReplacementHelper(MacroAssembler* masm,
bool has_handler_frame) {
// Lookup the function in the JavaScript frame.
__ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
if (has_handler_frame) {
__ LoadP(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ LoadP(r2, MemOperand(r2, JavaScriptFrameConstants::kFunctionOffset));
} else {
__ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
{
FrameScope scope(masm, StackFrame::INTERNAL);
// Pass function as argument.
......@@ -1767,7 +1774,7 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
__ CallRuntime(Runtime::kCompileForOnStackReplacement);
}
// If the code object is null, just return to the unoptimized code.
// If the code object is null, just return to the caller.
Label skip;
__ CmpSmiLiteral(r2, Smi::FromInt(0), r0);
__ bne(&skip);
......@@ -1775,6 +1782,12 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
__ bind(&skip);
// Drop any potential handler frame that is be sitting on top of the actual
// JavaScript frame. This is the case then OSR is triggered from bytecode.
if (has_handler_frame) {
__ LeaveFrame(StackFrame::STUB);
}
// Load deoptimization data from the code object.
// <deopt_data> = <code>[#deoptimization_data_offset]
__ LoadP(r3, FieldMemOperand(r2, Code::kDeoptimizationDataOffset));
......@@ -1796,6 +1809,14 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
Generate_OnStackReplacementHelper(masm, false);
}
void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
Generate_OnStackReplacementHelper(masm, true);
}
// static
void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
int field_index) {
......
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