| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "disassembler.h" | 7 #include "disassembler.h" |
| 8 #include "disasm.h" | 8 #include "disasm.h" |
| 9 #include "jsregexp.h" | 9 #include "jsregexp.h" |
| 10 #include "macro-assembler.h" | 10 #include "macro-assembler.h" |
| 11 #include "objects-visiting.h" | 11 #include "objects-visiting.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 #ifdef VERIFY_HEAP | 16 #ifdef VERIFY_HEAP |
| 17 | 17 |
| 18 void MaybeObject::Verify() { | |
| 19 Object* this_as_object; | |
| 20 if (ToObject(&this_as_object)) { | |
| 21 this_as_object->ObjectVerify(); | |
| 22 } else { | |
| 23 Failure::cast(this)->FailureVerify(); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 | |
| 28 void Object::ObjectVerify() { | 18 void Object::ObjectVerify() { |
| 29 if (IsSmi()) { | 19 if (IsSmi()) { |
| 30 Smi::cast(this)->SmiVerify(); | 20 Smi::cast(this)->SmiVerify(); |
| 31 } else { | 21 } else { |
| 32 HeapObject::cast(this)->HeapObjectVerify(); | 22 HeapObject::cast(this)->HeapObjectVerify(); |
| 33 } | 23 } |
| 34 } | 24 } |
| 35 | 25 |
| 36 | 26 |
| 37 void Object::VerifyPointer(Object* p) { | 27 void Object::VerifyPointer(Object* p) { |
| 38 if (p->IsHeapObject()) { | 28 if (p->IsHeapObject()) { |
| 39 HeapObject::VerifyHeapPointer(p); | 29 HeapObject::VerifyHeapPointer(p); |
| 40 } else { | 30 } else { |
| 41 CHECK(p->IsSmi()); | 31 CHECK(p->IsSmi()); |
| 42 } | 32 } |
| 43 } | 33 } |
| 44 | 34 |
| 45 | 35 |
| 46 void Smi::SmiVerify() { | 36 void Smi::SmiVerify() { |
| 47 CHECK(IsSmi()); | 37 CHECK(IsSmi()); |
| 48 } | 38 } |
| 49 | 39 |
| 50 | 40 |
| 51 void Failure::FailureVerify() { | |
| 52 CHECK(IsFailure()); | |
| 53 } | |
| 54 | |
| 55 | |
| 56 void HeapObject::HeapObjectVerify() { | 41 void HeapObject::HeapObjectVerify() { |
| 57 InstanceType instance_type = map()->instance_type(); | 42 InstanceType instance_type = map()->instance_type(); |
| 58 | 43 |
| 59 if (instance_type < FIRST_NONSTRING_TYPE) { | 44 if (instance_type < FIRST_NONSTRING_TYPE) { |
| 60 String::cast(this)->StringVerify(); | 45 String::cast(this)->StringVerify(); |
| 61 return; | 46 return; |
| 62 } | 47 } |
| 63 | 48 |
| 64 switch (instance_type) { | 49 switch (instance_type) { |
| 65 case SYMBOL_TYPE: | 50 case SYMBOL_TYPE: |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 for (int i = 0; i < number_of_transitions(); ++i) { | 1191 for (int i = 0; i < number_of_transitions(); ++i) { |
| 1207 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1192 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
| 1208 } | 1193 } |
| 1209 return true; | 1194 return true; |
| 1210 } | 1195 } |
| 1211 | 1196 |
| 1212 | 1197 |
| 1213 #endif // DEBUG | 1198 #endif // DEBUG |
| 1214 | 1199 |
| 1215 } } // namespace v8::internal | 1200 } } // namespace v8::internal |
| OLD | NEW |