| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "objects-visiting.h" | 33 #include "objects-visiting.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 #ifdef DEBUG | 38 #ifdef DEBUG |
| 39 | 39 |
| 40 static const char* TypeToString(InstanceType type); | 40 static const char* TypeToString(InstanceType type); |
| 41 | 41 |
| 42 | 42 |
| 43 void Object::Print() { | 43 void MaybeObject::Print() { |
| 44 if (IsSmi()) { | 44 Object* this_as_object; |
| 45 Smi::cast(this)->SmiPrint(); | 45 if (ToObject(&this_as_object)) { |
| 46 } else if (IsFailure()) { | 46 if (this_as_object->IsSmi()) { |
| 47 Smi::cast(this_as_object)->SmiPrint(); |
| 48 } else { |
| 49 HeapObject::cast(this_as_object)->HeapObjectPrint(); |
| 50 } |
| 51 } else { |
| 47 Failure::cast(this)->FailurePrint(); | 52 Failure::cast(this)->FailurePrint(); |
| 48 } else { | |
| 49 HeapObject::cast(this)->HeapObjectPrint(); | |
| 50 } | 53 } |
| 51 Flush(); | 54 Flush(); |
| 52 } | 55 } |
| 53 | 56 |
| 54 | 57 |
| 55 void Object::PrintLn() { | 58 void MaybeObject::PrintLn() { |
| 56 Print(); | 59 Print(); |
| 57 PrintF("\n"); | 60 PrintF("\n"); |
| 58 } | 61 } |
| 59 | 62 |
| 60 | 63 |
| 61 void Object::Verify() { | 64 void MaybeObject::Verify() { |
| 62 if (IsSmi()) { | 65 Object* this_as_object; |
| 63 Smi::cast(this)->SmiVerify(); | 66 if (ToObject(&this_as_object)) { |
| 64 } else if (IsFailure()) { | 67 if (this_as_object->IsSmi()) { |
| 68 Smi::cast(this_as_object)->SmiVerify(); |
| 69 } else { |
| 70 HeapObject::cast(this_as_object)->HeapObjectVerify(); |
| 71 } |
| 72 } else { |
| 65 Failure::cast(this)->FailureVerify(); | 73 Failure::cast(this)->FailureVerify(); |
| 66 } else { | |
| 67 HeapObject::cast(this)->HeapObjectVerify(); | |
| 68 } | 74 } |
| 69 } | 75 } |
| 70 | 76 |
| 71 | 77 |
| 72 void Object::VerifyPointer(Object* p) { | 78 void Object::VerifyPointer(Object* p) { |
| 73 if (p->IsHeapObject()) { | 79 if (p->IsHeapObject()) { |
| 74 HeapObject::VerifyHeapPointer(p); | 80 HeapObject::VerifyHeapPointer(p); |
| 75 } else { | 81 } else { |
| 76 ASSERT(p->IsSmi()); | 82 ASSERT(p->IsSmi()); |
| 77 } | 83 } |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 ASSERT(e->IsUndefined()); | 1393 ASSERT(e->IsUndefined()); |
| 1388 } | 1394 } |
| 1389 } | 1395 } |
| 1390 } | 1396 } |
| 1391 } | 1397 } |
| 1392 | 1398 |
| 1393 | 1399 |
| 1394 #endif // DEBUG | 1400 #endif // DEBUG |
| 1395 | 1401 |
| 1396 } } // namespace v8::internal | 1402 } } // namespace v8::internal |
| OLD | NEW |