| Index: runtime/vm/raw_object.cc
|
| ===================================================================
|
| --- runtime/vm/raw_object.cc (revision 30197)
|
| +++ runtime/vm/raw_object.cc (working copy)
|
| @@ -366,9 +366,36 @@
|
| }
|
|
|
|
|
| +bool RawFunction::MayTrySkippingCode(RawFunction* raw_fun) {
|
| + Function fn;
|
| + fn = raw_fun;
|
| +
|
| + Code code;
|
| + code = fn.CurrentCode();
|
| +
|
| + // TODO(zra): If we would return true here, instead halve the usage counter,
|
| + // and return true only if the counter is then zero. Otherwise
|
| + // return false. For now, while testing, always skip the function's
|
| + // code pointer when usage_counter > 0.
|
| +
|
| + return fn.HasCode() && // Not already detached.
|
| + !code.is_optimized() &&
|
| + !fn.HasBreakpoint() &&
|
| + (fn.usage_counter() > 0);
|
| +}
|
| +
|
| +
|
| intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj,
|
| ObjectPointerVisitor* visitor) {
|
| - visitor->VisitPointers(raw_obj->from(), raw_obj->to());
|
| + if (visitor->visit_function_code() ||
|
| + !RawFunction::MayTrySkippingCode(raw_obj)) {
|
| + visitor->VisitPointers(raw_obj->from(), raw_obj->to());
|
| + } 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());
|
| + }
|
| return Function::InstanceSize();
|
| }
|
|
|
|
|