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

Unified Diff: runtime/vm/raw_object.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
Index: runtime/vm/raw_object.cc
===================================================================
--- runtime/vm/raw_object.cc (revision 44959)
+++ runtime/vm/raw_object.cc (working copy)
@@ -413,7 +413,7 @@
}
-bool RawFunction::SkipCode(RawFunction* raw_fun) {
+bool RawFunction::SkipCode(RawFunction* raw_fun, bool visit_current_code) {
Vyacheslav Egorov (Google) 2015/04/09 12:23:08 The name is *very* confusing. Rename it do somethi
Florian Schneider 2015/04/09 14:48:38 Done.
// NOTE: This code runs while GC is in progress and runs within
// a NoHandleScope block. Hence it is not okay to use regular Zone or
// Scope handles. We use direct stack handles, and so the raw pointers in
@@ -424,12 +424,15 @@
fn = raw_fun;
Code code;
- code = fn.CurrentCode();
+ if (visit_current_code) {
+ code = fn.CurrentCode();
+ } else {
+ code = fn.unoptimized_code();
+ }
if (fn.HasCode() && // The function may not have code.
!fn.is_intrinsic() && // These may not increment the usage counter.
- !code.is_optimized() &&
- (fn.CurrentCode() == fn.unoptimized_code()) &&
+ (!visit_current_code || !code.is_optimized()) &&
!code.HasBreakpoint() &&
(fn.usage_counter() >= 0)) {
fn.set_usage_counter(fn.usage_counter() / 2);
@@ -443,15 +446,20 @@
intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj,
ObjectPointerVisitor* visitor) {
- if (visitor->visit_function_code() ||
- !RawFunction::SkipCode(raw_obj)) {
- visitor->VisitPointers(raw_obj->from(), raw_obj->to());
+ visitor->VisitPointers(raw_obj->from(), raw_obj->to_no_code());
+ if (visitor->visit_function_code() || !SkipCode(raw_obj, true)) {
Vyacheslav Egorov (Google) 2015/04/09 12:23:08 I think bool parameter is a bit confusing. Maybe p
Florian Schneider 2015/04/09 14:48:38 Done.
+ visitor->VisitPointer(
+ reinterpret_cast<RawObject**>(&raw_obj->ptr()->instructions_));
} else {
- GrowableArray<RawFunction*>* sfga = visitor->skipped_code_functions();
- ASSERT(sfga != NULL);
- sfga->Add(raw_obj);
- visitor->VisitPointers(raw_obj->from(), raw_obj->to_no_code());
+ visitor->skipped_current_code_functions()->Add(raw_obj);
}
+
+ if (visitor->visit_function_code() || !SkipCode(raw_obj, false)) {
Vyacheslav Egorov (Google) 2015/04/09 12:23:08 we decay fn.usage_counter() twice. I think it shou
Florian Schneider 2015/04/09 14:48:38 Done.
+ visitor->VisitPointer(
+ reinterpret_cast<RawObject**>(&raw_obj->ptr()->unoptimized_code_));
+ } else {
+ visitor->skipped_unoptimized_code_functions()->Add(raw_obj);
+ }
return Function::InstanceSize();
}
« runtime/vm/object.cc ('K') | « runtime/vm/raw_object.h ('k') | runtime/vm/visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698