Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: src/runtime.cc

Issue 66723003: Make runtime new-space allocations go through Heap::AllocateRaw. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplified implementation. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index c9f152f9daccb94f48058c8d709362be25e0de9f..7da24c3826937d3a8670fc05f16132688c83fed5 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -9710,30 +9710,25 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
}
+// 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;
}
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698