Commit d8077227 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: Reland of [interpreter] Add explicit OSR polling bytecode. (patchset #1...

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

  port e1ad114e (r38056)

  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}

BUG=

Review-Url: https://codereview.chromium.org/2190903002
Cr-Commit-Position: refs/heads/master@{#38122}
parent a8118084
......@@ -2993,9 +2993,16 @@ void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
}
}
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
static void Generate_OnStackReplacementHelper(MacroAssembler* masm,
bool has_handler_frame) {
// Lookup the function in the JavaScript frame.
__ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
if (has_handler_frame) {
__ mov(eax, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(eax, Operand(eax, JavaScriptFrameConstants::kFunctionOffset));
} else {
__ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
}
{
FrameScope scope(masm, StackFrame::INTERNAL);
// Pass function as argument.
......@@ -3004,13 +3011,19 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
}
Label skip;
// If the code object is null, just return to the unoptimized code.
// If the code object is null, just return to the caller.
__ cmp(eax, Immediate(0));
__ j(not_equal, &skip, Label::kNear);
__ ret(0);
__ 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) {
__ leave();
}
// Load deoptimization data from the code object.
__ mov(ebx, Operand(eax, Code::kDeoptimizationDataOffset - kHeapObjectTag));
......@@ -3030,6 +3043,14 @@ void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
__ ret(0);
}
void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
Generate_OnStackReplacementHelper(masm, false);
}
void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
Generate_OnStackReplacementHelper(masm, true);
}
#undef __
} // namespace internal
} // namespace v8
......
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