Chromium Code Reviews| Index: runtime/vm/gc_marker.cc |
| =================================================================== |
| --- runtime/vm/gc_marker.cc (revision 44959) |
| +++ runtime/vm/gc_marker.cc (working copy) |
| @@ -11,6 +11,7 @@ |
| #include "vm/allocation.h" |
| #include "vm/dart_api_state.h" |
| #include "vm/isolate.h" |
| +#include "vm/log.h" |
| #include "vm/pages.h" |
| #include "vm/raw_object.h" |
| #include "vm/stack_frame.h" |
| @@ -147,10 +148,14 @@ |
| bool visit_function_code() const { return visit_function_code_; } |
| - GrowableArray<RawFunction*>* skipped_code_functions() { |
| - return &skipped_code_functions_; |
| + virtual GrowableArray<RawFunction*>* skipped_current_code_functions() { |
| + return &skipped_current_code_functions_; |
|
Vyacheslav Egorov (Google)
2015/04/09 12:23:07
I think there is no reason to have two separate li
Florian Schneider
2015/04/09 14:58:43
Done.
|
| } |
| + virtual GrowableArray<RawFunction*>* skipped_unoptimized_code_functions() { |
| + return &skipped_unoptimized_code_functions_; |
| + } |
| + |
| void DelayWeakProperty(RawWeakProperty* raw_weak) { |
| RawObject* raw_key = raw_weak->ptr()->key_; |
| DelaySet::iterator it = delay_set_.find(raw_key); |
| @@ -239,8 +244,10 @@ |
| } |
| void DetachCode() { |
| - for (int i = 0; i < skipped_code_functions_.length(); i++) { |
| - RawFunction* func = skipped_code_functions_[i]; |
| + intptr_t unoptimized_code_count = 0; |
| + intptr_t current_code_count = 0; |
| + for (int i = 0; i < skipped_current_code_functions_.length(); i++) { |
| + RawFunction* func = skipped_current_code_functions_[i]; |
| RawCode* code = func->ptr()->instructions_->ptr()->code_; |
| if (!code->IsMarked()) { |
| // If the code wasn't strongly visited through other references |
| @@ -250,7 +257,6 @@ |
| func->StorePointer( |
| &(func->ptr()->instructions_), |
| stub_code->LazyCompile_entry()->code()->ptr()->instructions_); |
| - func->StorePointer(&(func->ptr()->unoptimized_code_), Code::null()); |
| if (FLAG_log_code_drop) { |
| // NOTE: This code runs while GC is in progress and runs within |
| // a NoHandleScope block. Hence it is not okay to use a regular Zone |
| @@ -260,10 +266,29 @@ |
| // helper functions to the raw object interface. |
| String name; |
| name = func->ptr()->name_; |
| - OS::Print("Detaching code: %s\n", name.ToCString()); |
| + ISL_Print("Detaching code: %s\n", name.ToCString()); |
| + current_code_count++; |
| } |
| } |
| } |
| + for (int i = 0; i < skipped_unoptimized_code_functions_.length(); i++) { |
| + RawFunction* func = skipped_unoptimized_code_functions_[i]; |
| + RawCode* code = func->ptr()->unoptimized_code_; |
| + if (!code->IsMarked()) { |
| + // If the code wasn't strongly visited through other references |
| + // after skipping the function's code pointer, then we disconnect the |
| + // code from the function. |
| + func->StorePointer(&(func->ptr()->unoptimized_code_), Code::null()); |
| + if (FLAG_log_code_drop) { |
| + unoptimized_code_count++; |
| + } |
| + } |
| + } |
| + if (FLAG_log_code_drop) { |
| + ISL_Print(" total detached current: %" Pd "\n", current_code_count); |
| + ISL_Print(" total detached unoptimized: %" Pd "\n", |
| + unoptimized_code_count); |
| + } |
| } |
| Heap* heap_; |
| @@ -276,7 +301,8 @@ |
| typedef std::pair<RawObject*, RawWeakProperty*> DelaySetEntry; |
| DelaySet delay_set_; |
| const bool visit_function_code_; |
| - GrowableArray<RawFunction*> skipped_code_functions_; |
| + GrowableArray<RawFunction*> skipped_current_code_functions_; |
| + GrowableArray<RawFunction*> skipped_unoptimized_code_functions_; |
| DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); |
| }; |