| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 func->ptr()->entry_point_ = entry_point; | 103 func->ptr()->entry_point_ = entry_point; |
| 104 if (FLAG_log_code_drop) { | 104 if (FLAG_log_code_drop) { |
| 105 // NOTE: This code runs while GC is in progress and runs within | 105 // NOTE: This code runs while GC is in progress and runs within |
| 106 // a NoHandleScope block. Hence it is not okay to use a regular Zone | 106 // a NoHandleScope block. Hence it is not okay to use a regular Zone |
| 107 // or Scope handle. We use a direct stack handle so the raw pointer in | 107 // or Scope handle. We use a direct stack handle so the raw pointer in |
| 108 // this handle is not traversed. The use of a handle is mainly to | 108 // this handle is not traversed. The use of a handle is mainly to |
| 109 // be able to reuse the handle based code and avoid having to add | 109 // be able to reuse the handle based code and avoid having to add |
| 110 // helper functions to the raw object interface. | 110 // helper functions to the raw object interface. |
| 111 String name; | 111 String name; |
| 112 name = func->ptr()->name_; | 112 name = func->ptr()->name_; |
| 113 ISL_Print("Detaching code: %s\n", name.ToCString()); | 113 THR_Print("Detaching code: %s\n", name.ToCString()); |
| 114 current_code_count++; | 114 current_code_count++; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 code = func->ptr()->unoptimized_code_; | 118 code = func->ptr()->unoptimized_code_; |
| 119 if (!code->IsMarked()) { | 119 if (!code->IsMarked()) { |
| 120 // If the code wasn't strongly visited through other references | 120 // If the code wasn't strongly visited through other references |
| 121 // after skipping the function's code pointer, then we disconnect the | 121 // after skipping the function's code pointer, then we disconnect the |
| 122 // code from the function. | 122 // code from the function. |
| 123 func->StorePointer(&(func->ptr()->unoptimized_code_), Code::null()); | 123 func->StorePointer(&(func->ptr()->unoptimized_code_), Code::null()); |
| 124 if (FLAG_log_code_drop) { | 124 if (FLAG_log_code_drop) { |
| 125 unoptimized_code_count++; | 125 unoptimized_code_count++; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 if (FLAG_log_code_drop) { | 129 if (FLAG_log_code_drop) { |
| 130 ISL_Print(" total detached current: %" Pd "\n", current_code_count); | 130 THR_Print(" total detached current: %" Pd "\n", current_code_count); |
| 131 ISL_Print(" total detached unoptimized: %" Pd "\n", | 131 THR_Print(" total detached unoptimized: %" Pd "\n", |
| 132 unoptimized_code_count); | 132 unoptimized_code_count); |
| 133 } | 133 } |
| 134 // Clean up. | 134 // Clean up. |
| 135 skipped_code_functions_.Clear(); | 135 skipped_code_functions_.Clear(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 GrowableArray<RawFunction*> skipped_code_functions_; | 139 GrowableArray<RawFunction*> skipped_code_functions_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(SkippedCodeFunctions); | 141 DISALLOW_COPY_AND_ASSIGN(SkippedCodeFunctions); |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 MainSync(num_tasks); | 693 MainSync(num_tasks); |
| 694 // Phase 2: Weak processing and follow-up marking on main thread. | 694 // Phase 2: Weak processing and follow-up marking on main thread. |
| 695 SkippedCodeFunctions* skipped_code_functions = | 695 SkippedCodeFunctions* skipped_code_functions = |
| 696 collect_code ? new(zone) SkippedCodeFunctions() : NULL; | 696 collect_code ? new(zone) SkippedCodeFunctions() : NULL; |
| 697 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack, | 697 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack, |
| 698 &delay_set, skipped_code_functions); | 698 &delay_set, skipped_code_functions); |
| 699 IterateWeakReferences(isolate, &mark); | 699 IterateWeakReferences(isolate, &mark); |
| 700 MarkingWeakVisitor mark_weak; | 700 MarkingWeakVisitor mark_weak; |
| 701 IterateWeakRoots(isolate, &mark_weak, | 701 IterateWeakRoots(isolate, &mark_weak, |
| 702 !visit_prologue_weak_persistent_handles); | 702 !visit_prologue_weak_persistent_handles); |
| 703 // TODO(koda): Move this into Phase 3 after making ISL_Print thread-safe | |
| 704 // (used in SkippedCodeFunctions::DetachCode). | |
| 705 FinalizeResultsFrom(&mark); | |
| 706 MainSync(num_tasks); | 703 MainSync(num_tasks); |
| 707 // Phase 3: Finalize results from all markers (detach code, etc.). | 704 // Phase 3: Finalize results from all markers (detach code, etc.). |
| 705 FinalizeResultsFrom(&mark); |
| 708 MainSync(num_tasks); | 706 MainSync(num_tasks); |
| 709 // Finalization complete and all tasks exited. | 707 // Finalization complete and all tasks exited. |
| 710 } | 708 } |
| 711 delay_set.ClearReferences(); | 709 delay_set.ClearReferences(); |
| 712 ProcessWeakTables(page_space); | 710 ProcessWeakTables(page_space); |
| 713 ProcessObjectIdTable(isolate); | 711 ProcessObjectIdTable(isolate); |
| 714 } | 712 } |
| 715 Epilogue(isolate, invoke_api_callbacks); | 713 Epilogue(isolate, invoke_api_callbacks); |
| 716 } | 714 } |
| 717 | 715 |
| 718 } // namespace dart | 716 } // namespace dart |
| OLD | NEW |