Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1122)

Unified Diff: runtime/vm/gc_marker.cc

Issue 1067383002: VM: Enable collection of unoptimized code for optimized functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,7 +148,7 @@
bool visit_function_code() const { return visit_function_code_; }
- GrowableArray<RawFunction*>* skipped_code_functions() {
+ virtual GrowableArray<RawFunction*>* skipped_code_functions() {
return &skipped_code_functions_;
}
@@ -239,6 +240,8 @@
}
void DetachCode() {
+ intptr_t unoptimized_code_count = 0;
+ intptr_t current_code_count = 0;
for (int i = 0; i < skipped_code_functions_.length(); i++) {
RawFunction* func = skipped_code_functions_[i];
RawCode* code = func->ptr()->instructions_->ptr()->code_;
@@ -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_;
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698