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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1346 |
1347 // Process the weak references. | 1347 // Process the weak references. |
1348 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 1348 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
1349 Heap::ProcessWeakReferences(&mark_compact_object_retainer); | 1349 Heap::ProcessWeakReferences(&mark_compact_object_retainer); |
1350 | 1350 |
1351 // Remove object groups after marking phase. | 1351 // Remove object groups after marking phase. |
1352 GlobalHandles::RemoveObjectGroups(); | 1352 GlobalHandles::RemoveObjectGroups(); |
1353 | 1353 |
1354 // Flush code from collected candidates. | 1354 // Flush code from collected candidates. |
1355 FlushCode::ProcessCandidates(); | 1355 FlushCode::ProcessCandidates(); |
| 1356 |
| 1357 // Clean up dead objects from the runtime profiler. |
| 1358 RuntimeProfiler::RemoveDeadSamples(); |
1356 } | 1359 } |
1357 | 1360 |
1358 | 1361 |
1359 #ifdef DEBUG | 1362 #ifdef DEBUG |
1360 void MarkCompactCollector::UpdateLiveObjectCount(HeapObject* obj) { | 1363 void MarkCompactCollector::UpdateLiveObjectCount(HeapObject* obj) { |
1361 live_bytes_ += obj->Size(); | 1364 live_bytes_ += obj->Size(); |
1362 if (Heap::new_space()->Contains(obj)) { | 1365 if (Heap::new_space()->Contains(obj)) { |
1363 live_young_objects_size_ += obj->Size(); | 1366 live_young_objects_size_ += obj->Size(); |
1364 } else if (Heap::map_space()->Contains(obj)) { | 1367 } else if (Heap::map_space()->Contains(obj)) { |
1365 ASSERT(obj->IsMap()); | 1368 ASSERT(obj->IsMap()); |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 // Update pointer from the global contexts list. | 1933 // Update pointer from the global contexts list. |
1931 updating_visitor.VisitPointer(Heap::global_contexts_list_address()); | 1934 updating_visitor.VisitPointer(Heap::global_contexts_list_address()); |
1932 | 1935 |
1933 // Update pointers from external string table. | 1936 // Update pointers from external string table. |
1934 Heap::UpdateNewSpaceReferencesInExternalStringTable( | 1937 Heap::UpdateNewSpaceReferencesInExternalStringTable( |
1935 &UpdateNewSpaceReferenceInExternalStringTableEntry); | 1938 &UpdateNewSpaceReferenceInExternalStringTableEntry); |
1936 | 1939 |
1937 // All pointers were updated. Update auxiliary allocation info. | 1940 // All pointers were updated. Update auxiliary allocation info. |
1938 Heap::IncrementYoungSurvivorsCounter(survivors_size); | 1941 Heap::IncrementYoungSurvivorsCounter(survivors_size); |
1939 space->set_age_mark(space->top()); | 1942 space->set_age_mark(space->top()); |
| 1943 |
| 1944 // Update JSFunction pointers from the runtime profiler. |
| 1945 RuntimeProfiler::UpdateSamplesAfterScavenge(); |
1940 } | 1946 } |
1941 | 1947 |
1942 | 1948 |
1943 static void SweepSpace(PagedSpace* space) { | 1949 static void SweepSpace(PagedSpace* space) { |
1944 PageIterator it(space, PageIterator::PAGES_IN_USE); | 1950 PageIterator it(space, PageIterator::PAGES_IN_USE); |
1945 | 1951 |
1946 // During sweeping of paged space we are trying to find longest sequences | 1952 // During sweeping of paged space we are trying to find longest sequences |
1947 // of pages without live objects and free them (instead of putting them on | 1953 // of pages without live objects and free them (instead of putting them on |
1948 // the free list). | 1954 // the free list). |
1949 | 1955 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 } | 2534 } |
2529 }; | 2535 }; |
2530 | 2536 |
2531 | 2537 |
2532 void MarkCompactCollector::UpdatePointers() { | 2538 void MarkCompactCollector::UpdatePointers() { |
2533 #ifdef DEBUG | 2539 #ifdef DEBUG |
2534 ASSERT(state_ == ENCODE_FORWARDING_ADDRESSES); | 2540 ASSERT(state_ == ENCODE_FORWARDING_ADDRESSES); |
2535 state_ = UPDATE_POINTERS; | 2541 state_ = UPDATE_POINTERS; |
2536 #endif | 2542 #endif |
2537 UpdatingVisitor updating_visitor; | 2543 UpdatingVisitor updating_visitor; |
| 2544 RuntimeProfiler::UpdateSamplesAfterCompact(&updating_visitor); |
2538 Heap::IterateRoots(&updating_visitor, VISIT_ONLY_STRONG); | 2545 Heap::IterateRoots(&updating_visitor, VISIT_ONLY_STRONG); |
2539 GlobalHandles::IterateWeakRoots(&updating_visitor); | 2546 GlobalHandles::IterateWeakRoots(&updating_visitor); |
2540 | 2547 |
2541 // Update the pointer to the head of the weak list of global contexts. | 2548 // Update the pointer to the head of the weak list of global contexts. |
2542 updating_visitor.VisitPointer(&Heap::global_contexts_list_); | 2549 updating_visitor.VisitPointer(&Heap::global_contexts_list_); |
2543 | 2550 |
2544 LiveObjectList::IterateElements(&updating_visitor); | 2551 LiveObjectList::IterateElements(&updating_visitor); |
2545 | 2552 |
2546 int live_maps_size = IterateLiveObjects(Heap::map_space(), | 2553 int live_maps_size = IterateLiveObjects(Heap::map_space(), |
2547 &UpdatePointersInOldObject); | 2554 &UpdatePointersInOldObject); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2941 } | 2948 } |
2942 | 2949 |
2943 | 2950 |
2944 void MarkCompactCollector::Initialize() { | 2951 void MarkCompactCollector::Initialize() { |
2945 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 2952 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
2946 StaticMarkingVisitor::Initialize(); | 2953 StaticMarkingVisitor::Initialize(); |
2947 } | 2954 } |
2948 | 2955 |
2949 | 2956 |
2950 } } // namespace v8::internal | 2957 } } // namespace v8::internal |
OLD | NEW |