cppgc: Remove redzone from stack scan

The trampoline should never inline the actual iteration method and
always use a full call. As a result, there can be no interesting data
in the redzone.

This allows simplifying as the existence and size of a red zone is platform
dependent.

Bug: chromium:1056170
Change-Id: I38d686b0e60fdcc383c40a45e7a81ec0e91f4d62
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2132788
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66955}
This commit is contained in:
Michael Lippautz 2020-04-01 22:03:58 +02:00 committed by Commit Bot
parent b80be38cac
commit 3b442f960d
2 changed files with 6 additions and 7 deletions

View File

@ -111,12 +111,7 @@ void Stack::IteratePointersImpl(StackVisitor* visitor,
// All supported platforms should have their stack aligned to at least
// sizeof(void*).
constexpr size_t kMinStackAlignment = sizeof(void*);
// Redzone should not contain any pointers as the iteration is always called
// from the assembly trampoline. If inline assembly is ever inlined through
// LTO this may become necessary.
constexpr size_t kRedZoneBytes = 128;
void** current = reinterpret_cast<void**>(
reinterpret_cast<uintptr_t>(stack_end - kRedZoneBytes));
void** current = reinterpret_cast<void**>(stack_end);
CHECK_EQ(0u, reinterpret_cast<uintptr_t>(current) & (kMinStackAlignment - 1));
for (; current < stack_start_; ++current) {
// MSAN: Instead of unpoisoning the whole stack, the slot's value is copied

View File

@ -44,7 +44,11 @@ class V8_EXPORT_PRIVATE Stack final {
#endif // CPPGC_SUPPORTS_CONSERVATIVE_STACK_SCAN
private:
void IteratePointersImpl(StackVisitor* visitor, intptr_t* stack_end) const;
// Called by the trampoline that pushes registers on the stack. This method
// should never be inlined to ensure that a possible redzone cannot contain
// any data that needs to be scanned.
V8_NOINLINE void IteratePointersImpl(StackVisitor* visitor,
intptr_t* stack_end) const;
const void* stack_start_;
};