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

Unified Diff: runtime/vm/pages.cc

Issue 48833004: Modifies assertion for possibly null code pointer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
===================================================================
--- runtime/vm/pages.cc (revision 29395)
+++ runtime/vm/pages.cc (working copy)
@@ -384,7 +384,6 @@
}
-
class CodeDetacherVisitor : public ObjectVisitor {
public:
explicit CodeDetacherVisitor(Isolate* isolate) : ObjectVisitor(isolate) { }
@@ -392,20 +391,26 @@
virtual void VisitObject(RawObject* obj);
private:
+ static bool MayDetachCode(const Function& fn);
DISALLOW_COPY_AND_ASSIGN(CodeDetacherVisitor);
};
+bool CodeDetacherVisitor::MayDetachCode(const Function& fn) {
+ return fn.HasCode() && // Not already detached.
+ !fn.HasOptimizedCode() &&
+ !fn.HasBreakpoint() &&
+ (fn.usage_counter() > 0);
+}
+
+
void CodeDetacherVisitor::VisitObject(RawObject* raw_obj) {
Isolate* isolate = Isolate::Current();
HANDLESCOPE(isolate);
const Object& obj = Object::Handle(raw_obj);
if (obj.GetClassId() == kFunctionCid) {
const Function& fn = Function::Cast(obj);
- if (!fn.HasOptimizedCode() &&
- !fn.HasBreakpoint() &&
- fn.HasCode() && // Not already detached.
- (fn.usage_counter() > 0)) {
+ if (CodeDetacherVisitor::MayDetachCode(fn)) {
fn.set_usage_counter(fn.usage_counter() / 2);
if (fn.usage_counter() == 0) {
if (FLAG_log_code_drop) {
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698