| Index: src/defaults.cc
|
| diff --git a/test/mjsunit/parallel-invalidate-transition-map.js b/src/defaults.cc
|
| similarity index 53%
|
| copy from test/mjsunit/parallel-invalidate-transition-map.js
|
| copy to src/defaults.cc
|
| index 9a5d31003f93307f958832a7a2a4e7e3331d7d2c..301155f94dcb24f758eecf7f2d113ab026853381 100644
|
| --- a/test/mjsunit/parallel-invalidate-transition-map.js
|
| +++ b/src/defaults.cc
|
| @@ -25,33 +25,47 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --track-fields --track-double-fields --allow-natives-syntax
|
| -// Flags: --concurrent-recompilation --concurrent-recompilation-delay=100
|
| +#include "../include/v8-defaults.h"
|
|
|
| -if (!%IsConcurrentRecompilationSupported()) {
|
| - print("Concurrent recompilation is disabled. Skipping this test.");
|
| - quit();
|
| -}
|
| +#include "platform.h"
|
| +#include "globals.h"
|
| +#include "v8.h"
|
| +
|
| +namespace v8 {
|
| +
|
| +bool ConfigureResourceConstraintsForCurrentPlatform(
|
| + ResourceConstraints* constraints) {
|
| + if (constraints == NULL) {
|
| + return false;
|
| + }
|
|
|
| -function new_object() {
|
| - var o = {};
|
| - o.a = 1;
|
| - o.b = 2;
|
| - return o;
|
| + 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 > 2ul * i::GB) {
|
| + 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);
|
| + } else if (physical_memory > 512ul * i::MB) {
|
| + constraints->set_max_young_space_size(8 * lump_of_memory);
|
| + constraints->set_max_old_space_size(192 * lump_of_memory);
|
| + constraints->set_max_executable_size(192 * lump_of_memory);
|
| + } else /* (physical_memory <= 512GB) */ {
|
| + constraints->set_max_young_space_size(2 * lump_of_memory);
|
| + constraints->set_max_old_space_size(96 * lump_of_memory);
|
| + constraints->set_max_executable_size(96 * lump_of_memory);
|
| + }
|
| + return true;
|
| }
|
|
|
| -function add_field(obj) {
|
| - obj.c = 3;
|
| +
|
| +bool SetDefaultResourceConstraintsForCurrentPlatform() {
|
| + ResourceConstraints constraints;
|
| + if (!ConfigureResourceConstraintsForCurrentPlatform(&constraints))
|
| + return false;
|
| + return SetResourceConstraints(&constraints);
|
| }
|
|
|
| -add_field(new_object());
|
| -add_field(new_object());
|
| -%OptimizeFunctionOnNextCall(add_field, "concurrent");
|
| -
|
| -var o = new_object();
|
| -// Trigger optimization in the background thread.
|
| -add_field(o);
|
| -// Invalidate transition map while optimization is underway.
|
| -o.c = 2.2;
|
| -// Sync with background thread to conclude optimization that bailed out.
|
| -assertUnoptimized(add_field, "sync");
|
| +} // namespace v8::internal
|
|
|