Revision: 17603
Author:   [email protected]
Date:     Fri Nov  8 17:09:14 2013 UTC
Log:      Make runtime new-space allocations go through Heap::AllocateRaw.

[email protected], [email protected]

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

Modified:
 /branches/bleeding_edge/src/heap-inl.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Thu Oct 24 16:38:26 2013 UTC
+++ /branches/bleeding_edge/src/heap-inl.h      Fri Nov  8 17:09:14 2013 UTC
@@ -217,10 +217,6 @@
   ASSERT(AllowHandleAllocation::IsAllowed());
   ASSERT(AllowHeapAllocation::IsAllowed());
   ASSERT(gc_state_ == NOT_IN_GC);
-  ASSERT(space != NEW_SPACE ||
-         retry_space == OLD_POINTER_SPACE ||
-         retry_space == OLD_DATA_SPACE ||
-         retry_space == LO_SPACE);
 #ifdef DEBUG
   if (FLAG_gc_interval >= 0 &&
       !disallow_allocation_failure_ &&
@@ -233,7 +229,7 @@
   MaybeObject* result;
   if (NEW_SPACE == space) {
     result = new_space_.AllocateRaw(size_in_bytes);
-    if (always_allocate() && result->IsFailure()) {
+ if (always_allocate() && result->IsFailure() && retry_space != NEW_SPACE) {
       space = retry_space;
     } else {
       return result;
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Nov  7 09:08:34 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Nov  8 17:09:14 2013 UTC
@@ -4823,7 +4823,8 @@
     { int adjusted_object_size = site != NULL
           ? object_size + AllocationMemento::kSize
           : object_size;
- MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size);
+      MaybeObject* maybe_clone =
+          AllocateRaw(adjusted_object_size, NEW_SPACE, NEW_SPACE);
       if (!maybe_clone->ToObject(&clone)) return maybe_clone;
     }
     SLOW_ASSERT(InNewSpace(clone));
=======================================
--- /branches/bleeding_edge/src/heap.h  Wed Nov  6 17:05:50 2013 UTC
+++ /branches/bleeding_edge/src/heap.h  Fri Nov  8 17:09:14 2013 UTC
@@ -2475,6 +2475,7 @@
   DisallowAllocationFailure disallow_allocation_failure_;
 };

+
 #ifdef VERIFY_HEAP
 class NoWeakObjectVerificationScope {
  public:
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Fri Nov  8 13:44:27 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Fri Nov  8 17:09:14 2013 UTC
@@ -9710,30 +9710,25 @@
 }


+// Allocate a block of memory in the given space (filled with a filler).
+// Used as a fall-back for generated code when the space is full.
 static MaybeObject* Allocate(Isolate* isolate,
                              int size,
                              AllocationSpace space) {
-  // Allocate a block of memory in the given space (filled with a filler).
-  // Use as fallback for allocation in generated code when the space
-  // is full.
-  SealHandleScope shs(isolate);
+  Heap* heap = isolate->heap();
   RUNTIME_ASSERT(IsAligned(size, kPointerSize));
   RUNTIME_ASSERT(size > 0);
-  Heap* heap = isolate->heap();
   RUNTIME_ASSERT(size <= heap->MaxRegularSpaceAllocationSize());
-  Object* allocation;
-  { MaybeObject* maybe_allocation;
-    if (space == NEW_SPACE) {
-      maybe_allocation = heap->new_space()->AllocateRaw(size);
-    } else {
-      ASSERT(space == OLD_POINTER_SPACE || space == OLD_DATA_SPACE);
-      maybe_allocation = heap->paged_space(space)->AllocateRaw(size);
-    }
-    if (maybe_allocation->ToObject(&allocation)) {
- heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size);
-    }
-    return maybe_allocation;
+  HeapObject* allocation;
+  { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space);
+    if (!maybe_allocation->To(&allocation)) return maybe_allocation;
   }
+#ifdef DEBUG
+  MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address());
+  ASSERT(chunk->owner()->identity() == space);
+#endif
+  heap->CreateFillerObjectAt(allocation->address(), size);
+  return allocation;
 }


--
--
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/groups/opt_out.

Reply via email to