Push version 1.3.4 to trunk.
Added a readline() command to the d8 shell.
Fixed bug in json parsing.
Added idle notification to the API and reduced memory on idle notifications.
Review URL: http://codereview.chromium.org/164475
git-svn-id: http://v8.googlecode.com/svn/trunk@2682 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/heap.cc b/src/heap.cc
index 8ea1136..f8d22a2 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -425,6 +425,20 @@
}
+void Heap::EnsureFromSpaceIsCommitted() {
+ if (new_space_.CommitFromSpaceIfNeeded()) return;
+
+ // Committing memory to from space failed.
+ // Try shrinking and try again.
+ Shrink();
+ if (new_space_.CommitFromSpaceIfNeeded()) return;
+
+ // Committing memory to from space failed again.
+ // Memory is exhausted and we will die.
+ V8::FatalProcessOutOfMemory("Committing semi space failed.");
+}
+
+
void Heap::PerformGarbageCollection(AllocationSpace space,
GarbageCollector collector,
GCTracer* tracer) {
@@ -433,7 +447,7 @@
ASSERT(!allocation_allowed_);
global_gc_prologue_callback_();
}
-
+ EnsureFromSpaceIsCommitted();
if (collector == MARK_COMPACTOR) {
MarkCompact(tracer);