Reviewers: ulan,

Message:
ptal

Description:
Start with a maximally large new space reservation

BUG=v8:3626
[email protected]
LOG=n

Please review this at https://codereview.chromium.org/657583004/

Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+34, -11 lines):
  M src/heap/heap.cc
  M test/cctest/cctest.h
  M test/cctest/test-constantpool.cc
  M test/cctest/test-heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 65b3bed357d00153cbbaa65dcf9dc000532d4737..d5d0dd9bc199e24cae244c2109693d9311dd28f2 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -59,7 +59,7 @@ Heap::Heap()
       // be a multiple of Page::kPageSize.
       reserved_semispace_size_(8 * (kPointerSize / 4) * MB),
       max_semi_space_size_(8 * (kPointerSize / 4) * MB),
-      initial_semispace_size_(Page::kPageSize),
+      initial_semispace_size_(8 * (kPointerSize / 4) * MB),
       max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
       max_executable_size_(256ul * (kPointerSize / 4) * MB),
       // Variables set based on semispace_size_ and old_generation_size_ in
@@ -139,7 +139,8 @@ Heap::Heap()
 // V8 with snapshots and a non-default max semispace size is much
 // easier if you can define it as part of the build environment.
 #if defined(V8_MAX_SEMISPACE_SIZE)
-  max_semi_space_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE;
+ initial_semispace_size_ = max_semi_space_size_ = reserved_semispace_size_ =
+      V8_MAX_SEMISPACE_SIZE;
 #endif

   // Ensure old_generation_size_ is a multiple of kPageSize.
@@ -4939,9 +4940,12 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size,
     } else {
       initial_semispace_size_ = initial_semispace_size;
     }
+    initial_semispace_size_ =
+        Min(initial_semispace_size_, max_semi_space_size_);
+  } else {
+    initial_semispace_size_ = max_semi_space_size_;
   }

- initial_semispace_size_ = Min(initial_semispace_size_, max_semi_space_size_);

// The old generation is paged and needs at least one page for each space.
   int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1;
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 4f078690e1d3bd81f0919bf6be30c97a827e193e..7f8ff187bf7f2a6fc3c65412dc00e1a497bf9aec 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -481,15 +481,30 @@ static inline void ExpectUndefined(const char* code) {


 // Helper function that simulates a full new-space in the heap.
-static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
-  int new_linear_size = static_cast<int>(
- *space->allocation_limit_address() - *space->allocation_top_address());
-  if (new_linear_size == 0) return;
+static inline bool FillUpOnePage(v8::internal::NewSpace* space) {
   v8::internal::AllocationResult allocation =
-      space->AllocateRaw(new_linear_size);
+      space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize);
+  if (allocation.IsRetry()) return false;
   v8::internal::FreeListNode* node =
       v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
-  node->set_size(space->heap(), new_linear_size);
+ node->set_size(space->heap(), v8::internal::Page::kMaxRegularHeapObjectSize);
+  return true;
+}
+
+static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
+ int new_linear_size = static_cast<int>(*space->allocation_limit_address() -
+                                         *space->allocation_top_address());
+  if (new_linear_size > 0) {
+    // Fill up the current page.
+    v8::internal::AllocationResult allocation =
+        space->AllocateRaw(new_linear_size);
+    v8::internal::FreeListNode* node =
+        v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
+    node->set_size(space->heap(), new_linear_size);
+  }
+  // Fill up all remaining pages.
+  while (FillUpOnePage(space))
+    ;
 }


Index: test/cctest/test-constantpool.cc
diff --git a/test/cctest/test-constantpool.cc b/test/cctest/test-constantpool.cc index 453657609eb1532b1a2714e5541c5467e0b9747f..990a0996ca0c101e0489a462b98262ff987d62ed 100644
--- a/test/cctest/test-constantpool.cc
+++ b/test/cctest/test-constantpool.cc
@@ -303,7 +303,7 @@ TEST(ConstantPoolCompacting) {

   // Force compacting garbage collection.
   CHECK(FLAG_always_compact);
-  heap->CollectAllGarbage(Heap::kNoGCFlags);
+  heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);

   CHECK_NE(old_ptr, *object);
   CHECK_EQ(*object, array->get_heap_ptr_entry(0));
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 2e285916079f61528887345627c52b2d656e0168..43ab2404759e00816cfa0c0d8d228db35b6bd059 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -1992,6 +1992,7 @@ TEST(InstanceOfStubWriteBarrier) {

   IncrementalMarking* marking = CcTest::heap()->incremental_marking();
   marking->Abort();
+  CcTest::heap()->mark_compact_collector()->ClearMarkbits();
   marking->Start();

   Handle<JSFunction> f =
@@ -2114,6 +2115,7 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {

   IncrementalMarking* marking = CcTest::heap()->incremental_marking();
   marking->Abort();
+  CcTest::heap()->mark_compact_collector()->ClearMarkbits();
   marking->Start();

// The following two calls will increment CcTest::heap()->global_ic_age().
@@ -2170,6 +2172,7 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
   CHECK(f->IsOptimized());

   CcTest::heap()->incremental_marking()->Abort();
+  CcTest::heap()->mark_compact_collector()->ClearMarkbits();

// The following two calls will increment CcTest::heap()->global_ic_age().
   // Since incremental marking is off, IdleNotification will do full GC.
@@ -2189,6 +2192,7 @@ TEST(IdleNotificationFinishMarking) {
   SimulateFullSpace(CcTest::heap()->old_pointer_space());
   IncrementalMarking* marking = CcTest::heap()->incremental_marking();
   marking->Abort();
+  CcTest::heap()->mark_compact_collector()->ClearMarkbits();
   marking->Start();

   CHECK_EQ(CcTest::heap()->gc_count(), 0);
@@ -2234,7 +2238,6 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
   v8::HandleScope scope(CcTest::isolate());

   SimulateFullSpace(CcTest::heap()->new_space());
-  AlwaysAllocateScope always_allocate(CcTest::i_isolate());
   v8::Local<v8::Value> res = CompileRun(
       "function c(x) {"
       "  this.x = x;"
@@ -4601,6 +4604,7 @@ TEST(Regress388880) {
   // that would cause crash.
   IncrementalMarking* marking = CcTest::heap()->incremental_marking();
   marking->Abort();
+  CcTest::heap()->mark_compact_collector()->ClearMarkbits();
   marking->Start();
   CHECK(marking->IsMarking());



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to