should_hurry_(false),
marking_speed_(0),
allocated_(0),
- no_marking_scope_depth_(0) {
+ no_marking_scope_depth_(0),
+ unscanned_bytes_of_large_object_(0) {
}
chunk->progress_bar());
int end_offset = Min(object_size,
start_offset + kProgressBarScanningChunk);
+ int already_scanned_offset = start_offset;
bool scan_until_end = false;
do {
VisitPointersWithAnchor(heap,
chunk->set_progress_bar(start_offset);
if (start_offset < object_size) {
heap->incremental_marking()->marking_deque()->UnshiftGrey(object);
+ heap->incremental_marking()->NotifyIncompleteScanOfObject(
+ object_size - (start_offset - already_scanned_offset));
}
} else {
FixedArrayVisitor::Visit(map, object);
if (map == filler_map) continue;
int size = obj->SizeFromMap(map);
- bytes_to_process -= size;
+ unscanned_bytes_of_large_object_ = 0;
VisitObject(map, obj, size);
+ bytes_to_process -= (size - unscanned_bytes_of_large_object_);
}
}
void UncommitMarkingDeque();
+ void NotifyIncompleteScanOfObject(int unscanned_bytes) {
+ unscanned_bytes_of_large_object_ = unscanned_bytes;
+ }
+
private:
int64_t SpaceLeftInOldSpace();
int no_marking_scope_depth_;
+ int unscanned_bytes_of_large_object_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking);
};
isolate->handle_scope_implementer()->Iterate(&visitor);
deferred.Detach();
}
+
+
+TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ CompileRun("function f(n) {"
+ " var a = new Array(n);"
+ " for (var i = 0; i < n; i += 100) a[i] = i;"
+ "};"
+ "f(10 * 1024 * 1024);");
+ IncrementalMarking* marking = HEAP->incremental_marking();
+ if (marking->IsStopped()) marking->Start();
+ // This big step should be sufficient to mark the whole array.
+ marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
+ ASSERT(marking->IsComplete());
+}