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

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

Issue 3001343002: Remove GC prologue and epilogue callbacks. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « runtime/vm/gc_marker.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/allocation.h" 7 #include "vm/allocation.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/log.h" 10 #include "vm/log.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 RawObject* raw_obj = handle->raw(); 440 RawObject* raw_obj = handle->raw();
441 if (IsUnreachable(raw_obj)) { 441 if (IsUnreachable(raw_obj)) {
442 handle->UpdateUnreachable(thread()->isolate()); 442 handle->UpdateUnreachable(thread()->isolate());
443 } 443 }
444 } 444 }
445 445
446 private: 446 private:
447 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); 447 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor);
448 }; 448 };
449 449
450 void GCMarker::Prologue(Isolate* isolate, bool invoke_api_callbacks) { 450 void GCMarker::Prologue(Isolate* isolate) {
451 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) {
452 (isolate->gc_prologue_callback())();
453 }
454 isolate->PrepareForGC(); 451 isolate->PrepareForGC();
455 // The store buffers will be rebuilt as part of marking, reset them now. 452 // The store buffers will be rebuilt as part of marking, reset them now.
456 isolate->store_buffer()->Reset(); 453 isolate->store_buffer()->Reset();
457 } 454 }
458 455
459 void GCMarker::Epilogue(Isolate* isolate, bool invoke_api_callbacks) { 456 void GCMarker::Epilogue(Isolate* isolate) {}
460 if (invoke_api_callbacks && (isolate->gc_epilogue_callback() != NULL)) {
461 (isolate->gc_epilogue_callback())();
462 }
463 }
464 457
465 void GCMarker::IterateRoots(Isolate* isolate, 458 void GCMarker::IterateRoots(Isolate* isolate,
466 ObjectPointerVisitor* visitor, 459 ObjectPointerVisitor* visitor,
467 intptr_t slice_index, 460 intptr_t slice_index,
468 intptr_t num_slices) { 461 intptr_t num_slices) {
469 ASSERT(0 <= slice_index && slice_index < num_slices); 462 ASSERT(0 <= slice_index && slice_index < num_slices);
470 if ((slice_index == 0) || (num_slices <= 1)) { 463 if ((slice_index == 0) || (num_slices <= 1)) {
471 isolate->VisitObjectPointers(visitor, 464 isolate->VisitObjectPointers(visitor,
472 StackFrameIterator::kDontValidateFrames); 465 StackFrameIterator::kDontValidateFrames);
473 } 466 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 table->UpdateLiveOld(i, size, count); 663 table->UpdateLiveOld(i, size, count);
671 } 664 }
672 } 665 }
673 #endif // !PRODUCT 666 #endif // !PRODUCT
674 } 667 }
675 visitor->Finalize(); 668 visitor->Finalize();
676 } 669 }
677 670
678 void GCMarker::MarkObjects(Isolate* isolate, 671 void GCMarker::MarkObjects(Isolate* isolate,
679 PageSpace* page_space, 672 PageSpace* page_space,
680 bool invoke_api_callbacks,
681 bool collect_code) { 673 bool collect_code) {
682 Prologue(isolate, invoke_api_callbacks); 674 Prologue(isolate);
683 // The API prologue/epilogue may create/destroy zones, so we must not 675 // The API prologue/epilogue may create/destroy zones, so we must not
684 // depend on zone allocations surviving beyond the epilogue callback. 676 // depend on zone allocations surviving beyond the epilogue callback.
685 { 677 {
686 Thread* thread = Thread::Current(); 678 Thread* thread = Thread::Current();
687 StackZone stack_zone(thread); 679 StackZone stack_zone(thread);
688 Zone* zone = stack_zone.GetZone(); 680 Zone* zone = stack_zone.GetZone();
689 MarkingStack marking_stack; 681 MarkingStack marking_stack;
690 marked_bytes_ = 0; 682 marked_bytes_ = 0;
691 const int num_tasks = FLAG_marker_tasks; 683 const int num_tasks = FLAG_marker_tasks;
692 if (num_tasks == 0) { 684 if (num_tasks == 0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 IterateWeakRoots(isolate, &mark_weak); 737 IterateWeakRoots(isolate, &mark_weak);
746 } 738 }
747 barrier.Sync(); 739 barrier.Sync();
748 740
749 // Phase 3: Finalize results from all markers (detach code, etc.). 741 // Phase 3: Finalize results from all markers (detach code, etc.).
750 barrier.Exit(); 742 barrier.Exit();
751 } 743 }
752 ProcessWeakTables(page_space); 744 ProcessWeakTables(page_space);
753 ProcessObjectIdTable(isolate); 745 ProcessObjectIdTable(isolate);
754 } 746 }
755 Epilogue(isolate, invoke_api_callbacks); 747 Epilogue(isolate);
756 } 748 }
757 749
758 } // namespace dart 750 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/gc_marker.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698