| OLD | NEW |
| 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 |
| 11 #include "vm/allocation.h" | 11 #include "vm/allocation.h" |
| 12 #include "vm/dart_api_state.h" | 12 #include "vm/dart_api_state.h" |
| 13 #include "vm/isolate.h" | 13 #include "vm/isolate.h" |
| 14 #include "vm/log.h" | 14 #include "vm/log.h" |
| 15 #include "vm/pages.h" | 15 #include "vm/pages.h" |
| 16 #include "vm/raw_object.h" | 16 #include "vm/raw_object.h" |
| 17 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
| 18 #include "vm/store_buffer.h" | 18 #include "vm/store_buffer.h" |
| 19 #include "vm/thread_barrier.h" | 19 #include "vm/thread_barrier.h" |
| 20 #include "vm/thread_pool.h" | 20 #include "vm/thread_pool.h" |
| 21 #include "vm/thread_registry.h" |
| 21 #include "vm/visitor.h" | 22 #include "vm/visitor.h" |
| 22 #include "vm/object_id_ring.h" | 23 #include "vm/object_id_ring.h" |
| 23 | 24 |
| 24 namespace dart { | 25 namespace dart { |
| 25 | 26 |
| 26 DEFINE_FLAG(int, marker_tasks, 2, | 27 DEFINE_FLAG(int, marker_tasks, 2, |
| 27 "The number of tasks to spawn during old gen GC marking (0 means " | 28 "The number of tasks to spawn during old gen GC marking (0 means " |
| 28 "perform all marking on main thread)."); | 29 "perform all marking on main thread)."); |
| 29 DEFINE_FLAG(bool, log_marker_tasks, false, | 30 DEFINE_FLAG(bool, log_marker_tasks, false, |
| 30 "Log debugging information for old gen GC marking tasks."); | 31 "Log debugging information for old gen GC marking tasks."); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 478 |
| 478 private: | 479 private: |
| 479 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); | 480 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); |
| 480 }; | 481 }; |
| 481 | 482 |
| 482 | 483 |
| 483 void GCMarker::Prologue(Isolate* isolate, bool invoke_api_callbacks) { | 484 void GCMarker::Prologue(Isolate* isolate, bool invoke_api_callbacks) { |
| 484 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { | 485 if (invoke_api_callbacks && (isolate->gc_prologue_callback() != NULL)) { |
| 485 (isolate->gc_prologue_callback())(); | 486 (isolate->gc_prologue_callback())(); |
| 486 } | 487 } |
| 487 Thread::PrepareForGC(); | 488 isolate->thread_registry()->PrepareForGC(); |
| 488 // The store buffers will be rebuilt as part of marking, reset them now. | 489 // The store buffers will be rebuilt as part of marking, reset them now. |
| 489 isolate->store_buffer()->Reset(); | 490 isolate->store_buffer()->Reset(); |
| 490 } | 491 } |
| 491 | 492 |
| 492 | 493 |
| 493 void GCMarker::Epilogue(Isolate* isolate, bool invoke_api_callbacks) { | 494 void GCMarker::Epilogue(Isolate* isolate, bool invoke_api_callbacks) { |
| 494 if (invoke_api_callbacks && (isolate->gc_epilogue_callback() != NULL)) { | 495 if (invoke_api_callbacks && (isolate->gc_epilogue_callback() != NULL)) { |
| 495 (isolate->gc_epilogue_callback())(); | 496 (isolate->gc_epilogue_callback())(); |
| 496 } | 497 } |
| 497 } | 498 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 barrier.Exit(); | 741 barrier.Exit(); |
| 741 } | 742 } |
| 742 delay_set.ClearReferences(); | 743 delay_set.ClearReferences(); |
| 743 ProcessWeakTables(page_space); | 744 ProcessWeakTables(page_space); |
| 744 ProcessObjectIdTable(isolate); | 745 ProcessObjectIdTable(isolate); |
| 745 } | 746 } |
| 746 Epilogue(isolate, invoke_api_callbacks); | 747 Epilogue(isolate, invoke_api_callbacks); |
| 747 } | 748 } |
| 748 | 749 |
| 749 } // namespace dart | 750 } // namespace dart |
| OLD | NEW |