Revision: 21980
Author:   [email protected]
Date:     Tue Jun 24 14:30:22 2014 UTC
Log:      Promote objects if semi-space copy fails while scavenging.

BUG=388188
LOG=N
[email protected]

Review URL: https://codereview.chromium.org/351853006
http://code.google.com/p/v8/source/detail?r=21980

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/mark-compact.cc

=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Jun 23 13:52:17 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Tue Jun 24 14:30:22 2014 UTC
@@ -2026,6 +2026,19 @@
     AllocationResult allocation =
         heap->new_space()->AllocateRaw(allocation_size);
     heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
+
+    // Allocation in the other semi-space may fail due to fragmentation.
+    // In that case we allocate in the old generation.
+    if (allocation.IsRetry()) {
+      if (object_contents == DATA_OBJECT) {
+        ASSERT(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE));
+        allocation = heap->old_data_space()->AllocateRaw(allocation_size);
+      } else {
+        ASSERT(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE));
+ allocation = heap->old_pointer_space()->AllocateRaw(allocation_size);
+      }
+    }
+
     HeapObject* target = HeapObject::cast(allocation.ToObjectChecked());

     if (alignment != kObjectAlignment) {
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Mon Jun 23 12:18:13 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Jun 24 14:30:22 2014 UTC
@@ -2015,7 +2015,6 @@
         continue;
       }

-      // Promotion failed. Just migrate object to another semispace.
       AllocationResult allocation = new_space->AllocateRaw(size);
       if (allocation.IsRetry()) {
         if (!new_space->AddFreshPage()) {

--
--
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