Commit 3399bdd2 authored by titzer@chromium.org's avatar titzer@chromium.org

Temporarily disable calls to OS::TotalPhysicalMemory to avoid ASSERT when...

Temporarily disable calls to OS::TotalPhysicalMemory to avoid ASSERT when running under the Chrome Sandbox.

This CL reverts the behaviour added in r16983 to avoid calling OS::TotalPhysicalMemory
which fails an assert in the Chrome Sandbox.  It reverts the default
ResourceConstraints behaviour to that of V8 before r16983 (i.e., baseing these
values purely on hard-coded checks against 64bit/32bit and Android/non-Android.
This will be reverted once http://crbug.com/312241 has been resolved.

BUG=312241
R=titzer@chromium.org

Review URL: https://codereview.chromium.org/48463002

Patch from Ross McIlroy <rmcilroy@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17415 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 19a2e803
......@@ -37,41 +37,25 @@
namespace v8 {
#if V8_OS_ANDROID
const bool kOsHasSwap = false;
#else
const bool kOsHasSwap = true;
#endif
bool ConfigureResourceConstraintsForCurrentPlatform(
ResourceConstraints* constraints) {
if (constraints == NULL) {
return false;
}
uint64_t physical_memory = i::OS::TotalPhysicalMemory();
int lump_of_memory = (i::kPointerSize / 4) * i::MB;
// The young_space_size should be a power of 2 and old_generation_size should
// be a multiple of Page::kPageSize.
if (physical_memory <= 512ul * i::MB) {
constraints->set_max_young_space_size(2 * lump_of_memory);
constraints->set_max_old_space_size(128 * lump_of_memory);
constraints->set_max_executable_size(96 * lump_of_memory);
} else if (physical_memory <= (kOsHasSwap ? 768ul * i::MB : 1ul * i::GB)) {
constraints->set_max_young_space_size(8 * lump_of_memory);
constraints->set_max_old_space_size(256 * lump_of_memory);
constraints->set_max_executable_size(192 * lump_of_memory);
} else if (physical_memory <= (kOsHasSwap ? 1ul * i::GB : 2ul * i::GB)) {
constraints->set_max_young_space_size(16 * lump_of_memory);
constraints->set_max_old_space_size(512 * lump_of_memory);
constraints->set_max_executable_size(256 * lump_of_memory);
} else {
constraints->set_max_young_space_size(16 * lump_of_memory);
constraints->set_max_old_space_size(700 * lump_of_memory);
constraints->set_max_executable_size(256 * lump_of_memory);
}
#if V8_OS_ANDROID
constraints->set_max_young_space_size(8 * lump_of_memory);
constraints->set_max_old_space_size(256 * lump_of_memory);
constraints->set_max_executable_size(192 * lump_of_memory);
#else
constraints->set_max_young_space_size(16 * lump_of_memory);
constraints->set_max_old_space_size(700 * lump_of_memory);
constraints->set_max_executable_size(256 * lump_of_memory);
#endif
return true;
}
......
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