Commit 12bbe90f authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

cppgc: Drop high-address stack assumption

The assumption doesn't necessarily hold on linux and Android either.

Bug: chromium:1056170, chromium:1239287
Change-Id: Ibb0d8f5f814580bff4e8a7dce9a3397df1385896
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3097273Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76299}
parent 2257f6b1
......@@ -168,17 +168,9 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final {
static V8_INLINE bool TryGetCagedHeap(const void* slot, const void* value,
WriteBarrier::Params& params) {
if (!Platform::StackAddressesSmallerThanHeapAddresses()) {
// This method assumes that the stack is allocated in high
// addresses. That is not guaranteed on Windows and Fuchsia. Having a
// low-address (below api_constants::kCagedHeapReservationSize) on-stack
// slot with a nullptr value would cause this method to erroneously return
// that the slot resides in a caged heap that starts at a null address.
// This check is applied only on Windows because it is not an issue on
// other OSes where the stack resides in higher adderesses, and to keep
// the write barrier as cheap as possible.
if (!value) return false;
}
// TODO(chromium:1056170): Check if the null check can be folded in with
// the rest of the write barrier.
if (!value) return false;
params.start = reinterpret_cast<uintptr_t>(value) &
~(api_constants::kCagedHeapReservationAlignment - 1);
const uintptr_t slot_offset =
......
......@@ -29,8 +29,6 @@ using TracingController = v8::TracingController;
*/
class V8_EXPORT Platform {
public:
static constexpr bool StackAddressesSmallerThanHeapAddresses();
virtual ~Platform() = default;
/**
......@@ -151,15 +149,6 @@ V8_EXPORT void Abort();
} // namespace internal
// static
constexpr bool Platform::StackAddressesSmallerThanHeapAddresses() {
#if V8_OS_WIN || V8_OS_FUCHSIA || V8_OS_MACOSX
return false;
#else
return true;
#endif // V8_OS_WIN || V8_OS_FUCHSIA || V8_OS_MACOSX
}
} // namespace cppgc
#endif // INCLUDE_CPPGC_PLATFORM_H_
......@@ -74,11 +74,6 @@ CagedHeap::CagedHeap(HeapBase* heap_base, PageAllocator* platform_allocator)
: reserved_area_(ReserveCagedHeap(platform_allocator)) {
using CagedAddress = CagedHeap::AllocatorType::Address;
if (Platform::StackAddressesSmallerThanHeapAddresses()) {
// Write barrier assumes that caged heap is allocated below the stack.
CHECK_LT(reserved_area_.address(), v8::base::Stack::GetStackStart());
}
DCHECK_NOT_NULL(heap_base);
CHECK(platform_allocator->SetPermissions(
......
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