OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 return static_cast<int>(area_end() - area_start()); | 646 return static_cast<int>(area_end() - area_start()); |
647 } | 647 } |
648 | 648 |
649 // Approximate amount of physical memory committed for this chunk. | 649 // Approximate amount of physical memory committed for this chunk. |
650 size_t CommittedPhysicalMemory() { | 650 size_t CommittedPhysicalMemory() { |
651 return high_water_mark_; | 651 return high_water_mark_; |
652 } | 652 } |
653 | 653 |
654 static inline void UpdateHighWaterMark(Address mark); | 654 static inline void UpdateHighWaterMark(Address mark); |
655 | 655 |
| 656 bool RecommitBody(size_t body_size, Executability executable); |
| 657 |
656 protected: | 658 protected: |
657 MemoryChunk* next_chunk_; | 659 MemoryChunk* next_chunk_; |
658 MemoryChunk* prev_chunk_; | 660 MemoryChunk* prev_chunk_; |
659 size_t size_; | 661 size_t size_; |
660 intptr_t flags_; | 662 intptr_t flags_; |
661 | 663 |
662 // Start and end of allocatable memory on this chunk. | 664 // Start and end of allocatable memory on this chunk. |
663 Address area_start_; | 665 Address area_start_; |
664 Address area_end_; | 666 Address area_end_; |
665 | 667 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 bool contains(Address address) { | 883 bool contains(Address address) { |
882 if (this == NULL || code_range_ == NULL) return false; | 884 if (this == NULL || code_range_ == NULL) return false; |
883 Address start = static_cast<Address>(code_range_->address()); | 885 Address start = static_cast<Address>(code_range_->address()); |
884 return start <= address && address < start + code_range_->size(); | 886 return start <= address && address < start + code_range_->size(); |
885 } | 887 } |
886 | 888 |
887 // Allocates a chunk of memory from the large-object portion of | 889 // Allocates a chunk of memory from the large-object portion of |
888 // the code range. On platforms with no separate code range, should | 890 // the code range. On platforms with no separate code range, should |
889 // not be called. | 891 // not be called. |
890 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested, | 892 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested, |
891 size_t* allocated); | 893 size_t* allocated, |
| 894 size_t initial_commit_size); |
| 895 bool RecommitRawMemory(Address start, size_t length); |
892 void FreeRawMemory(Address buf, size_t length); | 896 void FreeRawMemory(Address buf, size_t length); |
893 | 897 |
894 private: | 898 private: |
895 Isolate* isolate_; | 899 Isolate* isolate_; |
896 | 900 |
897 // The reserved range of virtual memory that all code objects are put in. | 901 // The reserved range of virtual memory that all code objects are put in. |
898 VirtualMemory* code_range_; | 902 VirtualMemory* code_range_; |
899 // Plain old data class, just a struct plus a constructor. | 903 // Plain old data class, just a struct plus a constructor. |
900 class FreeBlock { | 904 class FreeBlock { |
901 public: | 905 public: |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 intptr_t MaxAvailable() { | 1034 intptr_t MaxAvailable() { |
1031 return (Available() / Page::kPageSize) * Page::kMaxNonCodeHeapObjectSize; | 1035 return (Available() / Page::kPageSize) * Page::kMaxNonCodeHeapObjectSize; |
1032 } | 1036 } |
1033 | 1037 |
1034 #ifdef DEBUG | 1038 #ifdef DEBUG |
1035 // Reports statistic info of the space. | 1039 // Reports statistic info of the space. |
1036 void ReportStatistics(); | 1040 void ReportStatistics(); |
1037 #endif | 1041 #endif |
1038 | 1042 |
1039 MemoryChunk* AllocateChunk(intptr_t body_size, | 1043 MemoryChunk* AllocateChunk(intptr_t body_size, |
| 1044 intptr_t commit_size, |
1040 Executability executable, | 1045 Executability executable, |
1041 Space* space); | 1046 Space* space); |
1042 | 1047 |
1043 Address ReserveAlignedMemory(size_t requested, | 1048 Address ReserveAlignedMemory(size_t requested, |
1044 size_t alignment, | 1049 size_t alignment, |
1045 VirtualMemory* controller); | 1050 VirtualMemory* controller); |
1046 Address AllocateAlignedMemory(size_t requested, | 1051 Address AllocateAlignedMemory(size_t requested, |
1047 size_t alignment, | 1052 size_t alignment, |
| 1053 size_t initial_commit_size, |
1048 Executability executable, | 1054 Executability executable, |
1049 VirtualMemory* controller); | 1055 VirtualMemory* controller); |
1050 | 1056 |
1051 void FreeMemory(VirtualMemory* reservation, Executability executable); | 1057 void FreeMemory(VirtualMemory* reservation, Executability executable); |
1052 void FreeMemory(Address addr, size_t size, Executability executable); | 1058 void FreeMemory(Address addr, size_t size, Executability executable); |
1053 | 1059 |
1054 // Commit a contiguous block of memory from the initial chunk. Assumes that | 1060 // Commit a contiguous block of memory from the initial chunk. Assumes that |
1055 // the address is not NULL, the size is greater than zero, and that the | 1061 // the address is not NULL, the size is greater than zero, and that the |
1056 // block is contained in the initial chunk. Returns true if it succeeded | 1062 // block is contained in the initial chunk. Returns true if it succeeded |
1057 // and false otherwise. | 1063 // and false otherwise. |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 } | 2769 } |
2764 // Must be small, since an iteration is used for lookup. | 2770 // Must be small, since an iteration is used for lookup. |
2765 static const int kMaxComments = 64; | 2771 static const int kMaxComments = 64; |
2766 }; | 2772 }; |
2767 #endif | 2773 #endif |
2768 | 2774 |
2769 | 2775 |
2770 } } // namespace v8::internal | 2776 } } // namespace v8::internal |
2771 | 2777 |
2772 #endif // V8_SPACES_H_ | 2778 #endif // V8_SPACES_H_ |
OLD | NEW |