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

Side by Side Diff: src/heap/spaces.h

Issue 2109943003: [heap] Reland uncommit unused large object page memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 5 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/base/platform/platform-win32.cc ('k') | src/heap/spaces.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #ifndef V8_HEAP_SPACES_H_ 5 #ifndef V8_HEAP_SPACES_H_
6 #define V8_HEAP_SPACES_H_ 6 #define V8_HEAP_SPACES_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 621
622 int write_barrier_counter() { 622 int write_barrier_counter() {
623 return static_cast<int>(write_barrier_counter_); 623 return static_cast<int>(write_barrier_counter_);
624 } 624 }
625 625
626 void set_write_barrier_counter(int counter) { 626 void set_write_barrier_counter(int counter) {
627 write_barrier_counter_ = counter; 627 write_barrier_counter_ = counter;
628 } 628 }
629 629
630 size_t size() const { return size_; } 630 size_t size() const { return size_; }
631 void set_size(size_t size) { size_ = size; }
631 632
632 inline Heap* heap() const { return heap_; } 633 inline Heap* heap() const { return heap_; }
633 634
634 inline SkipList* skip_list() { return skip_list_; } 635 inline SkipList* skip_list() { return skip_list_; }
635 636
636 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } 637 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; }
637 638
638 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } 639 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; }
639 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } 640 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; }
640 inline TypedSlotSet* typed_old_to_new_slots() { 641 inline TypedSlotSet* typed_old_to_new_slots() {
(...skipping 15 matching lines...) Expand all
656 void AllocateLocalTracker(); 657 void AllocateLocalTracker();
657 void ReleaseLocalTracker(); 658 void ReleaseLocalTracker();
658 659
659 Address area_start() { return area_start_; } 660 Address area_start() { return area_start_; }
660 Address area_end() { return area_end_; } 661 Address area_end() { return area_end_; }
661 int area_size() { return static_cast<int>(area_end() - area_start()); } 662 int area_size() { return static_cast<int>(area_end() - area_start()); }
662 663
663 bool CommitArea(size_t requested); 664 bool CommitArea(size_t requested);
664 665
665 // Approximate amount of physical memory committed for this chunk. 666 // Approximate amount of physical memory committed for this chunk.
666 size_t CommittedPhysicalMemory() { return high_water_mark_.Value(); } 667 size_t CommittedPhysicalMemory();
667 668
668 Address HighWaterMark() { return address() + high_water_mark_.Value(); } 669 Address HighWaterMark() { return address() + high_water_mark_.Value(); }
669 670
670 int progress_bar() { 671 int progress_bar() {
671 DCHECK(IsFlagSet(HAS_PROGRESS_BAR)); 672 DCHECK(IsFlagSet(HAS_PROGRESS_BAR));
672 return progress_bar_; 673 return progress_bar_;
673 } 674 }
674 675
675 void set_progress_bar(int progress_bar) { 676 void set_progress_bar(int progress_bar) {
676 DCHECK(IsFlagSet(HAS_PROGRESS_BAR)); 677 DCHECK(IsFlagSet(HAS_PROGRESS_BAR));
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 class LargePage : public MemoryChunk { 997 class LargePage : public MemoryChunk {
997 public: 998 public:
998 HeapObject* GetObject() { return HeapObject::FromAddress(area_start()); } 999 HeapObject* GetObject() { return HeapObject::FromAddress(area_start()); }
999 1000
1000 inline LargePage* next_page() { 1001 inline LargePage* next_page() {
1001 return static_cast<LargePage*>(next_chunk()); 1002 return static_cast<LargePage*>(next_chunk());
1002 } 1003 }
1003 1004
1004 inline void set_next_page(LargePage* page) { set_next_chunk(page); } 1005 inline void set_next_page(LargePage* page) { set_next_chunk(page); }
1005 1006
1007 // Uncommit memory that is not in use anymore by the object. If the object
1008 // cannot be shrunk 0 is returned.
1009 Address GetAddressToShrink();
1010
1011 void ClearOutOfLiveRangeSlots(Address free_start);
1012
1006 // A limit to guarantee that we do not overflow typed slot offset in 1013 // A limit to guarantee that we do not overflow typed slot offset in
1007 // the old to old remembered set. 1014 // the old to old remembered set.
1008 // Note that this limit is higher than what assembler already imposes on 1015 // Note that this limit is higher than what assembler already imposes on
1009 // x64 and ia32 architectures. 1016 // x64 and ia32 architectures.
1010 static const int kMaxCodePageSize = 512 * MB; 1017 static const int kMaxCodePageSize = 512 * MB;
1011 1018
1012 private: 1019 private:
1013 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk, 1020 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk,
1014 Executability executable, Space* owner); 1021 Executability executable, Space* owner);
1015 1022
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 1454
1448 Address ReserveAlignedMemory(size_t requested, size_t alignment, 1455 Address ReserveAlignedMemory(size_t requested, size_t alignment,
1449 base::VirtualMemory* controller); 1456 base::VirtualMemory* controller);
1450 Address AllocateAlignedMemory(size_t reserve_size, size_t commit_size, 1457 Address AllocateAlignedMemory(size_t reserve_size, size_t commit_size,
1451 size_t alignment, Executability executable, 1458 size_t alignment, Executability executable,
1452 base::VirtualMemory* controller); 1459 base::VirtualMemory* controller);
1453 1460
1454 bool CommitMemory(Address addr, size_t size, Executability executable); 1461 bool CommitMemory(Address addr, size_t size, Executability executable);
1455 1462
1456 void FreeMemory(base::VirtualMemory* reservation, Executability executable); 1463 void FreeMemory(base::VirtualMemory* reservation, Executability executable);
1464 void PartialFreeMemory(MemoryChunk* chunk, Address start_free);
1457 void FreeMemory(Address addr, size_t size, Executability executable); 1465 void FreeMemory(Address addr, size_t size, Executability executable);
1458 1466
1459 // Commit a contiguous block of memory from the initial chunk. Assumes that 1467 // Commit a contiguous block of memory from the initial chunk. Assumes that
1460 // the address is not NULL, the size is greater than zero, and that the 1468 // the address is not NULL, the size is greater than zero, and that the
1461 // block is contained in the initial chunk. Returns true if it succeeded 1469 // block is contained in the initial chunk. Returns true if it succeeded
1462 // and false otherwise. 1470 // and false otherwise.
1463 bool CommitBlock(Address start, size_t size, Executability executable); 1471 bool CommitBlock(Address start, size_t size, Executability executable);
1464 1472
1465 // Uncommit a contiguous block of memory [start..(start+size)[. 1473 // Uncommit a contiguous block of memory [start..(start+size)[.
1466 // start is not NULL, the size is greater than zero, and the 1474 // start is not NULL, the size is greater than zero, and the
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 // Finds a large object page containing the given address, returns NULL 3076 // Finds a large object page containing the given address, returns NULL
3069 // if such a page doesn't exist. 3077 // if such a page doesn't exist.
3070 LargePage* FindPage(Address a); 3078 LargePage* FindPage(Address a);
3071 3079
3072 // Clears the marking state of live objects. 3080 // Clears the marking state of live objects.
3073 void ClearMarkingStateOfLiveObjects(); 3081 void ClearMarkingStateOfLiveObjects();
3074 3082
3075 // Frees unmarked objects. 3083 // Frees unmarked objects.
3076 void FreeUnmarkedObjects(); 3084 void FreeUnmarkedObjects();
3077 3085
3086 void InsertChunkMapEntries(LargePage* page);
3087 void RemoveChunkMapEntries(LargePage* page);
3088 void RemoveChunkMapEntries(LargePage* page, Address free_start);
3089
3078 // Checks whether a heap object is in this space; O(1). 3090 // Checks whether a heap object is in this space; O(1).
3079 bool Contains(HeapObject* obj); 3091 bool Contains(HeapObject* obj);
3080 // Checks whether an address is in the object area in this space. Iterates 3092 // Checks whether an address is in the object area in this space. Iterates
3081 // all objects in the space. May be slow. 3093 // all objects in the space. May be slow.
3082 bool ContainsSlow(Address addr) { return FindObject(addr)->IsHeapObject(); } 3094 bool ContainsSlow(Address addr) { return FindObject(addr)->IsHeapObject(); }
3083 3095
3084 // Checks whether the space is empty. 3096 // Checks whether the space is empty.
3085 bool IsEmpty() { return first_page_ == NULL; } 3097 bool IsEmpty() { return first_page_ == NULL; }
3086 3098
3087 void AdjustLiveBytes(int by) { objects_size_ += by; } 3099 void AdjustLiveBytes(int by) { objects_size_ += by; }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3162 count = 0; 3174 count = 0;
3163 } 3175 }
3164 // Must be small, since an iteration is used for lookup. 3176 // Must be small, since an iteration is used for lookup.
3165 static const int kMaxComments = 64; 3177 static const int kMaxComments = 64;
3166 }; 3178 };
3167 #endif 3179 #endif
3168 } // namespace internal 3180 } // namespace internal
3169 } // namespace v8 3181 } // namespace v8
3170 3182
3171 #endif // V8_HEAP_SPACES_H_ 3183 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/base/platform/platform-win32.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698