Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: src/heap/heap.cc

Issue 890613002: Introduce ProcessYoungWeakReferences and process weak list of allocation sites just during full GCs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); 1590 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1591 1591
1592 UpdateNewSpaceReferencesInExternalStringTable( 1592 UpdateNewSpaceReferencesInExternalStringTable(
1593 &UpdateNewSpaceReferenceInExternalStringTableEntry); 1593 &UpdateNewSpaceReferenceInExternalStringTableEntry);
1594 1594
1595 promotion_queue_.Destroy(); 1595 promotion_queue_.Destroy();
1596 1596
1597 incremental_marking()->UpdateMarkingDequeAfterScavenge(); 1597 incremental_marking()->UpdateMarkingDequeAfterScavenge();
1598 1598
1599 ScavengeWeakObjectRetainer weak_object_retainer(this); 1599 ScavengeWeakObjectRetainer weak_object_retainer(this);
1600 ProcessWeakReferences(&weak_object_retainer); 1600 ProcessYoungWeakReferences(&weak_object_retainer);
1601 1601
1602 DCHECK(new_space_front == new_space_.top()); 1602 DCHECK(new_space_front == new_space_.top());
1603 1603
1604 // Set age mark. 1604 // Set age mark.
1605 new_space_.set_age_mark(new_space_.top()); 1605 new_space_.set_age_mark(new_space_.top());
1606 1606
1607 new_space_.LowerInlineAllocationLimit( 1607 new_space_.LowerInlineAllocationLimit(
1608 new_space_.inline_allocation_limit_step()); 1608 new_space_.inline_allocation_limit_step());
1609 1609
1610 // Update how much has survived scavenge. 1610 // Update how much has survived scavenge.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 if (external_string_table_.old_space_strings_.length() > 0) { 1677 if (external_string_table_.old_space_strings_.length() > 0) {
1678 Object** start = &external_string_table_.old_space_strings_[0]; 1678 Object** start = &external_string_table_.old_space_strings_[0];
1679 Object** end = start + external_string_table_.old_space_strings_.length(); 1679 Object** end = start + external_string_table_.old_space_strings_.length();
1680 for (Object** p = start; p < end; ++p) *p = updater_func(this, p); 1680 for (Object** p = start; p < end; ++p) *p = updater_func(this, p);
1681 } 1681 }
1682 1682
1683 UpdateNewSpaceReferencesInExternalStringTable(updater_func); 1683 UpdateNewSpaceReferencesInExternalStringTable(updater_func);
1684 } 1684 }
1685 1685
1686 1686
1687 void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) { 1687 void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) {
1688 ProcessArrayBuffers(retainer); 1688 ProcessArrayBuffers(retainer);
1689 ProcessNativeContexts(retainer); 1689 ProcessNativeContexts(retainer);
1690 // TODO(mvstanton): AllocationSites only need to be processed during
1691 // MARK_COMPACT, as they live in old space. Verify and address.
1692 ProcessAllocationSites(retainer); 1690 ProcessAllocationSites(retainer);
1693 // Collects callback info for handles that are pending (about to be 1691 // Collects callback info for handles that are pending (about to be
1694 // collected) and either phantom or internal-fields. Releases the global 1692 // collected) and either phantom or internal-fields. Releases the global
1695 // handles. See also PostGarbageCollectionProcessing. 1693 // handles. See also PostGarbageCollectionProcessing.
1696 isolate()->global_handles()->CollectPhantomCallbackData(); 1694 isolate()->global_handles()->CollectPhantomCallbackData();
1697 } 1695 }
1698 1696
1699 1697
1698 void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) {
1699 ProcessArrayBuffers(retainer);
1700 ProcessNativeContexts(retainer);
1701 // Collects callback info for handles that are pending (about to be
1702 // collected) and either phantom or internal-fields. Releases the global
1703 // handles. See also PostGarbageCollectionProcessing.
1704 isolate()->global_handles()->CollectPhantomCallbackData();
1705 }
1706
1707
1700 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) { 1708 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) {
1701 Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer); 1709 Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer);
1702 // Update the head of the list of contexts. 1710 // Update the head of the list of contexts.
1703 set_native_contexts_list(head); 1711 set_native_contexts_list(head);
1704 } 1712 }
1705 1713
1706 1714
1707 void Heap::ProcessArrayBuffers(WeakObjectRetainer* retainer) { 1715 void Heap::ProcessArrayBuffers(WeakObjectRetainer* retainer) {
1708 Object* array_buffer_obj = 1716 Object* array_buffer_obj =
1709 VisitWeakList<JSArrayBuffer>(this, array_buffers_list(), retainer); 1717 VisitWeakList<JSArrayBuffer>(this, array_buffers_list(), retainer);
(...skipping 4735 matching lines...) Expand 10 before | Expand all | Expand 10 after
6445 static_cast<int>(object_sizes_last_time_[index])); 6453 static_cast<int>(object_sizes_last_time_[index]));
6446 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6454 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6447 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6455 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6448 6456
6449 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6457 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6450 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6458 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6451 ClearObjectStats(); 6459 ClearObjectStats();
6452 } 6460 }
6453 } 6461 }
6454 } // namespace v8::internal 6462 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698