Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: runtime/vm/gc_marker.cc

Issue 51653006: Track live instance and allocation counts for classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/gc_marker.h" 5 #include "vm/gc_marker.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 class MarkingVisitor : public ObjectPointerVisitor { 121 class MarkingVisitor : public ObjectPointerVisitor {
122 public: 122 public:
123 MarkingVisitor(Isolate* isolate, 123 MarkingVisitor(Isolate* isolate,
124 Heap* heap, 124 Heap* heap,
125 PageSpace* page_space, 125 PageSpace* page_space,
126 MarkingStack* marking_stack, 126 MarkingStack* marking_stack,
127 bool visit_function_code) 127 bool visit_function_code)
128 : ObjectPointerVisitor(isolate), 128 : ObjectPointerVisitor(isolate),
129 heap_(heap), 129 heap_(heap),
130 vm_heap_(Dart::vm_isolate()->heap()), 130 vm_heap_(Dart::vm_isolate()->heap()),
131 class_table_(isolate->class_table()),
131 page_space_(page_space), 132 page_space_(page_space),
132 marking_stack_(marking_stack), 133 marking_stack_(marking_stack),
133 visiting_old_object_(NULL), 134 visiting_old_object_(NULL),
134 visit_function_code_(visit_function_code) { 135 visit_function_code_(visit_function_code) {
135 ASSERT(heap_ != vm_heap_); 136 ASSERT(heap_ != vm_heap_);
136 } 137 }
137 138
138 MarkingStack* marking_stack() const { return marking_stack_; } 139 MarkingStack* marking_stack() const { return marking_stack_; }
139 140
140 void VisitPointers(RawObject** first, RawObject** last) { 141 void VisitPointers(RawObject** first, RawObject** last) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (raw_obj->IsNewObject()) { 220 if (raw_obj->IsNewObject()) {
220 // TODO(iposva): Add consistency check. 221 // TODO(iposva): Add consistency check.
221 if ((visiting_old_object_ != NULL) && 222 if ((visiting_old_object_ != NULL) &&
222 !visiting_old_object_->IsRemembered()) { 223 !visiting_old_object_->IsRemembered()) {
223 ASSERT(p != NULL); 224 ASSERT(p != NULL);
224 visiting_old_object_->SetRememberedBit(); 225 visiting_old_object_->SetRememberedBit();
225 isolate()->store_buffer()->AddObjectGC(visiting_old_object_); 226 isolate()->store_buffer()->AddObjectGC(visiting_old_object_);
226 } 227 }
227 return; 228 return;
228 } 229 }
229 230 class_table_->UpdateLiveOld(raw_obj->GetClassId(), raw_obj->Size());
Ivan Posva 2014/01/17 06:53:16 We only need the size for variable size objects. I
Cutch 2014/01/17 18:37:59 Done.
230 MarkAndPush(raw_obj); 231 MarkAndPush(raw_obj);
231 } 232 }
232 233
233 void DetachCode() { 234 void DetachCode() {
234 for (int i = 0; i < skipped_code_functions_.length(); i++) { 235 for (int i = 0; i < skipped_code_functions_.length(); i++) {
235 RawFunction* func = skipped_code_functions_[i]; 236 RawFunction* func = skipped_code_functions_[i];
236 RawCode* code = func->ptr()->code_; 237 RawCode* code = func->ptr()->code_;
237 if (!code->IsMarked()) { 238 if (!code->IsMarked()) {
238 // If the code wasn't strongly visited through other references 239 // If the code wasn't strongly visited through other references
239 // after skipping the function's code pointer, then we disconnect the 240 // after skipping the function's code pointer, then we disconnect the
(...skipping 10 matching lines...) Expand all
250 String name; 251 String name;
251 name = func->ptr()->name_; 252 name = func->ptr()->name_;
252 OS::Print("Detaching code: %s\n", name.ToCString()); 253 OS::Print("Detaching code: %s\n", name.ToCString());
253 } 254 }
254 } 255 }
255 } 256 }
256 } 257 }
257 258
258 Heap* heap_; 259 Heap* heap_;
259 Heap* vm_heap_; 260 Heap* vm_heap_;
261 ClassTable* class_table_;
260 PageSpace* page_space_; 262 PageSpace* page_space_;
261 MarkingStack* marking_stack_; 263 MarkingStack* marking_stack_;
262 RawObject* visiting_old_object_; 264 RawObject* visiting_old_object_;
263 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet; 265 typedef std::multimap<RawObject*, RawWeakProperty*> DelaySet;
264 DelaySet delay_set_; 266 DelaySet delay_set_;
265 const bool visit_function_code_; 267 const bool visit_function_code_;
266 GrowableArray<RawFunction*> skipped_code_functions_; 268 GrowableArray<RawFunction*> skipped_code_functions_;
267 269
268 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); 270 DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor);
269 }; 271 };
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 MarkingWeakVisitor mark_weak; 486 MarkingWeakVisitor mark_weak;
485 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); 487 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks);
486 mark.Finalize(); 488 mark.Finalize();
487 ProcessWeakTables(page_space); 489 ProcessWeakTables(page_space);
488 ProcessObjectIdTable(isolate); 490 ProcessObjectIdTable(isolate);
489 491
490 Epilogue(isolate, invoke_api_callbacks); 492 Epilogue(isolate, invoke_api_callbacks);
491 } 493 }
492 494
493 } // namespace dart 495 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698