Commit c1aec1d7 authored by Stephan Herhut's avatar Stephan Herhut Committed by Commit Bot

Rewrite the AbortJS builtin to use CSA.

Bug: 
Change-Id: I785dd2fb839f8388e7389f4fe935cb983f6e81eb
Reviewed-on: https://chromium-review.googlesource.com/803435Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
Commit-Queue: Stephan Herhut <herhut@google.com>
Cr-Commit-Position: refs/heads/master@{#50264}
parent b0db2dc6
......@@ -202,6 +202,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
......@@ -207,6 +207,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
......@@ -2342,17 +2342,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r1 : message as String object
// -- lr : return address
// -----------------------------------
__ Push(r1);
__ Move(cp, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r0 : actual number of arguments
......
......@@ -2761,19 +2761,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
ASM_LOCATION("Builtins::Generate_AbortJS");
// ----------- S t a t e -------------
// -- x1 : message as String object
// -- lr : return address
// -----------------------------------
MacroAssembler::NoUseRealAbortsScope no_use_real_aborts(masm);
__ PushArgument(x1);
__ Move(cp, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
ASM_LOCATION("Builtins::Generate_ArgumentsAdaptorTrampoline");
// ----------- S t a t e -------------
......
......@@ -229,7 +229,7 @@ namespace internal {
\
/* Abort */ \
ASM(Abort) \
ASM(AbortJS) \
TFC(AbortJS, AbortJS, 1) \
\
/* Built-in functions for Javascript */ \
/* Special internal builtins */ \
......
......@@ -982,5 +982,11 @@ TF_BUILTIN(PromiseResolveThenableJob, InternalBuiltinsAssembler) {
Return(UndefinedConstant());
}
TF_BUILTIN(AbortJS, CodeStubAssembler) {
Node* message = Parameter(Descriptor::kObject);
Node* reason = SmiConstant(0);
TailCallRuntime(Runtime::kAbort, reason, message);
}
} // namespace internal
} // namespace v8
......@@ -2474,19 +2474,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- edx : message as String object
// -- esp[0] : return address
// -----------------------------------
__ PopReturnAddressTo(ecx);
__ Push(edx);
__ PushReturnAddressFrom(ecx);
__ Move(esi, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : actual number of arguments
......
......@@ -2398,17 +2398,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : message as String object
// -- ra : return address
// -----------------------------------
__ Push(a0);
__ Move(cp, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// State setup as expected by MacroAssembler::InvokePrologue.
// ----------- S t a t e -------------
......
......@@ -2417,17 +2417,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : message as String object
// -- ra : return address
// -----------------------------------
__ Push(a0);
__ Move(cp, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// State setup as expected by MacroAssembler::InvokePrologue.
// ----------- S t a t e -------------
......
......@@ -2425,17 +2425,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r4 : message as String object
// -- lr : return address
// -----------------------------------
__ push(r4);
__ LoadSmiLiteral(cp, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : actual number of arguments
......
......@@ -2426,17 +2426,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : message as String object
// -- lr : return address
// -----------------------------------
__ push(r3);
__ LoadSmiLiteral(cp, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : actual number of arguments
......
......@@ -1932,19 +1932,6 @@ void Builtins::Generate_Abort(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAbort);
}
// static
void Builtins::Generate_AbortJS(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rdx : message as String object
// -- rsp[0] : return address
// -----------------------------------
__ PopReturnAddressTo(rcx);
__ Push(rdx);
__ PushReturnAddressFrom(rcx);
__ Move(rsi, Smi::kZero);
__ TailCallRuntime(Runtime::kAbortJS);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rax : actual number of arguments
......
......@@ -202,6 +202,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {edx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
......@@ -51,6 +51,7 @@ class PlatformInterfaceDescriptor;
V(ConstructWithArrayLike) \
V(ConstructTrampoline) \
V(TransitionElementsKind) \
V(AbortJS) \
V(AllocateHeapNumber) \
V(Builtin) \
V(ArrayConstructor) \
......@@ -681,6 +682,11 @@ class TransitionElementsKindDescriptor : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(TransitionElementsKindDescriptor, CallInterfaceDescriptor)
};
class AbortJSDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kObject)
DECLARE_DESCRIPTOR(AbortJSDescriptor, CallInterfaceDescriptor)
};
class AllocateHeapNumberDescriptor : public CallInterfaceDescriptor {
public:
......
......@@ -200,6 +200,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
......@@ -200,6 +200,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
......@@ -200,6 +200,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
......@@ -196,6 +196,12 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr, nullptr);
......
......@@ -203,6 +203,11 @@ void TransitionElementsKindDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AbortJSDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rdx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
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