Commit 5c6fd450 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[cleanup] Remove ExitFrameType enum on the Builtins class

This CL also removes the AdaptorWithExitFrame builtin and simplifies
respective use-sites.

Bug: v8:9183
Change-Id: I97c4e35aa551f586faedcb09cc0b2b837e5307f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1624215Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61742}
parent 7b10b36f
...@@ -29,8 +29,7 @@ namespace internal { ...@@ -29,8 +29,7 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
#if defined(__thumb__) #if defined(__thumb__)
// Thumb mode builtin. // Thumb mode builtin.
DCHECK_EQ(1, reinterpret_cast<uintptr_t>( DCHECK_EQ(1, reinterpret_cast<uintptr_t>(
...@@ -38,14 +37,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, ...@@ -38,14 +37,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address,
1); 1);
#endif #endif
__ Move(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ Move(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) { void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
......
...@@ -29,17 +29,10 @@ namespace internal { ...@@ -29,17 +29,10 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ Mov(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ Mov(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) { void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
......
...@@ -36,8 +36,7 @@ namespace internal { ...@@ -36,8 +36,7 @@ namespace internal {
TFC(RecordWrite, RecordWrite) \ TFC(RecordWrite, RecordWrite) \
TFC(EphemeronKeyBarrier, EphemeronKeyBarrier) \ TFC(EphemeronKeyBarrier, EphemeronKeyBarrier) \
\ \
/* Adaptors for CPP/API builtin */ \ /* Adaptor for CPP builtin */ \
TFC(AdaptorWithExitFrame, CppBuiltinAdaptor) \
TFC(AdaptorWithBuiltinExitFrame, CppBuiltinAdaptor) \ TFC(AdaptorWithBuiltinExitFrame, CppBuiltinAdaptor) \
\ \
/* Calls */ \ /* Calls */ \
......
...@@ -767,19 +767,7 @@ TF_BUILTIN(SameValueNumbersOnly, CodeStubAssembler) { ...@@ -767,19 +767,7 @@ TF_BUILTIN(SameValueNumbersOnly, CodeStubAssembler) {
Return(FalseConstant()); Return(FalseConstant());
} }
class InternalBuiltinsAssembler : public CodeStubAssembler { TF_BUILTIN(AdaptorWithBuiltinExitFrame, CodeStubAssembler) {
public:
explicit InternalBuiltinsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
template <typename Descriptor>
void GenerateAdaptorWithExitFrameType(
Builtins::ExitFrameType exit_frame_type);
};
template <typename Descriptor>
void InternalBuiltinsAssembler::GenerateAdaptorWithExitFrameType(
Builtins::ExitFrameType exit_frame_type) {
TNode<JSFunction> target = CAST(Parameter(Descriptor::kTarget)); TNode<JSFunction> target = CAST(Parameter(Descriptor::kTarget));
TNode<Object> new_target = CAST(Parameter(Descriptor::kNewTarget)); TNode<Object> new_target = CAST(Parameter(Descriptor::kNewTarget));
TNode<WordT> c_function = TNode<WordT> c_function =
...@@ -803,9 +791,9 @@ void InternalBuiltinsAssembler::GenerateAdaptorWithExitFrameType( ...@@ -803,9 +791,9 @@ void InternalBuiltinsAssembler::GenerateAdaptorWithExitFrameType(
argc, argc,
Int32Constant(BuiltinExitFrameConstants::kNumExtraArgsWithReceiver)); Int32Constant(BuiltinExitFrameConstants::kNumExtraArgsWithReceiver));
TNode<Code> code = HeapConstant( const bool builtin_exit_frame = true;
CodeFactory::CEntry(isolate(), 1, kDontSaveFPRegs, kArgvOnStack, TNode<Code> code = HeapConstant(CodeFactory::CEntry(
exit_frame_type == Builtins::BUILTIN_EXIT)); isolate(), 1, kDontSaveFPRegs, kArgvOnStack, builtin_exit_frame));
// Unconditionally push argc, target and new target as extra stack arguments. // Unconditionally push argc, target and new target as extra stack arguments.
// They will be used by stack frame iterators when constructing stack trace. // They will be used by stack frame iterators when constructing stack trace.
...@@ -818,14 +806,6 @@ void InternalBuiltinsAssembler::GenerateAdaptorWithExitFrameType( ...@@ -818,14 +806,6 @@ void InternalBuiltinsAssembler::GenerateAdaptorWithExitFrameType(
new_target); // additional stack argument 4 new_target); // additional stack argument 4
} }
TF_BUILTIN(AdaptorWithExitFrame, InternalBuiltinsAssembler) {
GenerateAdaptorWithExitFrameType<Descriptor>(Builtins::EXIT);
}
TF_BUILTIN(AdaptorWithBuiltinExitFrame, InternalBuiltinsAssembler) {
GenerateAdaptorWithExitFrameType<Descriptor>(Builtins::BUILTIN_EXIT);
}
TF_BUILTIN(AllocateInYoungGeneration, CodeStubAssembler) { TF_BUILTIN(AllocateInYoungGeneration, CodeStubAssembler) {
TNode<IntPtrT> requested_size = TNode<IntPtrT> requested_size =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kRequestedSize)); UncheckedCast<IntPtrT>(Parameter(Descriptor::kRequestedSize));
......
...@@ -155,10 +155,7 @@ class Builtins { ...@@ -155,10 +155,7 @@ class Builtins {
Handle<Object> receiver, int argc, Handle<Object> args[], Handle<Object> receiver, int argc, Handle<Object> args[],
Handle<HeapObject> new_target); Handle<HeapObject> new_target);
enum ExitFrameType { EXIT, BUILTIN_EXIT }; static void Generate_Adaptor(MacroAssembler* masm, Address builtin_address);
static void Generate_Adaptor(MacroAssembler* masm, Address builtin_address,
ExitFrameType exit_frame_type);
static void Generate_CEntry(MacroAssembler* masm, int result_size, static void Generate_CEntry(MacroAssembler* masm, int result_size,
SaveFPRegsMode save_doubles, ArgvMode argv_mode, SaveFPRegsMode save_doubles, ArgvMode argv_mode,
......
...@@ -30,18 +30,11 @@ namespace internal { ...@@ -30,18 +30,11 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ Move(kJavaScriptCallExtraArg1Register, __ Move(kJavaScriptCallExtraArg1Register,
Immediate(ExternalReference::Create(address))); Immediate(ExternalReference::Create(address)));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
static void GenerateTailCallToReturnedCode(MacroAssembler* masm, static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
......
...@@ -30,17 +30,10 @@ namespace internal { ...@@ -30,17 +30,10 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ li(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ li(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) { void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
......
...@@ -30,17 +30,10 @@ namespace internal { ...@@ -30,17 +30,10 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ li(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ li(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) { void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
......
...@@ -28,17 +28,10 @@ namespace internal { ...@@ -28,17 +28,10 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ Move(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ Move(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) { void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
......
...@@ -28,17 +28,10 @@ namespace internal { ...@@ -28,17 +28,10 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ Move(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ Move(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) { void Builtins::Generate_InternalArrayConstructor(MacroAssembler* masm) {
......
...@@ -133,8 +133,7 @@ Code BuildWithMacroAssembler(Isolate* isolate, int32_t builtin_index, ...@@ -133,8 +133,7 @@ Code BuildWithMacroAssembler(Isolate* isolate, int32_t builtin_index,
} }
Code BuildAdaptor(Isolate* isolate, int32_t builtin_index, Code BuildAdaptor(Isolate* isolate, int32_t builtin_index,
Address builtin_address, Address builtin_address, const char* name) {
Builtins::ExitFrameType exit_frame_type, const char* name) {
HandleScope scope(isolate); HandleScope scope(isolate);
// Canonicalize handles, so that we can share constant pool entries pointing // Canonicalize handles, so that we can share constant pool entries pointing
// to code targets without dereferencing their handles. // to code targets without dereferencing their handles.
...@@ -146,7 +145,7 @@ Code BuildAdaptor(Isolate* isolate, int32_t builtin_index, ...@@ -146,7 +145,7 @@ Code BuildAdaptor(Isolate* isolate, int32_t builtin_index,
ExternalAssemblerBuffer(buffer, kBufferSize)); ExternalAssemblerBuffer(buffer, kBufferSize));
masm.set_builtin_index(builtin_index); masm.set_builtin_index(builtin_index);
DCHECK(!masm.has_frame()); DCHECK(!masm.has_frame());
Builtins::Generate_Adaptor(&masm, builtin_address, exit_frame_type); Builtins::Generate_Adaptor(&masm, builtin_address);
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::BUILTIN) Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::BUILTIN)
...@@ -310,8 +309,7 @@ void SetupIsolateDelegate::SetupBuiltinsInternal(Isolate* isolate) { ...@@ -310,8 +309,7 @@ void SetupIsolateDelegate::SetupBuiltinsInternal(Isolate* isolate) {
int index = 0; int index = 0;
Code code; Code code;
#define BUILD_CPP(Name) \ #define BUILD_CPP(Name) \
code = BuildAdaptor(isolate, index, FUNCTION_ADDR(Builtin_##Name), \ code = BuildAdaptor(isolate, index, FUNCTION_ADDR(Builtin_##Name), #Name); \
Builtins::BUILTIN_EXIT, #Name); \
AddBuiltin(builtins, index++, code); AddBuiltin(builtins, index++, code);
#define BUILD_TFJ(Name, Argc, ...) \ #define BUILD_TFJ(Name, Argc, ...) \
code = BuildWithCodeStubAssemblerJS( \ code = BuildWithCodeStubAssemblerJS( \
......
...@@ -30,18 +30,11 @@ namespace internal { ...@@ -30,18 +30,11 @@ namespace internal {
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address, void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
ExitFrameType exit_frame_type) {
__ LoadAddress(kJavaScriptCallExtraArg1Register, __ LoadAddress(kJavaScriptCallExtraArg1Register,
ExternalReference::Create(address)); ExternalReference::Create(address));
if (exit_frame_type == BUILTIN_EXIT) {
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} else {
DCHECK(exit_frame_type == EXIT);
__ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithExitFrame),
RelocInfo::CODE_TARGET);
}
} }
static void GenerateTailCallToReturnedCode(MacroAssembler* masm, static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
......
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