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 2024 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
14#include "src/heap/base/stack.h"
15
16namespace heap {
17namespace base {
18using IterateStackCallback = void (*)(const Stack*, StackVisitor*, intptr_t*);
19extern "C" void PushAllRegistersAndIterateStack(const Stack* sp,
20 StackVisitor* sv,
22 __asm volatile(
23 " lg 1,%0 \n" // Set up first parameter (sp)
24 " lg 2,%1 \n" // Set up second parameter (sv)
25 " lg 7,%2 \n" // Get callback function descriptor into r7
26 " lgr 3,4 \n" // Set up third parameter (r4 - stack pointer)
27 " lg 6,8(,7) \n" // Get code address into r6
28 " lg 5,0(,7) \n" // Get environment into r5
29 " basr 7,6 \n" // Branch to r6 (callback)
30 " nopr 0 \n"
31 :
32 : "m"(sp), "m"(sv), "m"(callback)
33 : "r0", "r1", "r2", "r3", "r5", "r6", "r7", "r9", "r10", "r11", "r12",
34 "r13", "r14", "r15");
35}
36} // namespace base
37} // namespace heap
TNode< Object > callback
void(*)(const Stack *, StackVisitor *, intptr_t *) IterateStackCallback
void PushAllRegistersAndIterateStack(const Stack *sp, StackVisitor *sv, IterateStackCallback callback)