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

Unified Diff: src/objects-debug.cc

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-debug.cc
===================================================================
--- src/objects-debug.cc (revision 5696)
+++ src/objects-debug.cc (working copy)
@@ -40,31 +40,37 @@
static const char* TypeToString(InstanceType type);
-void Object::Print() {
- if (IsSmi()) {
- Smi::cast(this)->SmiPrint();
- } else if (IsFailure()) {
+void MaybeObject::Print() {
+ Object* this_as_object;
+ if (ToObject(&this_as_object)) {
+ if (this_as_object->IsSmi()) {
+ Smi::cast(this_as_object)->SmiPrint();
+ } else {
+ HeapObject::cast(this_as_object)->HeapObjectPrint();
+ }
+ } else {
Failure::cast(this)->FailurePrint();
- } else {
- HeapObject::cast(this)->HeapObjectPrint();
}
Flush();
}
-void Object::PrintLn() {
+void MaybeObject::PrintLn() {
Print();
PrintF("\n");
}
-void Object::Verify() {
- if (IsSmi()) {
- Smi::cast(this)->SmiVerify();
- } else if (IsFailure()) {
+void MaybeObject::Verify() {
+ Object* this_as_object;
+ if (ToObject(&this_as_object)) {
+ if (this_as_object->IsSmi()) {
+ Smi::cast(this_as_object)->SmiVerify();
+ } else {
+ HeapObject::cast(this_as_object)->HeapObjectVerify();
+ }
+ } else {
Failure::cast(this)->FailureVerify();
- } else {
- HeapObject::cast(this)->HeapObjectVerify();
}
}
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698