| 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 "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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class SkippedCodeFunctions : public ZoneAllocated { | 24 class SkippedCodeFunctions : public ZoneAllocated { |
| 25 public: | 25 public: |
| 26 SkippedCodeFunctions() {} | 26 SkippedCodeFunctions() {} |
| 27 | 27 |
| 28 void Add(RawFunction* func) { | 28 void Add(RawFunction* func) { |
| 29 skipped_code_functions_.Add(func); | 29 skipped_code_functions_.Add(func); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void DetachCode() { | 32 void DetachCode() { |
| 33 #if defined(DART_PRECOMPILED_RUNTIME) |
| 34 UNREACHABLE(); |
| 35 #else |
| 33 intptr_t unoptimized_code_count = 0; | 36 intptr_t unoptimized_code_count = 0; |
| 34 intptr_t current_code_count = 0; | 37 intptr_t current_code_count = 0; |
| 35 for (int i = 0; i < skipped_code_functions_.length(); i++) { | 38 for (int i = 0; i < skipped_code_functions_.length(); i++) { |
| 36 RawFunction* func = skipped_code_functions_[i]; | 39 RawFunction* func = skipped_code_functions_[i]; |
| 37 RawCode* code = func->ptr()->code_; | 40 RawCode* code = func->ptr()->code_; |
| 38 if (!code->IsMarked()) { | 41 if (!code->IsMarked()) { |
| 39 // If the code wasn't strongly visited through other references | 42 // If the code wasn't strongly visited through other references |
| 40 // after skipping the function's code pointer, then we disconnect the | 43 // after skipping the function's code pointer, then we disconnect the |
| 41 // code from the function. | 44 // code from the function. |
| 42 func->StorePointer( | 45 func->StorePointer( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 69 } | 72 } |
| 70 } | 73 } |
| 71 } | 74 } |
| 72 if (FLAG_log_code_drop) { | 75 if (FLAG_log_code_drop) { |
| 73 THR_Print(" total detached current: %" Pd "\n", current_code_count); | 76 THR_Print(" total detached current: %" Pd "\n", current_code_count); |
| 74 THR_Print(" total detached unoptimized: %" Pd "\n", | 77 THR_Print(" total detached unoptimized: %" Pd "\n", |
| 75 unoptimized_code_count); | 78 unoptimized_code_count); |
| 76 } | 79 } |
| 77 // Clean up. | 80 // Clean up. |
| 78 skipped_code_functions_.Clear(); | 81 skipped_code_functions_.Clear(); |
| 82 #endif // !DART_PRECOMPILED_RUNTIME |
| 79 } | 83 } |
| 80 | 84 |
| 81 private: | 85 private: |
| 82 GrowableArray<RawFunction*> skipped_code_functions_; | 86 GrowableArray<RawFunction*> skipped_code_functions_; |
| 83 | 87 |
| 84 DISALLOW_COPY_AND_ASSIGN(SkippedCodeFunctions); | 88 DISALLOW_COPY_AND_ASSIGN(SkippedCodeFunctions); |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 | 91 |
| 88 class MarkerWorkList : public ValueObject { | 92 class MarkerWorkList : public ValueObject { |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 // Phase 3: Finalize results from all markers (detach code, etc.). | 795 // Phase 3: Finalize results from all markers (detach code, etc.). |
| 792 barrier.Exit(); | 796 barrier.Exit(); |
| 793 } | 797 } |
| 794 ProcessWeakTables(page_space); | 798 ProcessWeakTables(page_space); |
| 795 ProcessObjectIdTable(isolate); | 799 ProcessObjectIdTable(isolate); |
| 796 } | 800 } |
| 797 Epilogue(isolate, invoke_api_callbacks); | 801 Epilogue(isolate, invoke_api_callbacks); |
| 798 } | 802 } |
| 799 | 803 |
| 800 } // namespace dart | 804 } // namespace dart |
| OLD | NEW |