| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 // Ensure that GC will not iterate twice over the same pointer. | 634 // Ensure that GC will not iterate twice over the same pointer. |
| 635 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { | 635 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { |
| 636 CHECK(it.rinfo()->pc() != last_gc_pc); | 636 CHECK(it.rinfo()->pc() != last_gc_pc); |
| 637 last_gc_pc = it.rinfo()->pc(); | 637 last_gc_pc = it.rinfo()->pc(); |
| 638 } | 638 } |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 | 642 |
| 643 void Code::VerifyEmbeddedObjectsDependency() { | 643 void Code::VerifyEmbeddedObjectsDependency() { |
| 644 if (!CanContainWeakObjects()) return; |
| 644 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 645 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 645 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 646 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
| 646 Object* obj = it.rinfo()->target_object(); | 647 Object* obj = it.rinfo()->target_object(); |
| 647 if (IsWeakObject(obj)) { | 648 if (IsWeakObject(obj)) { |
| 648 if (obj->IsMap()) { | 649 if (obj->IsMap()) { |
| 649 Map* map = Map::cast(obj); | 650 Map* map = Map::cast(obj); |
| 650 CHECK(map->dependent_code()->Contains( | 651 DependentCode::DependencyGroup group = is_optimized_code() ? |
| 651 DependentCode::kWeaklyEmbeddedGroup, this)); | 652 DependentCode::kWeakCodeGroup : DependentCode::kWeakICGroup; |
| 653 CHECK(map->dependent_code()->Contains(group, this)); |
| 652 } else if (obj->IsJSObject()) { | 654 } else if (obj->IsJSObject()) { |
| 653 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table(); | 655 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table(); |
| 654 WeakHashTable* table = WeakHashTable::cast(raw_table); | 656 WeakHashTable* table = WeakHashTable::cast(raw_table); |
| 655 CHECK(DependentCode::cast(table->Lookup(obj))->Contains( | 657 CHECK(DependentCode::cast(table->Lookup(obj))->Contains( |
| 656 DependentCode::kWeaklyEmbeddedGroup, this)); | 658 DependentCode::kWeakCodeGroup, this)); |
| 657 } | 659 } |
| 658 } | 660 } |
| 659 } | 661 } |
| 660 } | 662 } |
| 661 | 663 |
| 662 | 664 |
| 663 void JSArray::JSArrayVerify() { | 665 void JSArray::JSArrayVerify() { |
| 664 JSObjectVerify(); | 666 JSObjectVerify(); |
| 665 CHECK(length()->IsNumber() || length()->IsUndefined()); | 667 CHECK(length()->IsNumber() || length()->IsUndefined()); |
| 666 // If a GC was caused while constructing this array, the elements | 668 // If a GC was caused while constructing this array, the elements |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 for (int i = 0; i < number_of_transitions(); ++i) { | 1161 for (int i = 0; i < number_of_transitions(); ++i) { |
| 1160 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1162 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
| 1161 } | 1163 } |
| 1162 return true; | 1164 return true; |
| 1163 } | 1165 } |
| 1164 | 1166 |
| 1165 | 1167 |
| 1166 #endif // DEBUG | 1168 #endif // DEBUG |
| 1167 | 1169 |
| 1168 } } // namespace v8::internal | 1170 } } // namespace v8::internal |
| OLD | NEW |