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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 it.rinfo()->Verify(); | 633 it.rinfo()->Verify(); |
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 static bool CodeListContains(Object* head, Code* code) { |
| 644 while (!head->IsUndefined()) { |
| 645 if (head == code) return true; |
| 646 head = Code::cast(head)->next_code_link(); |
| 647 } |
| 648 return false; |
| 649 } |
| 650 |
| 651 |
643 void Code::VerifyEmbeddedObjectsDependency() { | 652 void Code::VerifyEmbeddedObjectsDependency() { |
| 653 if (!CanContainWeakObjects()) return; |
644 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 654 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
645 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 655 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
646 Object* obj = it.rinfo()->target_object(); | 656 Object* obj = it.rinfo()->target_object(); |
647 if (IsWeakObject(obj)) { | 657 if (IsWeakObject(obj)) { |
648 if (obj->IsMap()) { | 658 if (obj->IsMap()) { |
649 Map* map = Map::cast(obj); | 659 Map* map = Map::cast(obj); |
650 CHECK(map->dependent_code()->Contains( | 660 if (is_optimized_code()) { |
651 DependentCode::kWeaklyEmbeddedGroup, this)); | 661 CHECK(map->dependent_code()->Contains( |
| 662 DependentCode::kWeaklyEmbeddedGroup, this)); |
| 663 } else { |
| 664 CHECK(CodeListContains(map->dependent_ic(), this)); |
| 665 } |
652 } else if (obj->IsJSObject()) { | 666 } else if (obj->IsJSObject()) { |
653 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table(); | 667 Object* raw_table = GetIsolate()->heap()->weak_object_to_code_table(); |
654 WeakHashTable* table = WeakHashTable::cast(raw_table); | 668 WeakHashTable* table = WeakHashTable::cast(raw_table); |
655 CHECK(DependentCode::cast(table->Lookup(obj))->Contains( | 669 CHECK(DependentCode::cast(table->Lookup(obj))->Contains( |
656 DependentCode::kWeaklyEmbeddedGroup, this)); | 670 DependentCode::kWeaklyEmbeddedGroup, this)); |
657 } | 671 } |
658 } | 672 } |
659 } | 673 } |
660 } | 674 } |
661 | 675 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 for (int i = 0; i < number_of_transitions(); ++i) { | 1173 for (int i = 0; i < number_of_transitions(); ++i) { |
1160 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1174 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
1161 } | 1175 } |
1162 return true; | 1176 return true; |
1163 } | 1177 } |
1164 | 1178 |
1165 | 1179 |
1166 #endif // DEBUG | 1180 #endif // DEBUG |
1167 | 1181 |
1168 } } // namespace v8::internal | 1182 } } // namespace v8::internal |
OLD | NEW |