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

Unified Diff: src/heap/heap.cc

Issue 654243003: Revert "Break deserializer reservations into chunks that fit onto a page." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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/heap.h ('k') | src/list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 7c1b2b2106042341cdc2c14d564de4d67a323c76..65b3bed357d00153cbbaa65dcf9dc000532d4737 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -28,7 +28,6 @@
#include "src/natives.h"
#include "src/runtime-profiler.h"
#include "src/scopeinfo.h"
-#include "src/serialize.h"
#include "src/snapshot.h"
#include "src/utils.h"
#include "src/v8threads.h"
@@ -920,41 +919,33 @@ static bool AbortIncrementalMarkingAndCollectGarbage(
}
-bool Heap::ReserveSpace(Reservation* reservations) {
+void Heap::ReserveSpace(int* sizes, Address* locations_out) {
bool gc_performed = true;
int counter = 0;
static const int kThreshold = 20;
while (gc_performed && counter++ < kThreshold) {
gc_performed = false;
for (int space = NEW_SPACE; space < Serializer::kNumberOfSpaces; space++) {
- Reservation* reservation = &reservations[space];
- DCHECK_LE(1, reservation->length());
- if (reservation->at(0).size == 0) continue;
+ if (sizes[space] == 0) continue;
bool perform_gc = false;
if (space == LO_SPACE) {
- DCHECK_EQ(1, reservation->length());
- perform_gc = !lo_space()->CanAllocateSize(reservation->at(0).size);
+ perform_gc = !lo_space()->CanAllocateSize(sizes[space]);
} else {
- for (auto& chunk : *reservation) {
- AllocationResult allocation;
- int size = chunk.size;
- if (space == NEW_SPACE) {
- allocation = new_space()->AllocateRaw(size);
- } else {
- allocation = paged_space(space)->AllocateRaw(size);
- }
- FreeListNode* node;
- if (allocation.To(&node)) {
- // Mark with a free list node, in case we have a GC before
- // deserializing.
- node->set_size(this, size);
- DCHECK(space < Serializer::kNumberOfPreallocatedSpaces);
- chunk.start = node->address();
- chunk.end = node->address() + size;
- } else {
- perform_gc = true;
- break;
- }
+ AllocationResult allocation;
+ if (space == NEW_SPACE) {
+ allocation = new_space()->AllocateRaw(sizes[space]);
+ } else {
+ allocation = paged_space(space)->AllocateRaw(sizes[space]);
+ }
+ FreeListNode* node;
+ if (allocation.To(&node)) {
+ // Mark with a free list node, in case we have a GC before
+ // deserializing.
+ node->set_size(this, sizes[space]);
+ DCHECK(space < Serializer::kNumberOfPreallocatedSpaces);
+ locations_out[space] = node->address();
+ } else {
+ perform_gc = true;
}
}
if (perform_gc) {
@@ -972,7 +963,10 @@ bool Heap::ReserveSpace(Reservation* reservations) {
}
}
- return !gc_performed;
+ if (gc_performed) {
+ // Failed to reserve the space after several attempts.
+ V8::FatalProcessOutOfMemory("Heap::ReserveSpace");
+ }
}
« no previous file with comments | « src/heap/heap.h ('k') | src/list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698