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