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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 // Perform space-specific object verification. | 820 // Perform space-specific object verification. |
821 VerifyObject(object); | 821 VerifyObject(object); |
822 | 822 |
823 // The object itself should look OK. | 823 // The object itself should look OK. |
824 object->Verify(); | 824 object->Verify(); |
825 | 825 |
826 // All the interior pointers should be contained in the heap and | 826 // All the interior pointers should be contained in the heap and |
827 // have their remembered set bits set if required as determined | 827 // have their remembered set bits set if required as determined |
828 // by the visitor. | 828 // by the visitor. |
829 int size = object->Size(); | 829 int size = object->Size(); |
830 if (object->IsCode()) { | 830 object->IterateBody(map->instance_type(), size, visitor); |
831 Code::cast(object)->ConvertICTargetsFromAddressToObject(); | |
832 object->IterateBody(map->instance_type(), size, visitor); | |
833 Code::cast(object)->ConvertICTargetsFromObjectToAddress(); | |
834 } else { | |
835 object->IterateBody(map->instance_type(), size, visitor); | |
836 } | |
837 | 831 |
838 current += size; | 832 current += size; |
839 } | 833 } |
840 | 834 |
841 // The allocation pointer should not be in the middle of an object. | 835 // The allocation pointer should not be in the middle of an object. |
842 ASSERT(current == top); | 836 ASSERT(current == top); |
843 } | 837 } |
844 | 838 |
845 current_page = current_page->next_page(); | 839 current_page = current_page->next_page(); |
846 } | 840 } |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 PageIterator page_it(this, PageIterator::PAGES_IN_USE); | 1893 PageIterator page_it(this, PageIterator::PAGES_IN_USE); |
1900 while (page_it.has_next()) { | 1894 while (page_it.has_next()) { |
1901 Page* p = page_it.next(); | 1895 Page* p = page_it.next(); |
1902 | 1896 |
1903 for (Address rset_addr = p->RSetStart(); | 1897 for (Address rset_addr = p->RSetStart(); |
1904 rset_addr < p->RSetEnd(); | 1898 rset_addr < p->RSetEnd(); |
1905 rset_addr += kIntSize) { | 1899 rset_addr += kIntSize) { |
1906 int rset = Memory::int_at(rset_addr); | 1900 int rset = Memory::int_at(rset_addr); |
1907 if (rset != 0) { | 1901 if (rset != 0) { |
1908 // Bits were set | 1902 // Bits were set |
1909 int intoff = rset_addr - p->address(); | 1903 int intoff = rset_addr - p->address() - Page::kRSetOffset; |
1910 int bitoff = 0; | 1904 int bitoff = 0; |
1911 for (; bitoff < kBitsPerInt; ++bitoff) { | 1905 for (; bitoff < kBitsPerInt; ++bitoff) { |
1912 if ((rset & (1 << bitoff)) != 0) { | 1906 if ((rset & (1 << bitoff)) != 0) { |
1913 int bitpos = intoff*kBitsPerByte + bitoff; | 1907 int bitpos = intoff*kBitsPerByte + bitoff; |
1914 Address slot = p->OffsetToAddress(bitpos << kObjectAlignmentBits); | 1908 Address slot = p->OffsetToAddress(bitpos << kObjectAlignmentBits); |
1915 Object** obj = reinterpret_cast<Object**>(slot); | 1909 Object** obj = reinterpret_cast<Object**>(slot); |
1916 if (*obj == Heap::raw_unchecked_fixed_array_map()) { | 1910 if (*obj == Heap::raw_unchecked_fixed_array_map()) { |
1917 rset_marked_arrays++; | 1911 rset_marked_arrays++; |
1918 FixedArray* fa = FixedArray::cast(HeapObject::FromAddress(slot)); | 1912 FixedArray* fa = FixedArray::cast(HeapObject::FromAddress(slot)); |
1919 | 1913 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 PageIterator page_it(this, PageIterator::PAGES_IN_USE); | 2158 PageIterator page_it(this, PageIterator::PAGES_IN_USE); |
2165 while (page_it.has_next()) { | 2159 while (page_it.has_next()) { |
2166 Page* p = page_it.next(); | 2160 Page* p = page_it.next(); |
2167 | 2161 |
2168 for (Address rset_addr = p->RSetStart(); | 2162 for (Address rset_addr = p->RSetStart(); |
2169 rset_addr < p->RSetEnd(); | 2163 rset_addr < p->RSetEnd(); |
2170 rset_addr += kIntSize) { | 2164 rset_addr += kIntSize) { |
2171 int rset = Memory::int_at(rset_addr); | 2165 int rset = Memory::int_at(rset_addr); |
2172 if (rset != 0) { | 2166 if (rset != 0) { |
2173 // Bits were set | 2167 // Bits were set |
2174 int intoff = rset_addr - p->address(); | 2168 int intoff = rset_addr - p->address() - Page::kRSetOffset; |
2175 int bitoff = 0; | 2169 int bitoff = 0; |
2176 for (; bitoff < kBitsPerInt; ++bitoff) { | 2170 for (; bitoff < kBitsPerInt; ++bitoff) { |
2177 if ((rset & (1 << bitoff)) != 0) { | 2171 if ((rset & (1 << bitoff)) != 0) { |
2178 int bitpos = intoff*kBitsPerByte + bitoff; | 2172 int bitpos = intoff*kBitsPerByte + bitoff; |
2179 Address slot = p->OffsetToAddress(bitpos << kObjectAlignmentBits); | 2173 Address slot = p->OffsetToAddress(bitpos << kObjectAlignmentBits); |
2180 Object** obj = reinterpret_cast<Object**>(slot); | 2174 Object** obj = reinterpret_cast<Object**>(slot); |
2181 rset_marked_pointers++; | 2175 rset_marked_pointers++; |
2182 if (Heap::InNewSpace(*obj)) | 2176 if (Heap::InNewSpace(*obj)) |
2183 cross_gen_pointers++; | 2177 cross_gen_pointers++; |
2184 } | 2178 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 ASSERT(object->IsCode() || object->IsSeqString() || | 2561 ASSERT(object->IsCode() || object->IsSeqString() || |
2568 object->IsExternalString() || object->IsFixedArray() || | 2562 object->IsExternalString() || object->IsFixedArray() || |
2569 object->IsByteArray()); | 2563 object->IsByteArray()); |
2570 | 2564 |
2571 // The object itself should look OK. | 2565 // The object itself should look OK. |
2572 object->Verify(); | 2566 object->Verify(); |
2573 | 2567 |
2574 // Byte arrays and strings don't have interior pointers. | 2568 // Byte arrays and strings don't have interior pointers. |
2575 if (object->IsCode()) { | 2569 if (object->IsCode()) { |
2576 VerifyPointersVisitor code_visitor; | 2570 VerifyPointersVisitor code_visitor; |
2577 Code::cast(object)->ConvertICTargetsFromAddressToObject(); | |
2578 object->IterateBody(map->instance_type(), | 2571 object->IterateBody(map->instance_type(), |
2579 object->Size(), | 2572 object->Size(), |
2580 &code_visitor); | 2573 &code_visitor); |
2581 Code::cast(object)->ConvertICTargetsFromObjectToAddress(); | |
2582 } else if (object->IsFixedArray()) { | 2574 } else if (object->IsFixedArray()) { |
2583 // We loop over fixed arrays ourselves, rather then using the visitor, | 2575 // We loop over fixed arrays ourselves, rather then using the visitor, |
2584 // because the visitor doesn't support the start/offset iteration | 2576 // because the visitor doesn't support the start/offset iteration |
2585 // needed for IsRSetSet. | 2577 // needed for IsRSetSet. |
2586 FixedArray* array = FixedArray::cast(object); | 2578 FixedArray* array = FixedArray::cast(object); |
2587 for (int j = 0; j < array->length(); j++) { | 2579 for (int j = 0; j < array->length(); j++) { |
2588 Object* element = array->get(j); | 2580 Object* element = array->get(j); |
2589 if (element->IsHeapObject()) { | 2581 if (element->IsHeapObject()) { |
2590 HeapObject* element_object = HeapObject::cast(element); | 2582 HeapObject* element_object = HeapObject::cast(element); |
2591 ASSERT(Heap::Contains(element_object)); | 2583 ASSERT(Heap::Contains(element_object)); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2658 reinterpret_cast<Object**>(object->address() | 2650 reinterpret_cast<Object**>(object->address() |
2659 + Page::kObjectAreaSize), | 2651 + Page::kObjectAreaSize), |
2660 allocation_top); | 2652 allocation_top); |
2661 PrintF("\n"); | 2653 PrintF("\n"); |
2662 } | 2654 } |
2663 } | 2655 } |
2664 } | 2656 } |
2665 #endif // DEBUG | 2657 #endif // DEBUG |
2666 | 2658 |
2667 } } // namespace v8::internal | 2659 } } // namespace v8::internal |
OLD | NEW |