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

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

Issue 1703383002: - Do not repeatedly allocate and release Monitor objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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 <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 collect_code ? new(zone) SkippedCodeFunctions() : NULL; 706 collect_code ? new(zone) SkippedCodeFunctions() : NULL;
707 UnsyncMarkingVisitor mark(isolate, heap_, page_space, &marking_stack, 707 UnsyncMarkingVisitor mark(isolate, heap_, page_space, &marking_stack,
708 &delay_set, skipped_code_functions); 708 &delay_set, skipped_code_functions);
709 IterateRoots(isolate, &mark, 0, 1); 709 IterateRoots(isolate, &mark, 0, 1);
710 mark.DrainMarkingStack(); 710 mark.DrainMarkingStack();
711 MarkingWeakVisitor mark_weak; 711 MarkingWeakVisitor mark_weak;
712 IterateWeakRoots(isolate, &mark_weak); 712 IterateWeakRoots(isolate, &mark_weak);
713 // All marking done; detach code, etc. 713 // All marking done; detach code, etc.
714 FinalizeResultsFrom(&mark); 714 FinalizeResultsFrom(&mark);
715 } else { 715 } else {
716 ThreadBarrier barrier(num_tasks + 1); 716 ThreadBarrier barrier(num_tasks + 1,
717 heap_->barrier(),
718 heap_->barrier_done());
717 // Used to coordinate draining among tasks; all start out as 'busy'. 719 // Used to coordinate draining among tasks; all start out as 'busy'.
718 uintptr_t num_busy = num_tasks; 720 uintptr_t num_busy = num_tasks;
719 // Phase 1: Iterate over roots and drain marking stack in tasks. 721 // Phase 1: Iterate over roots and drain marking stack in tasks.
720 for (intptr_t i = 0; i < num_tasks; ++i) { 722 for (intptr_t i = 0; i < num_tasks; ++i) {
721 MarkTask* mark_task = 723 MarkTask* mark_task =
722 new MarkTask(this, isolate, heap_, page_space, &marking_stack, 724 new MarkTask(this, isolate, heap_, page_space, &marking_stack,
723 &delay_set, &barrier, collect_code, 725 &delay_set, &barrier, collect_code,
724 i, num_tasks, &num_busy); 726 i, num_tasks, &num_busy);
725 ThreadPool* pool = Dart::thread_pool(); 727 ThreadPool* pool = Dart::thread_pool();
726 pool->Run(mark_task); 728 pool->Run(mark_task);
(...skipping 18 matching lines...) Expand all
745 barrier.Exit(); 747 barrier.Exit();
746 } 748 }
747 delay_set.ClearReferences(); 749 delay_set.ClearReferences();
748 ProcessWeakTables(page_space); 750 ProcessWeakTables(page_space);
749 ProcessObjectIdTable(isolate); 751 ProcessObjectIdTable(isolate);
750 } 752 }
751 Epilogue(isolate, invoke_api_callbacks); 753 Epilogue(isolate, invoke_api_callbacks);
752 } 754 }
753 755
754 } // namespace dart 756 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698