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

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

Issue 1094863002: Remove the weak list of views from array buffers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 8 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
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 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ProcessAllWeakReferences(WeakObjectRetainer* retainer) { 1687 void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) {
1688 ProcessArrayBuffers(retainer, false); 1688 ProcessArrayBuffers(retainer, false);
1689 ProcessNewArrayBufferViews(retainer);
1690 ProcessNativeContexts(retainer); 1689 ProcessNativeContexts(retainer);
1691 ProcessAllocationSites(retainer); 1690 ProcessAllocationSites(retainer);
1692 } 1691 }
1693 1692
1694 1693
1695 void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) { 1694 void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) {
1696 ProcessArrayBuffers(retainer, true); 1695 ProcessArrayBuffers(retainer, true);
1697 ProcessNewArrayBufferViews(retainer);
1698 ProcessNativeContexts(retainer); 1696 ProcessNativeContexts(retainer);
1699 } 1697 }
1700 1698
1701 1699
1702 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) { 1700 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) {
1703 Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer, 1701 Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer,
1704 false, NULL); 1702 false, NULL);
1705 // Update the head of the list of contexts. 1703 // Update the head of the list of contexts.
1706 set_native_contexts_list(head); 1704 set_native_contexts_list(head);
1707 } 1705 }
(...skipping 17 matching lines...) Expand all
1725 while (next != undefined) { 1723 while (next != undefined) {
1726 if (!old_objects_recorded) { 1724 if (!old_objects_recorded) {
1727 old_objects_recorded = !InNewSpace(next); 1725 old_objects_recorded = !InNewSpace(next);
1728 } 1726 }
1729 CHECK((InNewSpace(next) && !old_objects_recorded) || !InNewSpace(next)); 1727 CHECK((InNewSpace(next) && !old_objects_recorded) || !InNewSpace(next));
1730 next = JSArrayBuffer::cast(next)->weak_next(); 1728 next = JSArrayBuffer::cast(next)->weak_next();
1731 } 1729 }
1732 } 1730 }
1733 1731
1734 1732
1735 void Heap::ProcessNewArrayBufferViews(WeakObjectRetainer* retainer) {
1736 // Retain the list of new space views.
1737 Object* typed_array_obj = VisitWeakList<JSArrayBufferView>(
1738 this, new_array_buffer_views_list_, retainer, false, NULL);
1739 set_new_array_buffer_views_list(typed_array_obj);
1740
1741 // Some objects in the list may be in old space now. Find them
1742 // and move them to the corresponding array buffer.
1743 Object* view = VisitNewArrayBufferViewsWeakList(
1744 this, new_array_buffer_views_list_, retainer);
1745 set_new_array_buffer_views_list(view);
1746 }
1747
1748
1749 void Heap::TearDownArrayBuffers() { 1733 void Heap::TearDownArrayBuffers() {
1750 Object* undefined = undefined_value(); 1734 Object* undefined = undefined_value();
1751 for (Object* o = array_buffers_list(); o != undefined;) { 1735 for (Object* o = array_buffers_list(); o != undefined;) {
1752 JSArrayBuffer* buffer = JSArrayBuffer::cast(o); 1736 JSArrayBuffer* buffer = JSArrayBuffer::cast(o);
1753 Runtime::FreeArrayBuffer(isolate(), buffer); 1737 Runtime::FreeArrayBuffer(isolate(), buffer);
1754 o = buffer->weak_next(); 1738 o = buffer->weak_next();
1755 } 1739 }
1756 set_array_buffers_list(undefined); 1740 set_array_buffers_list(undefined);
1757 } 1741 }
1758 1742
(...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after
5391 if (!CreateInitialMaps()) return false; 5375 if (!CreateInitialMaps()) return false;
5392 CreateApiObjects(); 5376 CreateApiObjects();
5393 5377
5394 // Create initial objects 5378 // Create initial objects
5395 CreateInitialObjects(); 5379 CreateInitialObjects();
5396 CHECK_EQ(0u, gc_count_); 5380 CHECK_EQ(0u, gc_count_);
5397 5381
5398 set_native_contexts_list(undefined_value()); 5382 set_native_contexts_list(undefined_value());
5399 set_array_buffers_list(undefined_value()); 5383 set_array_buffers_list(undefined_value());
5400 set_last_array_buffer_in_list(undefined_value()); 5384 set_last_array_buffer_in_list(undefined_value());
5401 set_new_array_buffer_views_list(undefined_value());
5402 set_allocation_sites_list(undefined_value()); 5385 set_allocation_sites_list(undefined_value());
5403 return true; 5386 return true;
5404 } 5387 }
5405 5388
5406 5389
5407 void Heap::SetStackLimits() { 5390 void Heap::SetStackLimits() {
5408 DCHECK(isolate_ != NULL); 5391 DCHECK(isolate_ != NULL);
5409 DCHECK(isolate_ == isolate()); 5392 DCHECK(isolate_ == isolate());
5410 // On 64 bit machines, pointers are generally out of range of Smis. We write 5393 // On 64 bit machines, pointers are generally out of range of Smis. We write
5411 // something that looks like an out of range Smi to the GC. 5394 // something that looks like an out of range Smi to the GC.
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
6404 static_cast<int>(object_sizes_last_time_[index])); 6387 static_cast<int>(object_sizes_last_time_[index]));
6405 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6388 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6406 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6389 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6407 6390
6408 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6391 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6409 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6392 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6410 ClearObjectStats(); 6393 ClearObjectStats();
6411 } 6394 }
6412 } 6395 }
6413 } // namespace v8::internal 6396 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698