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

PPC/s390: [builtins] Introduce a builtin for Abort().

Port 9be015a2

Original commit 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.

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

BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2166553002
Cr-Commit-Position: refs/heads/master@{#37877}
parent 6a65cff4
...@@ -2799,6 +2799,17 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { ...@@ -2799,6 +2799,17 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAllocateInTargetSpace); __ TailCallRuntime(Runtime::kAllocateInTargetSpace);
} }
// static
void Builtins::Generate_Abort(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r4 : message_id as Smi
// -- lr : return address
// -----------------------------------
__ push(r4);
__ LoadSmiLiteral(cp, Smi::FromInt(0));
__ TailCallRuntime(Runtime::kAbort);
}
// static // static
void Builtins::Generate_StringToNumber(MacroAssembler* masm) { void Builtins::Generate_StringToNumber(MacroAssembler* masm) {
// The StringToNumber stub takes one argument in r3. // The StringToNumber stub takes one argument in r3.
......
...@@ -2815,6 +2815,17 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { ...@@ -2815,6 +2815,17 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAllocateInTargetSpace); __ TailCallRuntime(Runtime::kAllocateInTargetSpace);
} }
// static
void Builtins::Generate_Abort(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : message_id as Smi
// -- lr : return address
// -----------------------------------
__ push(r3);
__ LoadSmiLiteral(cp, Smi::FromInt(0));
__ TailCallRuntime(Runtime::kAbort);
}
// static // static
void Builtins::Generate_StringToNumber(MacroAssembler* masm) { void Builtins::Generate_StringToNumber(MacroAssembler* masm) {
// The StringToNumber stub takes one argument in r2. // The StringToNumber stub takes one argument in r2.
......
...@@ -2896,16 +2896,19 @@ void MacroAssembler::Abort(BailoutReason reason) { ...@@ -2896,16 +2896,19 @@ void MacroAssembler::Abort(BailoutReason reason) {
} }
#endif #endif
LoadSmiLiteral(r0, Smi::FromInt(reason)); // Check if Abort() has already been initialized.
push(r0); DCHECK(isolate()->builtins()->Abort()->IsHeapObject());
LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(reason)));
// Disable stub call restrictions to always allow calls to abort. // Disable stub call restrictions to always allow calls to abort.
if (!has_frame_) { if (!has_frame_) {
// We don't actually want to generate a pile of code for this, so just // We don't actually want to generate a pile of code for this, so just
// claim there is a stack frame, without generating one. // claim there is a stack frame, without generating one.
FrameScope scope(this, StackFrame::NONE); FrameScope scope(this, StackFrame::NONE);
CallRuntime(Runtime::kAbort); Call(isolate()->builtins()->Abort(), RelocInfo::CODE_TARGET);
} else { } else {
CallRuntime(Runtime::kAbort); Call(isolate()->builtins()->Abort(), RelocInfo::CODE_TARGET);
} }
// will not return here // will not return here
} }
......
...@@ -2727,16 +2727,19 @@ void MacroAssembler::Abort(BailoutReason reason) { ...@@ -2727,16 +2727,19 @@ void MacroAssembler::Abort(BailoutReason reason) {
} }
#endif #endif
LoadSmiLiteral(r0, Smi::FromInt(reason)); // Check if Abort() has already been initialized.
push(r0); DCHECK(isolate()->builtins()->Abort()->IsHeapObject());
LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(reason)));
// Disable stub call restrictions to always allow calls to abort. // Disable stub call restrictions to always allow calls to abort.
if (!has_frame_) { if (!has_frame_) {
// We don't actually want to generate a pile of code for this, so just // We don't actually want to generate a pile of code for this, so just
// claim there is a stack frame, without generating one. // claim there is a stack frame, without generating one.
FrameScope scope(this, StackFrame::NONE); FrameScope scope(this, StackFrame::NONE);
CallRuntime(Runtime::kAbort); Call(isolate()->builtins()->Abort(), RelocInfo::CODE_TARGET);
} else { } else {
CallRuntime(Runtime::kAbort); Call(isolate()->builtins()->Abort(), RelocInfo::CODE_TARGET);
} }
// will not return here // will not return here
} }
......
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