| Index: runtime/vm/gc_marker.cc
|
| diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc
|
| index ef11a9467867e676bc1d7dc75e407f3d6953d8be..95acfbbbad40e0aba5faabde103065f6e5ceec47 100644
|
| --- a/runtime/vm/gc_marker.cc
|
| +++ b/runtime/vm/gc_marker.cc
|
| @@ -142,39 +142,41 @@ template <bool sync>
|
| class MarkingVisitorBase : public ObjectPointerVisitor {
|
| public:
|
| MarkingVisitorBase(Isolate* isolate,
|
| - Heap* heap,
|
| PageSpace* page_space,
|
| MarkingStack* marking_stack,
|
| SkippedCodeFunctions* skipped_code_functions)
|
| : ObjectPointerVisitor(isolate),
|
| thread_(Thread::Current()),
|
| - heap_(heap),
|
| - vm_heap_(Dart::vm_isolate()->heap()),
|
| +#ifndef PRODUCT
|
| class_stats_count_(isolate->class_table()->NumCids()),
|
| class_stats_size_(isolate->class_table()->NumCids()),
|
| +#endif // !PRODUCT
|
| page_space_(page_space),
|
| work_list_(marking_stack),
|
| delayed_weak_properties_(NULL),
|
| visiting_old_object_(NULL),
|
| skipped_code_functions_(skipped_code_functions),
|
| marked_bytes_(0) {
|
| - ASSERT(heap_ != vm_heap_);
|
| ASSERT(thread_->isolate() == isolate);
|
| +#ifndef PRODUCT
|
| class_stats_count_.SetLength(isolate->class_table()->NumCids());
|
| class_stats_size_.SetLength(isolate->class_table()->NumCids());
|
| for (intptr_t i = 0; i < class_stats_count_.length(); ++i) {
|
| class_stats_count_[i] = 0;
|
| class_stats_size_[i] = 0;
|
| }
|
| +#endif // !PRODUCT
|
| }
|
|
|
| uintptr_t marked_bytes() const { return marked_bytes_; }
|
|
|
| +#ifndef PRODUCT
|
| intptr_t live_count(intptr_t class_id) {
|
| return class_stats_count_[class_id];
|
| }
|
|
|
| intptr_t live_size(intptr_t class_id) { return class_stats_size_[class_id]; }
|
| +#endif // !PRODUCT
|
|
|
| bool ProcessPendingWeakProperties() {
|
| bool marked = false;
|
| @@ -353,11 +355,14 @@ class MarkingVisitorBase : public ObjectPointerVisitor {
|
| // Already marked.
|
| return;
|
| }
|
| +
|
| +#ifndef PRODUCT
|
| if (RawObject::IsVariableSizeClassId(raw_obj->GetClassId())) {
|
| UpdateLiveOld(raw_obj->GetClassId(), raw_obj->Size());
|
| } else {
|
| UpdateLiveOld(raw_obj->GetClassId(), 0);
|
| }
|
| +#endif // !PRODUCT
|
|
|
| PushMarked(raw_obj);
|
| }
|
| @@ -387,18 +392,20 @@ class MarkingVisitorBase : public ObjectPointerVisitor {
|
| }
|
| }
|
|
|
| +#ifndef PRODUCT
|
| void UpdateLiveOld(intptr_t class_id, intptr_t size) {
|
| // TODO(koda): Support growing the array once mutator runs concurrently.
|
| ASSERT(class_id < class_stats_count_.length());
|
| class_stats_count_[class_id] += 1;
|
| class_stats_size_[class_id] += size;
|
| }
|
| +#endif // !PRODUCT
|
|
|
| Thread* thread_;
|
| - Heap* heap_;
|
| - Heap* vm_heap_;
|
| +#ifndef PRODUCT
|
| GrowableArray<intptr_t> class_stats_count_;
|
| GrowableArray<intptr_t> class_stats_size_;
|
| +#endif // !PRODUCT
|
| PageSpace* page_space_;
|
| MarkerWorkList work_list_;
|
| RawWeakProperty* delayed_weak_properties_;
|
| @@ -572,7 +579,7 @@ class MarkTask : public ThreadPool::Task {
|
| Zone* zone = stack_zone.GetZone();
|
| SkippedCodeFunctions* skipped_code_functions =
|
| collect_code_ ? new (zone) SkippedCodeFunctions() : NULL;
|
| - SyncMarkingVisitor visitor(isolate_, heap_, page_space_, marking_stack_,
|
| + SyncMarkingVisitor visitor(isolate_, page_space_, marking_stack_,
|
| skipped_code_functions);
|
| // Phase 1: Iterate over roots and drain marking stack in tasks.
|
| marker_->IterateRoots(isolate_, &visitor, task_index_, num_tasks_);
|
| @@ -702,7 +709,7 @@ void GCMarker::MarkObjects(Isolate* isolate,
|
| // Mark everything on main thread.
|
| SkippedCodeFunctions* skipped_code_functions =
|
| collect_code ? new (zone) SkippedCodeFunctions() : NULL;
|
| - UnsyncMarkingVisitor mark(isolate, heap_, page_space, &marking_stack,
|
| + UnsyncMarkingVisitor mark(isolate, page_space, &marking_stack,
|
| skipped_code_functions);
|
| IterateRoots(isolate, &mark, 0, 1);
|
| mark.DrainMarkingStack();
|
|
|