Commit 277838b1 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: Reland of [builtins] Introduce a builtin for Abort().

  port 66cb026f (r37929)

  original commit message:
  Original message:

  Calling Runtime::kAbort through a builtin instead of the c-entry stub
  will allow to generate the call in a background thread, because a
  builtin provides its own handle, whereas a code stub does not.

  @v8-mips-ports: Could you take a special look at the padding that is
  done in MacroAssembler::Abort()?

  Reason for revert:
  The reason for reverting is: Blocks roll:
  https://build.chromium.org/p/client.v8.ports/builders/V8%20Linux%20-%20arm64%20-%20sim%20-%20debug/builds/1622

  The problem was that on arm64 the builtin for Abort() contained a call to
  Abort(). The problem is fixed by using a NoUseRealAbortsScope in the
  code generation of Abort().

BUG=

Review-Url: https://codereview.chromium.org/2172093002
Cr-Commit-Position: refs/heads/master@{#37962}
parent b8870137
......@@ -2722,6 +2722,19 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAllocateInTargetSpace);
}
// static
void Builtins::Generate_Abort(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- edx : message_id as Smi
// -- esp[0] : return address
// -----------------------------------
__ PopReturnAddressTo(ecx);
__ Push(edx);
__ PushReturnAddressFrom(ecx);
__ Move(esi, Smi::FromInt(0));
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_StringToNumber(MacroAssembler* masm) {
// The StringToNumber stub takes one argument in eax.
......
......@@ -2810,15 +2810,19 @@ void MacroAssembler::Abort(BailoutReason reason) {
}
#endif
push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(reason))));
// Check if Abort() has already been initialized.
DCHECK(isolate()->builtins()->Abort()->IsHeapObject());
Move(edx, Smi::FromInt(static_cast<int>(reason)));
// Disable stub call restrictions to always allow calls to abort.
if (!has_frame_) {
// We don't actually want to generate a pile of code for this, so just
// claim there is a stack frame, without generating one.
FrameScope scope(this, StackFrame::NONE);
CallRuntime(Runtime::kAbort);
Call(isolate()->builtins()->Abort(), RelocInfo::CODE_TARGET);
} else {
CallRuntime(Runtime::kAbort);
Call(isolate()->builtins()->Abort(), RelocInfo::CODE_TARGET);
}
// will not return here
int3();
......
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