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