Can `BaselineIC: Call scripted func` tail call?
Categories
(Core :: JavaScript Engine: JIT, enhancement, P5)
Tracking
()
People
(Reporter: jrmuizel, Unassigned)
References
(Blocks 1 open bug)
Details
Currently we're seeing much deeper stacks when profiling SM vs V8. This causes considerable overhead when profiling with perf at high sample rates (100kHZ)
Here's the IC:
add dword [rdi + 0x8], 0x1
mov rax, qword [rsp + rcx * 8 + 0x10]
mov r11, rax
shr r11, 0x2f
cmp r11d, 0x1fffc
jnz $+0x6e
mov r11, -0x2000000000000
xor rax, r11
cmp qword [rdi + 0x20], rax
jnz $+0x57
mov rdx, rcx
push qword [rsp]
mov qword [rsp + 0x8], 0x1
push rbp
mov rbp, rsp
push rdi
and rsp, -0x10
push qword [rbp + 0x18]
push qword [rbp + 0x20]
mov rbx, qword [rax + 0x28]
mov rbx, qword [rbx]
push rax
mov rcx, rdx
shl ecx, 0x5
or ecx, 0x2
push rcx
mov eax, dword [rax + 0x18]
shr eax, 0x10
cmp edx, eax
jnb $+0xa
mov rbx, 0x30f0dee2d250
call rbx
mov rdi, qword [rbp - 0x8]
mov rsp, rbp
pop rbp
pop qword [rsp]
ret
int 0x3
mov rdi, qword [rdi + 0x10]
jmp qword [rdi]
ud2
It seems like it should be possible for us to tail call and thus avoiding having these IC's bloating our profiling stacks
Comment 1•3 years ago
•
|
||
This is non-trivial.
Call ICs are responsible for grabbing the arguments and putting them on the stack in the order/location expected by the callee. This requires us to allocate stack space to hold the arguments. Also, a bunch of our code for walking / tearing down / building up the stack expects stub frames there, so we'd have to go rewrite a bunch of iterators / bailout code / etc.
I'm not sure it's possible to do this without a major overhaul of our internal call ABI.
Edit to add: I don't think we're likely to do this just to make profiling easier. We might consider it if there was compelling evidence that it was causing significant performance overhead, and we could come up with a better design.
Updated•3 years ago
|
Updated•3 years ago
|
Description
•