v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
push_registers_asm.cc
Go to the documentation of this file.
1
// Copyright 2021 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Push all callee-saved registers to get them on the stack for conservative
6
// stack scanning.
7
//
8
// See asm/x64/push_registers_clang.cc for why the function is not generated
9
// using clang.
10
//
11
// Do not depend on V8_TARGET_OS_* defines as some embedders may override the
12
// GN toolchain (e.g. ChromeOS) and not provide them.
13
asm
(
".text \n"
14
".global PushAllRegistersAndIterateStack \n"
15
".type PushAllRegistersAndIterateStack, %function \n"
16
".hidden PushAllRegistersAndIterateStack \n"
17
"PushAllRegistersAndIterateStack: \n"
18
// Push all callee-saved registers and save return address.
19
" addi.d $sp, $sp, -96 \n"
20
" st.d $s8, $sp, 88 \n"
21
" st.d $s7, $sp, 80 \n"
22
" st.d $s6, $sp, 72 \n"
23
" st.d $s5, $sp, 64 \n"
24
" st.d $s4, $sp, 56 \n"
25
" st.d $s3, $sp, 48 \n"
26
" st.d $s2, $sp, 40 \n"
27
" st.d $s1, $sp, 32 \n"
28
" st.d $s0, $sp, 24 \n"
29
" st.d $fp, $sp, 16 \n"
30
" st.d $sp, $sp, 8 \n"
31
" st.d $ra, $sp, 0 \n"
32
// Maintain frame pointer.
33
" addi.d $fp, $sp, 0 \n"
34
// Pass 1st parameter (a0) unchanged (Stack*).
35
// Pass 2nd parameter (a1) unchanged (StackVisitor*).
36
// Save 3rd parameter (a2; IterateStackCallback).
37
" addi.d $t7, $a2, 0 \n"
38
// Call the callback.
39
// Pass 3rd parameter as sp (stack pointer).
40
" addi.d $a2, $sp, 0 \n"
41
" jirl $ra, $t7, 0 \n"
42
// Load return address.
43
" ld.d $ra, $sp, 0 \n"
44
// Restore frame pointer.
45
" ld.d $fp, $sp, 16 \n"
46
// Discard all callee-saved registers.
47
" addi.d $sp, $sp, 96 \n"
48
" jirl $zero, $ra, 0 \n"
49
".Lfunc_end0: \n"
50
".size PushAllRegistersAndIterateStack, "
51
".Lfunc_end0-PushAllRegistersAndIterateStack \n"
);
src
heap
base
asm
loong64
push_registers_asm.cc
Generated on Sun Apr 6 2025 21:08:54 for v8 by
1.12.0