Commit c05fa9da authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips] cppgc: Conservative stack scanning

Port 1a7f5689
https://crrev.com/c/2129635

Change-Id: Iee46bdb05f1c412dcdb7299a8b74f9c8ce2e7d4d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2143985
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67162}
parent dbbaccca
......@@ -358,7 +358,8 @@ config("cppgc_base_config") {
if (is_clang || !is_win) {
if (target_cpu == "x64" || target_cpu == "x86" || target_cpu == "arm" ||
target_cpu == "arm64" || target_cpu == "ppc64" ||
target_cpu == "s390x") {
target_cpu == "s390x" || target_cpu == "mipsel" ||
target_cpu == "mips64el") {
defines += [ "CPPGC_SUPPORTS_CONSERVATIVE_STACK_SCAN" ]
}
} else if (is_win) {
......@@ -4020,6 +4021,10 @@ v8_source_set("cppgc_base") {
sources += [ "src/heap/cppgc/asm/ppc/push_registers_asm.cc" ]
} else if (target_cpu == "s390x") {
sources += [ "src/heap/cppgc/asm/s390/push_registers_asm.cc" ]
} else if (target_cpu == "mipsel") {
sources += [ "src/heap/cppgc/asm/mips/push_registers_asm.cc" ]
} else if (target_cpu == "mips64el") {
sources += [ "src/heap/cppgc/asm/mips64/push_registers_asm.cc" ]
}
} else if (is_win) {
if (target_cpu == "x64") {
......
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Push all callee-saved registers to get them on the stack for conservative
// stack scanning.
//
// See asm/x64/push_registers_clang.cc for why the function is not generated
// using clang.
//
// Do not depend on V8_TARGET_OS_* defines as some embedders may override the
// GN toolchain (e.g. ChromeOS) and not provide them.
asm(".set noreorder \n"
".global PushAllRegistersAndIterateStack \n"
".hidden PushAllRegistersAndIterateStack \n"
"PushAllRegistersAndIterateStack: \n"
// Push all callee-saved registers and save return address.
" addiu $sp, $sp, -48 \n"
" sw $ra, 44($sp) \n"
" sw $s8, 40($sp) \n"
" sw $sp, 36($sp) \n"
" sw $gp, 32($sp) \n"
" sw $s7, 28($sp) \n"
" sw $s6, 24($sp) \n"
" sw $s5, 20($sp) \n"
" sw $s4, 16($sp) \n"
" sw $s3, 12($sp) \n"
" sw $s2, 8($sp) \n"
" sw $s1, 4($sp) \n"
" sw $s0, 0($sp) \n"
// Maintain frame pointer.
" move $s8, $sp \n"
// Pass 1st parameter (a0) unchanged (Stack*).
// Pass 2nd parameter (a1) unchanged (StackVisitor*).
// Save 3rd parameter (a2; IterateStackCallback).
" move $a3, $a2 \n"
// Call the callback.
" jalr $a3 \n"
// Delay slot: Pass 3rd parameter as sp (stack pointer).
" move $a2, $sp \n"
// Load return address.
" lw $ra, 44($sp) \n"
// Restore frame pointer.
" lw $s8, 40($sp) \n"
" jr $ra \n"
// Delay slot: Discard all callee-saved registers.
" addiu $sp, $sp, 48 \n");
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Push all callee-saved registers to get them on the stack for conservative
// stack scanning.
//
// See asm/x64/push_registers_clang.cc for why the function is not generated
// using clang.
//
// Do not depend on V8_TARGET_OS_* defines as some embedders may override the
// GN toolchain (e.g. ChromeOS) and not provide them.
asm(".set noreorder \n"
".global PushAllRegistersAndIterateStack \n"
".hidden PushAllRegistersAndIterateStack \n"
"PushAllRegistersAndIterateStack: \n"
// Push all callee-saved registers and save return address.
" daddiu $sp, $sp, -96 \n"
" sd $ra, 88($sp) \n"
" sd $s8, 80($sp) \n"
" sd $sp, 72($sp) \n"
" sd $gp, 64($sp) \n"
" sd $s7, 56($sp) \n"
" sd $s6, 48($sp) \n"
" sd $s5, 40($sp) \n"
" sd $s4, 32($sp) \n"
" sd $s3, 24($sp) \n"
" sd $s2, 16($sp) \n"
" sd $s1, 8($sp) \n"
" sd $s0, 0($sp) \n"
// Maintain frame pointer.
" move $s8, $sp \n"
// Pass 1st parameter (a0) unchanged (Stack*).
// Pass 2nd parameter (a1) unchanged (StackVisitor*).
// Save 3rd parameter (a2; IterateStackCallback).
" move $a3, $a2 \n"
// Call the callback.
" jalr $a3 \n"
// Delay slot: Pass 3rd parameter as sp (stack pointer).
" move $a2, $sp \n"
// Load return address.
" ld $ra, 88($sp) \n"
// Restore frame pointer.
" ld $s8, 80($sp) \n"
" jr $ra \n"
// Delay slot: Discard all callee-saved registers.
" daddiu $sp, $sp, 96 \n");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment