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

Unified Diff: vm/object.h

Issue 10843053: Improve the error message for handle check failure to list the actual (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.h
===================================================================
--- vm/object.h (revision 10133)
+++ vm/object.h (working copy)
@@ -62,7 +62,8 @@
reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \
initializeHandle(obj, raw_ptr); \
if (!obj->Is##object()) { \
- FATAL("Handle check failed."); \
+ FATAL2("Handle check failed: saw %s expected %s", \
+ obj->GetClassName(), #object); \
Ivan Posva 2012/08/03 20:13:10 What would happen if you used ToCString() here, in
} \
return *obj; \
} \
@@ -86,7 +87,8 @@
VMHandles::AllocateZoneHandle(isolate)); \
initializeHandle(obj, raw_ptr); \
if (!obj->Is##object()) { \
- FATAL("Handle check failed."); \
+ FATAL2("Handle check failed: saw %s expected %s", \
+ obj->GetClassName(), #object); \
} \
return *obj; \
} \
@@ -104,6 +106,7 @@
return reinterpret_cast<Raw##object*>(Object::null()); \
} \
virtual const char* ToCString() const; \
+ virtual const char* GetClassName() const { return #object; } \
static const ObjectKind kInstanceKind = k##object; \
protected: /* NOLINT */ \
object() : super() {} \
@@ -225,6 +228,9 @@
return "Object";
}
}
+ virtual const char* GetClassName() const {
+ return "Object";
+ }
bool IsNew() const { return raw()->IsNewObject(); }
bool IsOld() const { return raw()->IsOldObject(); }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698