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 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 ASSERT(ring != NULL); | 494 ASSERT(ring != NULL); |
495 ring->VisitPointers(&visitor); | 495 ring->VisitPointers(&visitor); |
496 } | 496 } |
497 | 497 |
498 | 498 |
499 void GCMarker::MarkObjects(Isolate* isolate, | 499 void GCMarker::MarkObjects(Isolate* isolate, |
500 PageSpace* page_space, | 500 PageSpace* page_space, |
501 bool invoke_api_callbacks, | 501 bool invoke_api_callbacks, |
502 bool collect_code) { | 502 bool collect_code) { |
503 const bool visit_function_code = !collect_code; | 503 const bool visit_function_code = !collect_code; |
504 MarkingStack marking_stack; | |
505 Prologue(isolate, invoke_api_callbacks); | 504 Prologue(isolate, invoke_api_callbacks); |
506 MarkingVisitor mark( | 505 // The API prologue/epilogue may create/destroy zones, so we must not |
507 isolate, heap_, page_space, &marking_stack, visit_function_code); | 506 // depend on zone allocations surviving beyond the epilogue callback. |
508 IterateRoots(isolate, &mark, !invoke_api_callbacks); | 507 { |
509 DrainMarkingStack(isolate, &mark); | 508 StackZone zone(isolate); |
510 IterateWeakReferences(isolate, &mark); | 509 MarkingStack marking_stack; |
511 MarkingWeakVisitor mark_weak; | 510 MarkingVisitor mark( |
512 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 511 isolate, heap_, page_space, &marking_stack, visit_function_code); |
513 mark.Finalize(); | 512 IterateRoots(isolate, &mark, !invoke_api_callbacks); |
514 ProcessWeakTables(page_space); | 513 DrainMarkingStack(isolate, &mark); |
515 ProcessObjectIdTable(isolate); | 514 IterateWeakReferences(isolate, &mark); |
516 | 515 MarkingWeakVisitor mark_weak; |
| 516 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 517 mark.Finalize(); |
| 518 ProcessWeakTables(page_space); |
| 519 ProcessObjectIdTable(isolate); |
| 520 } |
517 Epilogue(isolate, invoke_api_callbacks); | 521 Epilogue(isolate, invoke_api_callbacks); |
518 } | 522 } |
519 | 523 |
520 } // namespace dart | 524 } // namespace dart |
OLD | NEW |