| 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 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 1510 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
| 1511 Heap::ProcessWeakReferences(&mark_compact_object_retainer); | 1511 Heap::ProcessWeakReferences(&mark_compact_object_retainer); |
| 1512 | 1512 |
| 1513 // Remove object groups after marking phase. | 1513 // Remove object groups after marking phase. |
| 1514 GlobalHandles::RemoveObjectGroups(); | 1514 GlobalHandles::RemoveObjectGroups(); |
| 1515 | 1515 |
| 1516 // Flush code from collected candidates. | 1516 // Flush code from collected candidates. |
| 1517 if (FLAG_flush_code) { | 1517 if (FLAG_flush_code) { |
| 1518 FlushCode::ProcessCandidates(); | 1518 FlushCode::ProcessCandidates(); |
| 1519 } | 1519 } |
| 1520 |
| 1521 // Clean up dead objects from the runtime profiler. |
| 1522 RuntimeProfiler::RemoveDeadSamples(); |
| 1520 } | 1523 } |
| 1521 | 1524 |
| 1522 | 1525 |
| 1523 #ifdef DEBUG | 1526 #ifdef DEBUG |
| 1524 void MarkCompactCollector::UpdateLiveObjectCount(HeapObject* obj) { | 1527 void MarkCompactCollector::UpdateLiveObjectCount(HeapObject* obj) { |
| 1525 live_bytes_ += obj->Size(); | 1528 live_bytes_ += obj->Size(); |
| 1526 if (Heap::new_space()->Contains(obj)) { | 1529 if (Heap::new_space()->Contains(obj)) { |
| 1527 live_young_objects_size_ += obj->Size(); | 1530 live_young_objects_size_ += obj->Size(); |
| 1528 } else if (Heap::map_space()->Contains(obj)) { | 1531 } else if (Heap::map_space()->Contains(obj)) { |
| 1529 ASSERT(obj->IsMap()); | 1532 ASSERT(obj->IsMap()); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 // Update pointer from the global contexts list. | 1847 // Update pointer from the global contexts list. |
| 1845 updating_visitor.VisitPointer(Heap::global_contexts_list_address()); | 1848 updating_visitor.VisitPointer(Heap::global_contexts_list_address()); |
| 1846 | 1849 |
| 1847 // Update pointers from external string table. | 1850 // Update pointers from external string table. |
| 1848 Heap::UpdateNewSpaceReferencesInExternalStringTable( | 1851 Heap::UpdateNewSpaceReferencesInExternalStringTable( |
| 1849 &UpdateNewSpaceReferenceInExternalStringTableEntry); | 1852 &UpdateNewSpaceReferenceInExternalStringTableEntry); |
| 1850 | 1853 |
| 1851 // All pointers were updated. Update auxiliary allocation info. | 1854 // All pointers were updated. Update auxiliary allocation info. |
| 1852 Heap::IncrementYoungSurvivorsCounter(survivors_size); | 1855 Heap::IncrementYoungSurvivorsCounter(survivors_size); |
| 1853 space->set_age_mark(space->top()); | 1856 space->set_age_mark(space->top()); |
| 1857 |
| 1858 // Update JSFunction pointers from the runtime profiler. |
| 1859 RuntimeProfiler::UpdateSamplesAfterScavenge(); |
| 1854 } | 1860 } |
| 1855 | 1861 |
| 1856 | 1862 |
| 1857 INLINE(static uint32_t SweepFree(PagedSpace* space, | 1863 INLINE(static uint32_t SweepFree(PagedSpace* space, |
| 1858 Page* p, | 1864 Page* p, |
| 1859 uint32_t free_start, | 1865 uint32_t free_start, |
| 1860 uint32_t region_end, | 1866 uint32_t region_end, |
| 1861 uint32_t* cells)); | 1867 uint32_t* cells)); |
| 1862 | 1868 |
| 1863 | 1869 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2236 | 2242 |
| 2237 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { | 2243 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { |
| 2238 #ifdef ENABLE_GDB_JIT_INTERFACE | 2244 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 2239 if (obj->IsCode()) { | 2245 if (obj->IsCode()) { |
| 2240 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); | 2246 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); |
| 2241 } | 2247 } |
| 2242 #endif | 2248 #endif |
| 2243 #ifdef ENABLE_LOGGING_AND_PROFILING | 2249 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 2244 if (obj->IsCode()) { | 2250 if (obj->IsCode()) { |
| 2245 PROFILE(CodeDeleteEvent(obj->address())); | 2251 PROFILE(CodeDeleteEvent(obj->address())); |
| 2246 } else if (obj->IsJSFunction()) { | |
| 2247 // TODO(gc): we are sweeping old pointer space conservatively thus | |
| 2248 // we can't notify attached profiler about death of functions. | |
| 2249 // Consider disabling conservative sweeping when profiler | |
| 2250 // is enabled. | |
| 2251 PROFILE(FunctionDeleteEvent(obj->address())); | |
| 2252 } | 2252 } |
| 2253 #endif | 2253 #endif |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 | 2256 |
| 2257 void MarkCompactCollector::Initialize() { | 2257 void MarkCompactCollector::Initialize() { |
| 2258 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 2258 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
| 2259 StaticMarkingVisitor::Initialize(); | 2259 StaticMarkingVisitor::Initialize(); |
| 2260 } | 2260 } |
| 2261 | 2261 |
| 2262 | 2262 |
| 2263 } } // namespace v8::internal | 2263 } } // namespace v8::internal |
| OLD | NEW |