Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 ms_count_(0), | 99 ms_count_(0), |
| 100 gc_count_(0), | 100 gc_count_(0), |
| 101 remembered_unmapped_pages_index_(0), | 101 remembered_unmapped_pages_index_(0), |
| 102 unflattened_strings_length_(0), | 102 unflattened_strings_length_(0), |
| 103 #ifdef DEBUG | 103 #ifdef DEBUG |
| 104 allocation_timeout_(0), | 104 allocation_timeout_(0), |
| 105 #endif // DEBUG | 105 #endif // DEBUG |
| 106 old_generation_allocation_limit_(initial_old_generation_size_), | 106 old_generation_allocation_limit_(initial_old_generation_size_), |
| 107 old_gen_exhausted_(false), | 107 old_gen_exhausted_(false), |
| 108 inline_allocation_disabled_(false), | 108 inline_allocation_disabled_(false), |
| 109 last_array_buffers_young_object_(NULL), | |
| 110 last_native_contexts_young_object_(NULL), | |
| 109 store_buffer_rebuilder_(store_buffer()), | 111 store_buffer_rebuilder_(store_buffer()), |
| 110 hidden_string_(NULL), | 112 hidden_string_(NULL), |
| 111 gc_safe_size_of_old_object_(NULL), | 113 gc_safe_size_of_old_object_(NULL), |
| 112 total_regexp_code_generated_(0), | 114 total_regexp_code_generated_(0), |
| 113 tracer_(this), | 115 tracer_(this), |
| 114 high_survival_rate_period_length_(0), | 116 high_survival_rate_period_length_(0), |
| 115 promoted_objects_size_(0), | 117 promoted_objects_size_(0), |
| 116 promotion_ratio_(0), | 118 promotion_ratio_(0), |
| 117 semi_space_copied_object_size_(0), | 119 semi_space_copied_object_size_(0), |
| 118 previous_semi_space_copied_object_size_(0), | 120 previous_semi_space_copied_object_size_(0), |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1683 Object** start = &external_string_table_.old_space_strings_[0]; | 1685 Object** start = &external_string_table_.old_space_strings_[0]; |
| 1684 Object** end = start + external_string_table_.old_space_strings_.length(); | 1686 Object** end = start + external_string_table_.old_space_strings_.length(); |
| 1685 for (Object** p = start; p < end; ++p) *p = updater_func(this, p); | 1687 for (Object** p = start; p < end; ++p) *p = updater_func(this, p); |
| 1686 } | 1688 } |
| 1687 | 1689 |
| 1688 UpdateNewSpaceReferencesInExternalStringTable(updater_func); | 1690 UpdateNewSpaceReferencesInExternalStringTable(updater_func); |
| 1689 } | 1691 } |
| 1690 | 1692 |
| 1691 | 1693 |
| 1692 void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) { | 1694 void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) { |
| 1693 ProcessArrayBuffers(retainer); | 1695 ProcessArrayBuffers(retainer, NULL); |
| 1694 ProcessNativeContexts(retainer); | 1696 ProcessNativeContexts(retainer, NULL); |
| 1695 ProcessAllocationSites(retainer); | 1697 ProcessAllocationSites(retainer); |
| 1696 } | 1698 } |
| 1697 | 1699 |
| 1698 | 1700 |
| 1699 void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) { | 1701 void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) { |
| 1700 ProcessArrayBuffers(retainer); | 1702 ProcessArrayBuffers(retainer, last_array_buffers_young_object_); |
| 1701 ProcessNativeContexts(retainer); | 1703 ProcessNativeContexts(retainer, last_native_contexts_young_object_); |
| 1702 } | 1704 } |
| 1703 | 1705 |
| 1704 | 1706 |
| 1705 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) { | 1707 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer, |
| 1706 Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer); | 1708 Object* last_native_contexts_young_object) { |
| 1709 Object* last_young_object_recorded = NULL; | |
| 1710 Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer, | |
| 1711 last_native_contexts_young_object, | |
| 1712 &last_young_object_recorded); | |
|
ulan
2015/02/03 11:15:21
It just occurred to me that this won't work becaus
| |
| 1707 // Update the head of the list of contexts. | 1713 // Update the head of the list of contexts. |
| 1708 set_native_contexts_list(head); | 1714 set_native_contexts_list(head); |
| 1715 last_native_contexts_young_object_ = last_young_object_recorded; | |
| 1709 } | 1716 } |
| 1710 | 1717 |
| 1711 | 1718 |
| 1712 void Heap::ProcessArrayBuffers(WeakObjectRetainer* retainer) { | 1719 void Heap::ProcessArrayBuffers(WeakObjectRetainer* retainer, |
| 1713 Object* array_buffer_obj = | 1720 Object* last_array_buffers_young_object) { |
| 1714 VisitWeakList<JSArrayBuffer>(this, array_buffers_list(), retainer); | 1721 Object* last_young_object_recorded = NULL; |
| 1722 Object* array_buffer_obj = VisitWeakList<JSArrayBuffer>( | |
| 1723 this, array_buffers_list(), retainer, last_array_buffers_young_object, | |
| 1724 &last_young_object_recorded); | |
| 1715 set_array_buffers_list(array_buffer_obj); | 1725 set_array_buffers_list(array_buffer_obj); |
| 1726 last_array_buffers_young_object_ = last_young_object_recorded; | |
| 1716 } | 1727 } |
| 1717 | 1728 |
| 1718 | 1729 |
| 1719 void Heap::TearDownArrayBuffers() { | 1730 void Heap::TearDownArrayBuffers() { |
| 1720 Object* undefined = undefined_value(); | 1731 Object* undefined = undefined_value(); |
| 1721 for (Object* o = array_buffers_list(); o != undefined;) { | 1732 for (Object* o = array_buffers_list(); o != undefined;) { |
| 1722 JSArrayBuffer* buffer = JSArrayBuffer::cast(o); | 1733 JSArrayBuffer* buffer = JSArrayBuffer::cast(o); |
| 1723 Runtime::FreeArrayBuffer(isolate(), buffer); | 1734 Runtime::FreeArrayBuffer(isolate(), buffer); |
| 1724 o = buffer->weak_next(); | 1735 o = buffer->weak_next(); |
| 1725 } | 1736 } |
| 1726 set_array_buffers_list(undefined); | 1737 set_array_buffers_list(undefined); |
| 1727 } | 1738 } |
| 1728 | 1739 |
| 1729 | 1740 |
| 1730 void Heap::ProcessAllocationSites(WeakObjectRetainer* retainer) { | 1741 void Heap::ProcessAllocationSites(WeakObjectRetainer* retainer) { |
| 1731 Object* allocation_site_obj = | 1742 Object* allocation_site_obj = VisitWeakList<AllocationSite>( |
| 1732 VisitWeakList<AllocationSite>(this, allocation_sites_list(), retainer); | 1743 this, allocation_sites_list(), retainer, NULL, NULL); |
| 1733 set_allocation_sites_list(allocation_site_obj); | 1744 set_allocation_sites_list(allocation_site_obj); |
| 1734 } | 1745 } |
| 1735 | 1746 |
| 1736 | 1747 |
| 1737 void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) { | 1748 void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) { |
| 1738 DisallowHeapAllocation no_allocation_scope; | 1749 DisallowHeapAllocation no_allocation_scope; |
| 1739 Object* cur = allocation_sites_list(); | 1750 Object* cur = allocation_sites_list(); |
| 1740 bool marked = false; | 1751 bool marked = false; |
| 1741 while (cur->IsAllocationSite()) { | 1752 while (cur->IsAllocationSite()) { |
| 1742 AllocationSite* casted = AllocationSite::cast(cur); | 1753 AllocationSite* casted = AllocationSite::cast(cur); |
| (...skipping 4707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6450 static_cast<int>(object_sizes_last_time_[index])); | 6461 static_cast<int>(object_sizes_last_time_[index])); |
| 6451 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6462 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6452 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6463 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6453 | 6464 |
| 6454 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6465 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6455 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6466 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6456 ClearObjectStats(); | 6467 ClearObjectStats(); |
| 6457 } | 6468 } |
| 6458 } | 6469 } |
| 6459 } // namespace v8::internal | 6470 } // namespace v8::internal |
| OLD | NEW |