Index: runtime/vm/gc_marker.cc |
=================================================================== |
--- runtime/vm/gc_marker.cc (revision 44996) |
+++ 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,8 +148,8 @@ |
bool visit_function_code() const { return visit_function_code_; } |
- GrowableArray<RawFunction*>* skipped_code_functions() { |
- return &skipped_code_functions_; |
+ virtual GrowableArray<RawFunction*>* skipped_functions() { |
+ return &skipped_functions_; |
} |
void DelayWeakProperty(RawWeakProperty* raw_weak) { |
@@ -239,8 +240,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_functions_.length(); i++) { |
+ RawFunction* func = skipped_functions_[i]; |
RawCode* code = func->ptr()->instructions_->ptr()->code_; |
if (!code->IsMarked()) { |
// If the code wasn't strongly visited through other references |
@@ -250,7 +253,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 +262,27 @@ |
// 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++; |
} |
} |
+ |
+ 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 +295,7 @@ |
typedef std::pair<RawObject*, RawWeakProperty*> DelaySetEntry; |
DelaySet delay_set_; |
const bool visit_function_code_; |
- GrowableArray<RawFunction*> skipped_code_functions_; |
+ GrowableArray<RawFunction*> skipped_functions_; |
Vyacheslav Egorov (Google)
2015/04/09 15:03:46
I think the old name was better. We skipped visiti
Florian Schneider
2015/04/09 15:07:50
Done.
|
DISALLOW_IMPLICIT_CONSTRUCTORS(MarkingVisitor); |
}; |