Skip to content

Commit

Permalink
Revert "[WASM] Reserve a large block of address space on 32 bit Windo…
Browse files Browse the repository at this point in the history
…ws."

This reverts commit 2a78cf9.

Reason for revert: This CL breaks Android builds
https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20Builder%20%28dbg%29/builds/5740
https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20Marshmallow%2064bit%20Perf/builds/10177
https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20ARMv6%20Builder/builds/5532


Original change's description:
> [WASM] Reserve a large block of address space on 32 bit Windows.
> 
> - Reserves address space on 32 bit Windows, using
>   base::ReserveAddressSpace. This will be released on the first
>   failure in AllocPages.
> - Implements v8::Platform::OnCriticalMemoryPressure in gin, so V8 alloc
>   failures can also invoke base::ReleaseReservation.
> 
> Bug: chromium:634547
> Change-Id: I9bf7b4bb406bbd138c96ed5091b5900fd8137947
> Reviewed-on: https://chromium-review.googlesource.com/616340
> Reviewed-by: Jeremy Roman <jbroman@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Chris Palmer <palmer@chromium.org>
> Reviewed-by: Brad Nelson <bradnelson@chromium.org>
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#495411}

TBR=bradnelson@chromium.org,palmer@chromium.org,dcheng@chromium.org,bbudge@chromium.org,jschuh@chromium.org,jbroman@chromium.org,haraken@chromium.org,slangley@chromium.org

Change-Id: I5acb08fb0caa798061bd9e24209794a45925b8fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:634547
Reviewed-on: https://chromium-review.googlesource.com/620346
Reviewed-by: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495430}
  • Loading branch information
peria authored and Commit Bot committed Aug 18, 2017
1 parent 829feac commit a3675fc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion gin/public/v8_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class GIN_EXPORT V8Platform : public v8::Platform {
static V8Platform* Get();

// v8::Platform implementation.
void OnCriticalMemoryPressure() override;
size_t NumberOfAvailableBackgroundThreads() override;
void CallOnBackgroundThread(
v8::Task* task,
Expand Down
5 changes: 0 additions & 5 deletions gin/v8_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <algorithm>

#include "base/allocator/partition_allocator/page_allocator.h"
#include "base/bind.h"
#include "base/debug/stack_trace.h"
#include "base/location.h"
Expand Down Expand Up @@ -196,10 +195,6 @@ V8Platform::V8Platform() : tracing_controller_(new TracingControllerImpl) {}

V8Platform::~V8Platform() {}

void V8Platform::OnCriticalMemoryPressure() {
base::ReleaseReservation();
}

size_t V8Platform::NumberOfAvailableBackgroundThreads() {
return std::max(1, base::TaskScheduler::GetInstance()
->GetMaxConcurrentTasksWithTraitsDeprecated(
Expand Down
20 changes: 0 additions & 20 deletions third_party/WebKit/Source/controller/BlinkInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/

#include "bindings/core/v8/V8Initializer.h"
#include "build/build_config.h"
#include "core/animation/AnimationClock.h"
#include "modules/ModulesInitializer.h"
#include "platform/bindings/Microtask.h"
Expand Down Expand Up @@ -69,25 +68,6 @@ static ModulesInitializer& GetModulesInitializer() {
void Initialize(Platform* platform) {
Platform::Initialize(platform);

#if !defined(ARCH_CPU_X86_64) && !defined(ARCH_CPU_ARM64) && defined(OS_WIN)
// Reserve address space on 32 bit Windows, to make it likelier that large
// array buffer allocations succeed.
BOOL is_wow_64 = -1;
if (!IsWow64Process(GetCurrentProcess(), &is_wow_64))
is_wow_64 = FALSE;
if (!is_wow_64) {
// Try to reserve as much address space as we reasonably can.
const size_t kMB = 1024 * 1024;
for (size_t size = 512 * kMB; size >= 32 * kMB; size -= 16 * kMB) {
const size_t kAlignment = 64 << 10; // 64K (wasm page size)
if (base::ReserveAddressSpace(size, kAlignment)) {
break;
}
}
}
#endif // !defined(ARCH_CPU_X86_64) && !defined(ARCH_CPU_ARM64) &&
// defined(OS_WIN)

V8Initializer::InitializeMainThread();

GetModulesInitializer().Initialize();
Expand Down

0 comments on commit a3675fc

Please sign in to comment.