Rewrite the AbortJS builtin to use CSA.

Bug: 
Change-Id: I785dd2fb839f8388e7389f4fe935cb983f6e81eb
Reviewed-on: https://chromium-review.googlesource.com/803435
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Stephan Herhut <herhut@google.com>
Cr-Commit-Position: refs/heads/master@{#50264}
This commit is contained in:
Stephan Herhut 2017-12-21 13:48:27 +01:00 committed by Commit Bot
parent b0db2dc6ae
commit c1aec1d708
19 changed files with 54 additions and 95 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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

View File

@ -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 -------------

View File

@ -229,7 +229,7 @@ namespace internal {
\
/* Abort */ \
ASM(Abort) \
ASM(AbortJS) \
TFC(AbortJS, AbortJS, 1) \
\
/* Built-in functions for Javascript */ \
/* Special internal builtins */ \

View File

@ -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

View File

@ -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

View File

@ -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 -------------

View File

@ -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 -------------

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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:

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -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) {