Reviewers: Vyacheslav Egorov,
Description:
Fix the --max-old-space-size flag so it can be used on 64 bit for
multi-gigabyte heap sizes. The unit is Mbytes.
Hurry the incremental GC when the mutator is mutating too fast for
the incremental marker to keep up.
Print the length of the longest marking step at the end of an
incremental mark-sweep GC.
Skip a Mozilla test that causes deliberate out of memory errors.
Please review this at http://codereview.chromium.org/7528022/
SVN Base: http://v8.googlecode.com/svn/branches/experimental/gc/
Affected files:
M src/heap.h
M src/heap.cc
M src/incremental-marking-inl.h
M src/incremental-marking.h
M src/incremental-marking.cc
M test/mozilla/mozilla.status
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 8858)
+++ src/heap.cc (working copy)
@@ -4724,8 +4724,8 @@
// and through the API, we should gracefully handle the case that the heap
// size is not big enough to fit all the initial objects.
bool Heap::ConfigureHeap(int max_semispace_size,
- int max_old_gen_size,
- int max_executable_size) {
+ intptr_t max_old_gen_size,
+ intptr_t max_executable_size) {
if (HasBeenSetup()) return false;
if (max_semispace_size > 0) {
@@ -5752,6 +5752,7 @@
steps_count_ = heap_->incremental_marking()->steps_count();
steps_took_ = heap_->incremental_marking()->steps_took();
+ longest_step_ = heap_->incremental_marking()->longest_step();
steps_count_since_last_gc_ =
heap_->incremental_marking()->steps_count_since_last_gc();
steps_took_since_last_gc_ =
@@ -5797,9 +5798,10 @@
static_cast<int>(steps_took_since_last_gc_),
steps_count_since_last_gc_);
} else {
- PrintF(" (+ %d ms in %d steps since start of marking)",
+ PrintF(" (+ %d ms in %d steps since start of marking, biggest
step %f ms)",
static_cast<int>(steps_took_),
- steps_count_);
+ steps_count_,
+ longest_step_);
}
}
PrintF(".\n");
Index: src/heap.h
===================================================================
--- src/heap.h (revision 8858)
+++ src/heap.h (working copy)
@@ -360,8 +360,8 @@
// Configure heap size before setup. Return false if the heap has been
// setup already.
bool ConfigureHeap(int max_semispace_size,
- int max_old_gen_size,
- int max_executable_size);
+ intptr_t max_old_gen_size,
+ intptr_t max_executable_size);
bool ConfigureHeapDefault();
// Initializes the global object heap. If create_heap_objects is true,
@@ -2199,6 +2199,7 @@
// Incremental marking steps counters.
int steps_count_;
double steps_took_;
+ double longest_step_;
int steps_count_since_last_gc_;
double steps_took_since_last_gc_;
Index: src/incremental-marking-inl.h
===================================================================
--- src/incremental-marking-inl.h (revision 8858)
+++ src/incremental-marking-inl.h (working copy)
@@ -92,6 +92,21 @@
ASSERT(obj->Size() >= 2*kPointerSize);
ASSERT(IsMarking());
Marking::BlackToGrey(mark_bit);
+ int64_t old_bytes_rescanned = bytes_rescanned_;
+ bytes_rescanned_ = old_bytes_rescanned + obj->Size();
+ if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) {
+ if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSize()) {
+ // If we have queued twice the heap size for rescanning then we are
+ // going around in circles, scanning the same objects again and again
+ // as the program mutates the heap faster than we can incrementally
+ // trace it. In this case we switch to non-incremental marking in
+ // order to finish off this marking phase.
+ if (FLAG_trace_gc) {
+ PrintF("Hurrying incremental marking because of lack of
progress\n");
+ }
+ allocation_marking_factor_ = kMaxAllocationMarkingFactor;
+ }
+ }
marking_deque_.UnshiftGrey(obj);
}
Index: src/incremental-marking.cc
===================================================================
--- src/incremental-marking.cc (revision 8858)
+++ src/incremental-marking.cc (working copy)
@@ -42,6 +42,7 @@
marking_deque_memory_(NULL),
steps_count_(0),
steps_took_(0),
+ longest_step_(0.0),
steps_count_since_last_gc_(0),
steps_took_since_last_gc_(0),
should_hurry_(false),
@@ -466,6 +467,7 @@
steps_took_since_last_gc_ = 0;
steps_count_since_last_gc_ = 0;
+ longest_step_ = 0.0;
}
@@ -622,6 +624,7 @@
if (FLAG_trace_incremental_marking || FLAG_trace_gc) {
double end = OS::TimeCurrentMillis();
double delta = (end - start);
+ longest_step_ = Max(longest_step_, delta);
steps_took_ += delta;
steps_took_since_last_gc_ += delta;
}
Index: src/incremental-marking.h
===================================================================
--- src/incremental-marking.h (revision 8858)
+++ src/incremental-marking.h (working copy)
@@ -94,6 +94,7 @@
static const intptr_t kAllocationMarkingFactorSpeedupInterval = 1024;
// This is how much we increase the marking/allocating factor by.
static const intptr_t kAllocationMarkingFactorSpeedup = 4;
+ static const intptr_t kMaxAllocationMarkingFactor = 1000000000;
void Step(intptr_t allocated);
@@ -142,6 +143,10 @@
return steps_took_;
}
+ inline double longest_step() {
+ return longest_step_;
+ }
+
inline int steps_count_since_last_gc() {
return steps_count_since_last_gc_;
}
@@ -172,8 +177,10 @@
void ResetStepCounters() {
steps_count_ = 0;
steps_took_ = 0;
+ longest_step_ = 0.0;
steps_count_since_last_gc_ = 0;
steps_took_since_last_gc_ = 0;
+ bytes_rescanned_ = 0;
allocation_marking_factor_ = kInitialAllocationMarkingFactor;
}
@@ -208,11 +215,15 @@
int steps_count_;
double steps_took_;
+ double longest_step_;
int steps_count_since_last_gc_;
double steps_took_since_last_gc_;
+ int64_t bytes_rescanned_;
bool should_hurry_;
int allocation_marking_factor_;
intptr_t allocated_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
};
} } // namespace v8::internal
Index: test/mozilla/mozilla.status
===================================================================
--- test/mozilla/mozilla.status (revision 8858)
+++ test/mozilla/mozilla.status (working copy)
@@ -223,7 +223,7 @@
ecma/String/15.5.4.12-5: FAIL_OK
# Creates a linked list of arrays until we run out of memory or timeout.
-js1_5/Regress/regress-312588: FAIL || TIMEOUT
+js1_5/Regress/regress-312588: SKIP
# Runs out of memory because it compiles huge functions.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev