Commit c19ff902 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Revert "[wasm][gc] Use SetPermissions to discard pages"

This reverts commit cc71d5ca.

Reason for revert: gc-stress failures, e.g. https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20gc%20stress/22357

Original change's description:
> [wasm][gc] Use SetPermissions to discard pages
> 
> On 32bit windows, DiscardSystemPages fails sometimes (see bug). We don't
> have a reproducer, so this is a purely speculative fix.
> {SetPermissions} has some platform-specific logic to also discard the
> pages. Specifially, on windows it uses {VirtualFree} instead of
> {DiscardVirtualMemory}.
> {SetPermissions} is also semantically stronger, since it forbids any
> further access to the pages.
> 
> R=​mstarzinger@chromium.org
> 
> Bug: v8:8217, chromium:960707
> Change-Id: I8b3325264c86aff8d6e7c6b01c22ae410e87faf4
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1601134
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#61321}

TBR=mstarzinger@chromium.org,clemensh@chromium.org

Change-Id: Ib2d534a6906ea5d390d08943ea71e1f8799278e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:8217, chromium:960707
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1601147Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61324}
parent b672d089
......@@ -1369,18 +1369,8 @@ void NativeModule::FreeCode(Vector<WasmCode* const> codes) {
Address discard_end = std::min(RoundDown(merged_region.end(), page_size),
RoundUp(region.end(), page_size));
if (discard_start >= discard_end) continue;
#ifdef ENABLE_SLOW_DCHECKS
auto vmem_contains = [discard_start, discard_end](VirtualMemory& vmem) {
return vmem.InVM(discard_start, discard_end - discard_start);
};
DCHECK_EQ(1, std::count_if(owned_code_space_.begin(),
owned_code_space_.end(), vmem_contains));
#endif
// {SetPermissions} with {kNoAccess} also discards the pages in a platform
// specific way.
CHECK(allocator->SetPermissions(reinterpret_cast<void*>(discard_start),
discard_end - discard_start,
PageAllocator::kNoAccess));
allocator->DiscardSystemPages(reinterpret_cast<void*>(discard_start),
discard_end - discard_start);
}
}
......
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