PPC/s390: [builtins] New frame type for exits to C++ builtins
Port 5febc27b5d
Original commit message:
Prior to this commit, calls to C++ builtins created standard exit
frames, which are skipped when constructing JS stack traces. In order to
show these calls on traces, we introduce a new builtin exit frame type.
Builtin exit frames contain target and new.target on the stack and are
not skipped during stack trace construction.
R=jgruber@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com
BUG=v8:4815
LOG=N
Review-Url: https://codereview.chromium.org/2105023008
Cr-Commit-Position: refs/heads/master@{#37461}
This commit is contained in:
parent
4fa104c5f9
commit
3ee6b808a4
@ -17,7 +17,8 @@ namespace internal {
|
||||
#define __ ACCESS_MASM(masm)
|
||||
|
||||
|
||||
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
|
||||
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
|
||||
ExitFrameType exit_frame_type) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r3 : number of arguments excluding receiver
|
||||
// -- r4 : target
|
||||
@ -43,7 +44,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
|
||||
// including the receiver and the extra arguments.
|
||||
__ addi(r3, r3, Operand(num_extra_args + 1));
|
||||
|
||||
__ JumpToExternalReference(ExternalReference(id, masm->isolate()));
|
||||
__ JumpToExternalReference(ExternalReference(id, masm->isolate()),
|
||||
exit_frame_type == BUILTIN_EXIT);
|
||||
}
|
||||
|
||||
|
||||
|
@ -928,7 +928,9 @@ void CEntryStub::Generate(MacroAssembler* masm) {
|
||||
arg_stack_space += result_size();
|
||||
}
|
||||
|
||||
__ EnterExitFrame(save_doubles(), arg_stack_space);
|
||||
__ EnterExitFrame(save_doubles(), arg_stack_space, is_builtin_exit()
|
||||
? StackFrame::BUILTIN_EXIT
|
||||
: StackFrame::EXIT);
|
||||
|
||||
// Store a copy of argc in callee-saved registers for later.
|
||||
__ mr(r14, r3);
|
||||
|
@ -1089,7 +1089,10 @@ int MacroAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) {
|
||||
// in the fp register (r31)
|
||||
// Then - we buy a new frame
|
||||
|
||||
void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
||||
void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
|
||||
StackFrame::Type frame_type) {
|
||||
DCHECK(frame_type == StackFrame::EXIT ||
|
||||
frame_type == StackFrame::BUILTIN_EXIT);
|
||||
// Set up the frame structure on the stack.
|
||||
DCHECK_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement);
|
||||
DCHECK_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset);
|
||||
@ -1100,7 +1103,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
||||
// all of the pushes that have happened inside of V8
|
||||
// since we were called from C code
|
||||
|
||||
LoadSmiLiteral(ip, Smi::FromInt(StackFrame::EXIT));
|
||||
LoadSmiLiteral(ip, Smi::FromInt(frame_type));
|
||||
PushCommonFrame(ip);
|
||||
// Reserve room for saved entry sp and code object.
|
||||
subi(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp));
|
||||
@ -2754,9 +2757,11 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) {
|
||||
void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
|
||||
bool builtin_exit_frame) {
|
||||
mov(r4, Operand(builtin));
|
||||
CEntryStub stub(isolate(), 1);
|
||||
CEntryStub stub(isolate(), 1, kDontSaveFPRegs, kArgvOnStack,
|
||||
builtin_exit_frame);
|
||||
Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,8 @@ class MacroAssembler : public Assembler {
|
||||
// Enter exit frame.
|
||||
// stack_space - extra stack space, used for parameters before call to C.
|
||||
// At least one slot (for the return address) should be provided.
|
||||
void EnterExitFrame(bool save_doubles, int stack_space = 1);
|
||||
void EnterExitFrame(bool save_doubles, int stack_space = 1,
|
||||
StackFrame::Type frame_type = StackFrame::EXIT);
|
||||
|
||||
// Leave the current exit frame. Expects the return value in r0.
|
||||
// Expect the number of values, pushed prior to the exit frame, to
|
||||
@ -1072,7 +1073,8 @@ class MacroAssembler : public Assembler {
|
||||
void MovFromFloatResult(DoubleRegister dst);
|
||||
|
||||
// Jump to a runtime routine.
|
||||
void JumpToExternalReference(const ExternalReference& builtin);
|
||||
void JumpToExternalReference(const ExternalReference& builtin,
|
||||
bool builtin_exit_frame = false);
|
||||
|
||||
Handle<Object> CodeObject() {
|
||||
DCHECK(!code_object_.is_null());
|
||||
|
@ -15,7 +15,8 @@ namespace internal {
|
||||
|
||||
#define __ ACCESS_MASM(masm)
|
||||
|
||||
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
|
||||
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
|
||||
ExitFrameType exit_frame_type) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- r2 : number of arguments excluding receiver
|
||||
// -- r3 : target
|
||||
@ -40,7 +41,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
|
||||
// including the receiver and the extra arguments.
|
||||
__ AddP(r2, r2, Operand(num_extra_args + 1));
|
||||
|
||||
__ JumpToExternalReference(ExternalReference(id, masm->isolate()));
|
||||
__ JumpToExternalReference(ExternalReference(id, masm->isolate()),
|
||||
exit_frame_type == BUILTIN_EXIT);
|
||||
}
|
||||
|
||||
// Load the built-in InternalArray function from the current context.
|
||||
|
@ -897,7 +897,9 @@ void CEntryStub::Generate(MacroAssembler* masm) {
|
||||
arg_stack_space += 2;
|
||||
#endif
|
||||
|
||||
__ EnterExitFrame(save_doubles(), arg_stack_space);
|
||||
__ EnterExitFrame(save_doubles(), arg_stack_space, is_builtin_exit()
|
||||
? StackFrame::BUILTIN_EXIT
|
||||
: StackFrame::EXIT);
|
||||
|
||||
// Store a copy of argc, argv in callee-saved registers for later.
|
||||
__ LoadRR(r6, r2);
|
||||
|
@ -1024,7 +1024,10 @@ int MacroAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) {
|
||||
// gaps
|
||||
// Args
|
||||
// ABIRes <- newSP
|
||||
void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
||||
void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
|
||||
StackFrame::Type frame_type) {
|
||||
DCHECK(frame_type == StackFrame::EXIT ||
|
||||
frame_type == StackFrame::BUILTIN_EXIT);
|
||||
// Set up the frame structure on the stack.
|
||||
DCHECK_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement);
|
||||
DCHECK_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset);
|
||||
@ -1035,7 +1038,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
|
||||
// all of the pushes that have happened inside of V8
|
||||
// since we were called from C code
|
||||
CleanseP(r14);
|
||||
LoadSmiLiteral(r1, Smi::FromInt(StackFrame::EXIT));
|
||||
LoadSmiLiteral(r1, Smi::FromInt(frame_type));
|
||||
PushCommonFrame(r1);
|
||||
// Reserve room for saved entry sp and code object.
|
||||
lay(sp, MemOperand(fp, -ExitFrameConstants::kFixedFrameSizeFromFp));
|
||||
@ -2614,9 +2617,11 @@ void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
|
||||
JumpToExternalReference(ExternalReference(fid, isolate()));
|
||||
}
|
||||
|
||||
void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) {
|
||||
void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin,
|
||||
bool builtin_exit_frame) {
|
||||
mov(r3, Operand(builtin));
|
||||
CEntryStub stub(isolate(), 1);
|
||||
CEntryStub stub(isolate(), 1, kDontSaveFPRegs, kArgvOnStack,
|
||||
builtin_exit_frame);
|
||||
Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
|
||||
}
|
||||
|
||||
|
@ -734,7 +734,8 @@ class MacroAssembler : public Assembler {
|
||||
// Enter exit frame.
|
||||
// stack_space - extra stack space, used for parameters before call to C.
|
||||
// At least one slot (for the return address) should be provided.
|
||||
void EnterExitFrame(bool save_doubles, int stack_space = 1);
|
||||
void EnterExitFrame(bool save_doubles, int stack_space = 1,
|
||||
StackFrame::Type frame_type = StackFrame::EXIT);
|
||||
|
||||
// Leave the current exit frame. Expects the return value in r0.
|
||||
// Expect the number of values, pushed prior to the exit frame, to
|
||||
@ -1337,7 +1338,8 @@ class MacroAssembler : public Assembler {
|
||||
void MovFromFloatResult(DoubleRegister dst);
|
||||
|
||||
// Jump to a runtime routine.
|
||||
void JumpToExternalReference(const ExternalReference& builtin);
|
||||
void JumpToExternalReference(const ExternalReference& builtin,
|
||||
bool builtin_exit_frame = false);
|
||||
|
||||
Handle<Object> CodeObject() {
|
||||
DCHECK(!code_object_.is_null());
|
||||
|
Loading…
Reference in New Issue
Block a user