Skip to content
forked from v8/v8

Commit

Permalink
Merged: [loong64][mips64] Use t9 or t7 as the jump target
Browse files Browse the repository at this point in the history
We usually use t9 as the jump target register in mips64 (t7 in
loong64), and change PushAllRegistersAndIterateStack to be so.

Besides, fix an error in loong64, the frame pointer is fp instead
of s8.

(cherry picked from commit ff2e308)

Bug: v8:14138
Change-Id: I4b2618adc0ed78da9a8a9580f15d68ef2940eb11
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4629799
Auto-Submit: Liu Yu <[email protected]>
Reviewed-by: Lutz Vahl <[email protected]>
Commit-Queue: Lutz Vahl <[email protected]>
Cr-Commit-Position: refs/branch-heads/11.6@{v8#14}
Cr-Branched-From: e29c028-refs/heads/11.6.189@{v8#3}
Cr-Branched-From: 95cbef2-refs/heads/main@{#88340}
  • Loading branch information
LiuYu396 authored and V8 LUCI CQ committed Jul 11, 2023
1 parent c19eeb1 commit e34f6fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
34 changes: 17 additions & 17 deletions src/heap/base/asm/loong64/push_registers_asm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ asm(".text \n"
"PushAllRegistersAndIterateStack: \n"
// Push all callee-saved registers and save return address.
" addi.d $sp, $sp, -96 \n"
" st.d $ra, $sp, 88 \n"
" st.d $s8, $sp, 80 \n"
" st.d $sp, $sp, 72 \n"
" st.d $fp, $sp, 64 \n"
" st.d $s7, $sp, 56 \n"
" st.d $s6, $sp, 48 \n"
" st.d $s5, $sp, 40 \n"
" st.d $s4, $sp, 32 \n"
" st.d $s3, $sp, 24 \n"
" st.d $s2, $sp, 16 \n"
" st.d $s1, $sp, 8 \n"
" st.d $s0, $sp, 0 \n"
" st.d $s8, $sp, 88 \n"
" st.d $s7, $sp, 80 \n"
" st.d $s6, $sp, 72 \n"
" st.d $s5, $sp, 64 \n"
" st.d $s4, $sp, 56 \n"
" st.d $s3, $sp, 48 \n"
" st.d $s2, $sp, 40 \n"
" st.d $s1, $sp, 32 \n"
" st.d $s0, $sp, 24 \n"
" st.d $fp, $sp, 16 \n"
" st.d $sp, $sp, 8 \n"
" st.d $ra, $sp, 0 \n"
// Maintain frame pointer.
" addi.d $s8, $sp, 0 \n"
" addi.d $fp, $sp, 0 \n"
// Pass 1st parameter (a0) unchanged (Stack*).
// Pass 2nd parameter (a1) unchanged (StackVisitor*).
// Save 3rd parameter (a2; IterateStackCallback).
" addi.d $a3, $a2, 0 \n"
" addi.d $t7, $a2, 0 \n"
// Call the callback.
// Pass 3rd parameter as sp (stack pointer).
" addi.d $a2, $sp, 0 \n"
" jirl $ra, $a3, 0 \n"
" jirl $ra, $t7, 0 \n"
// Load return address.
" ld.d $ra, $sp, 88 \n"
" ld.d $ra, $sp, 0 \n"
// Restore frame pointer.
" ld.d $s8, $sp, 80 \n"
" ld.d $fp, $sp, 16 \n"
// Discard all callee-saved registers.
" addi.d $sp, $sp, 96 \n"
" jirl $zero, $ra, 0 \n");
4 changes: 2 additions & 2 deletions src/heap/base/asm/mips64/push_registers_asm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ asm(".text \n"
// Pass 1st parameter (a0) unchanged (Stack*).
// Pass 2nd parameter (a1) unchanged (StackVisitor*).
// Save 3rd parameter (a2; IterateStackCallback).
" move $a3, $a2 \n"
" move $t9, $a2 \n"
// Call the callback.
" jalr $a3 \n"
" jalr $t9 \n"
// Delay slot: Pass 3rd parameter as sp (stack pointer).
" move $a2, $sp \n"
// Load return address.
Expand Down

0 comments on commit e34f6fa

Please sign in to comment.