Index: runtime/vm/scavenger.cc |
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc |
index e223803806f2d38d45b262508d6fd043e3ee7c3a..e885b9801e7cf8c877ea03b8abc02333f726927f 100644 |
--- a/runtime/vm/scavenger.cc |
+++ b/runtime/vm/scavenger.cc |
@@ -415,7 +415,7 @@ Scavenger::Scavenger(Heap* heap, |
if (to_ == NULL) { |
FATAL("Out of memory.\n"); |
} |
- |
+ UpdateMaxHeapCapacity(); |
// Setup local fields. |
top_ = FirstObjectStart(); |
resolved_top_ = top_; |
@@ -459,6 +459,7 @@ SemiSpace* Scavenger::Prologue(Isolate* isolate, bool invoke_api_callbacks) { |
// isolate to finish scavenge, etc.). |
FATAL("Out of memory.\n"); |
} |
+ UpdateMaxHeapCapacity(); |
top_ = FirstObjectStart(); |
resolved_top_ = top_; |
end_ = to_->end(); |
@@ -705,6 +706,20 @@ void Scavenger::ProcessToSpace(ScavengerVisitor* visitor) { |
} |
+void Scavenger::UpdateMaxHeapCapacity() { |
+ if (heap_ == NULL) { |
+ // Some unit tests. |
+ return; |
+ } |
+ ASSERT(to_ != NULL); |
+ ASSERT(heap_ != NULL); |
+ Isolate* isolate = heap_->isolate(); |
+ ASSERT(isolate != NULL); |
+ isolate->GetHeapNewCapacityMaxMetric()->SetValue( |
+ to_->size_in_words() * kWordSize); |
+} |
+ |
+ |
uword Scavenger::ProcessWeakProperty(RawWeakProperty* raw_weak, |
ScavengerVisitor* visitor) { |
// The fate of the weak property is determined by its key. |