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

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

Issue 2032393002: [heap] Uncommit unused large object page memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 615
616 int write_barrier_counter() { 616 int write_barrier_counter() {
617 return static_cast<int>(write_barrier_counter_); 617 return static_cast<int>(write_barrier_counter_);
618 } 618 }
619 619
620 void set_write_barrier_counter(int counter) { 620 void set_write_barrier_counter(int counter) {
621 write_barrier_counter_ = counter; 621 write_barrier_counter_ = counter;
622 } 622 }
623 623
624 size_t size() const { return size_; } 624 size_t size() const { return size_; }
625 void set_size(size_t size) { size_ = size; }
625 626
626 inline Heap* heap() const { return heap_; } 627 inline Heap* heap() const { return heap_; }
627 628
628 inline SkipList* skip_list() { return skip_list_; } 629 inline SkipList* skip_list() { return skip_list_; }
629 630
630 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; } 631 inline void set_skip_list(SkipList* skip_list) { skip_list_ = skip_list; }
631 632
632 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; } 633 inline SlotSet* old_to_new_slots() { return old_to_new_slots_; }
633 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; } 634 inline SlotSet* old_to_old_slots() { return old_to_old_slots_; }
634 inline TypedSlotSet* typed_old_to_new_slots() { 635 inline TypedSlotSet* typed_old_to_new_slots() {
(...skipping 12 matching lines...) Expand all
647 void AllocateTypedOldToOldSlots(); 648 void AllocateTypedOldToOldSlots();
648 void ReleaseTypedOldToOldSlots(); 649 void ReleaseTypedOldToOldSlots();
649 650
650 Address area_start() { return area_start_; } 651 Address area_start() { return area_start_; }
651 Address area_end() { return area_end_; } 652 Address area_end() { return area_end_; }
652 int area_size() { return static_cast<int>(area_end() - area_start()); } 653 int area_size() { return static_cast<int>(area_end() - area_start()); }
653 654
654 bool CommitArea(size_t requested); 655 bool CommitArea(size_t requested);
655 656
656 // Approximate amount of physical memory committed for this chunk. 657 // Approximate amount of physical memory committed for this chunk.
657 size_t CommittedPhysicalMemory() { return high_water_mark_.Value(); } 658 size_t CommittedPhysicalMemory();
658 659
659 Address HighWaterMark() { return address() + high_water_mark_.Value(); } 660 Address HighWaterMark() { return address() + high_water_mark_.Value(); }
660 661
661 int progress_bar() { 662 int progress_bar() {
662 DCHECK(IsFlagSet(HAS_PROGRESS_BAR)); 663 DCHECK(IsFlagSet(HAS_PROGRESS_BAR));
663 return progress_bar_; 664 return progress_bar_;
664 } 665 }
665 666
666 void set_progress_bar(int progress_bar) { 667 void set_progress_bar(int progress_bar) {
667 DCHECK(IsFlagSet(HAS_PROGRESS_BAR)); 668 DCHECK(IsFlagSet(HAS_PROGRESS_BAR));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 class LargePage : public MemoryChunk { 986 class LargePage : public MemoryChunk {
986 public: 987 public:
987 HeapObject* GetObject() { return HeapObject::FromAddress(area_start()); } 988 HeapObject* GetObject() { return HeapObject::FromAddress(area_start()); }
988 989
989 inline LargePage* next_page() { 990 inline LargePage* next_page() {
990 return static_cast<LargePage*>(next_chunk()); 991 return static_cast<LargePage*>(next_chunk());
991 } 992 }
992 993
993 inline void set_next_page(LargePage* page) { set_next_chunk(page); } 994 inline void set_next_page(LargePage* page) { set_next_chunk(page); }
994 995
996 // Uncommit memory that is not in use anymore by the object. If the object
997 // cannot be shrunk 0 is returned.
998 Address GetAddressToShrink();
999
995 // A limit to guarantee that we do not overflow typed slot offset in 1000 // A limit to guarantee that we do not overflow typed slot offset in
996 // the old to old remembered set. 1001 // the old to old remembered set.
997 // Note that this limit is higher than what assembler already imposes on 1002 // Note that this limit is higher than what assembler already imposes on
998 // x64 and ia32 architectures. 1003 // x64 and ia32 architectures.
999 static const int kMaxCodePageSize = 512 * MB; 1004 static const int kMaxCodePageSize = 512 * MB;
1000 1005
1001 private: 1006 private:
1002 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk, 1007 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk,
1003 Executability executable, Space* owner); 1008 Executability executable, Space* owner);
1004 1009
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 1441
1437 Address ReserveAlignedMemory(size_t requested, size_t alignment, 1442 Address ReserveAlignedMemory(size_t requested, size_t alignment,
1438 base::VirtualMemory* controller); 1443 base::VirtualMemory* controller);
1439 Address AllocateAlignedMemory(size_t reserve_size, size_t commit_size, 1444 Address AllocateAlignedMemory(size_t reserve_size, size_t commit_size,
1440 size_t alignment, Executability executable, 1445 size_t alignment, Executability executable,
1441 base::VirtualMemory* controller); 1446 base::VirtualMemory* controller);
1442 1447
1443 bool CommitMemory(Address addr, size_t size, Executability executable); 1448 bool CommitMemory(Address addr, size_t size, Executability executable);
1444 1449
1445 void FreeMemory(base::VirtualMemory* reservation, Executability executable); 1450 void FreeMemory(base::VirtualMemory* reservation, Executability executable);
1451 void PartialFreeMemory(MemoryChunk* chunk, Address start_free);
1446 void FreeMemory(Address addr, size_t size, Executability executable); 1452 void FreeMemory(Address addr, size_t size, Executability executable);
1447 1453
1448 // Commit a contiguous block of memory from the initial chunk. Assumes that 1454 // Commit a contiguous block of memory from the initial chunk. Assumes that
1449 // the address is not NULL, the size is greater than zero, and that the 1455 // the address is not NULL, the size is greater than zero, and that the
1450 // block is contained in the initial chunk. Returns true if it succeeded 1456 // block is contained in the initial chunk. Returns true if it succeeded
1451 // and false otherwise. 1457 // and false otherwise.
1452 bool CommitBlock(Address start, size_t size, Executability executable); 1458 bool CommitBlock(Address start, size_t size, Executability executable);
1453 1459
1454 // Uncommit a contiguous block of memory [start..(start+size)[. 1460 // Uncommit a contiguous block of memory [start..(start+size)[.
1455 // start is not NULL, the size is greater than zero, and the 1461 // start is not NULL, the size is greater than zero, and the
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 count = 0; 3147 count = 0;
3142 } 3148 }
3143 // Must be small, since an iteration is used for lookup. 3149 // Must be small, since an iteration is used for lookup.
3144 static const int kMaxComments = 64; 3150 static const int kMaxComments = 64;
3145 }; 3151 };
3146 #endif 3152 #endif
3147 } // namespace internal 3153 } // namespace internal
3148 } // namespace v8 3154 } // namespace v8
3149 3155
3150 #endif // V8_HEAP_SPACES_H_ 3156 #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