Commit 9d4ca4ee authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

cppgc: Support GCC for conservative stack scan

Assumes that (is_clang = false && !is_win) => GCC or other compiler with
inline assembly that is gas-compatible.

Bug: chromium:1056170
Change-Id: I1a2a2d13b7d4af630349d9194b64394c9736ad3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2137405Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67014}
parent 30658b6b
......@@ -348,7 +348,9 @@ config("libbase_config") {
# This config should be applied to code using the cppgc_base.
config("cppgc_base_config") {
if (is_clang) {
# Assume is_clang = false means GCC or other compilers that are compatible
# with gas inline assembly on non-Windows builds.
if (is_clang || !is_win) {
if (target_cpu == "x64" || target_cpu == "x86" || target_cpu == "arm") {
defines = [ "CPPGC_SUPPORTS_CONSERVATIVE_STACK_SCAN" ]
}
......@@ -3967,13 +3969,13 @@ v8_source_set("cppgc_base") {
"src/heap/cppgc/stack.h",
]
if (is_clang) {
if (is_clang || !is_win) {
if (target_cpu == "x64") {
sources += [ "src/heap/cppgc/asm/x64/push_registers_clang.cc" ]
sources += [ "src/heap/cppgc/asm/x64/push_registers_asm.cc" ]
} else if (target_cpu == "x86") {
sources += [ "src/heap/cppgc/asm/ia32/push_registers_clang.cc" ]
sources += [ "src/heap/cppgc/asm/ia32/push_registers_asm.cc" ]
} else if (target_cpu == "arm") {
sources += [ "src/heap/cppgc/asm/arm/push_registers_clang.cc" ]
sources += [ "src/heap/cppgc/asm/arm/push_registers_asm.cc" ]
}
}
......
......@@ -18,10 +18,10 @@
// Otherwise, undefined.
#ifdef _WIN64
// We maintain 16-byte alignment at calls. There is an 8-byte return address
// on the stack and we push 72 bytes which maintains 16-byte stack alignment
// at the call.
// Source: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention
// We maintain 16-byte alignment at calls. There is an 8-byte return address
// on the stack and we push 72 bytes which maintains 16-byte stack alignment
// at the call.
// Source: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention
asm(".globl PushAllRegistersAndIterateStack \n"
"PushAllRegistersAndIterateStack: \n"
// rbp is callee-saved. Maintain proper frame pointer for debugging.
......@@ -52,10 +52,10 @@ asm(".globl PushAllRegistersAndIterateStack \n"
#else // !_WIN64
// We maintain 16-byte alignment at calls. There is an 8-byte return address
// on the stack and we push 56 bytes which maintains 16-byte stack alignment
// at the call.
// Source: https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
// We maintain 16-byte alignment at calls. There is an 8-byte return address
// on the stack and we push 56 bytes which maintains 16-byte stack alignment
// at the call.
// Source: https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
asm(
#ifdef __APPLE__
".globl _PushAllRegistersAndIterateStack \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