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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 bool contains(Address address) { | 881 bool contains(Address address) { |
882 if (this == NULL || code_range_ == NULL) return false; | 882 if (this == NULL || code_range_ == NULL) return false; |
883 Address start = static_cast<Address>(code_range_->address()); | 883 Address start = static_cast<Address>(code_range_->address()); |
884 return start <= address && address < start + code_range_->size(); | 884 return start <= address && address < start + code_range_->size(); |
885 } | 885 } |
886 | 886 |
887 // Allocates a chunk of memory from the large-object portion of | 887 // Allocates a chunk of memory from the large-object portion of |
888 // the code range. On platforms with no separate code range, should | 888 // the code range. On platforms with no separate code range, should |
889 // not be called. | 889 // not be called. |
890 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested, | 890 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested, |
891 size_t* allocated); | 891 size_t* allocated, |
| 892 bool commit = true); |
| 893 bool CommitRawMemory(Address start, size_t size); |
892 void FreeRawMemory(Address buf, size_t length); | 894 void FreeRawMemory(Address buf, size_t length); |
893 | 895 |
894 private: | 896 private: |
895 Isolate* isolate_; | 897 Isolate* isolate_; |
896 | 898 |
897 // The reserved range of virtual memory that all code objects are put in. | 899 // The reserved range of virtual memory that all code objects are put in. |
898 VirtualMemory* code_range_; | 900 VirtualMemory* code_range_; |
899 // Plain old data class, just a struct plus a constructor. | 901 // Plain old data class, just a struct plus a constructor. |
900 class FreeBlock { | 902 class FreeBlock { |
901 public: | 903 public: |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 } | 1034 } |
1033 | 1035 |
1034 #ifdef DEBUG | 1036 #ifdef DEBUG |
1035 // Reports statistic info of the space. | 1037 // Reports statistic info of the space. |
1036 void ReportStatistics(); | 1038 void ReportStatistics(); |
1037 #endif | 1039 #endif |
1038 | 1040 |
1039 MemoryChunk* AllocateChunk(intptr_t body_size, | 1041 MemoryChunk* AllocateChunk(intptr_t body_size, |
1040 Executability executable, | 1042 Executability executable, |
1041 Space* space); | 1043 Space* space); |
| 1044 Address ReserveChunk(size_t requested, |
| 1045 Executability executable, |
| 1046 VirtualMemory* controller); |
| 1047 MemoryChunk* CommitChunk(size_t body_size, |
| 1048 Executability executable, |
| 1049 VirtualMemory* reservation, |
| 1050 Space* owner); |
1042 | 1051 |
1043 Address ReserveAlignedMemory(size_t requested, | 1052 Address ReserveAlignedMemory(size_t requested, |
1044 size_t alignment, | 1053 size_t alignment, |
| 1054 Executability executable, |
1045 VirtualMemory* controller); | 1055 VirtualMemory* controller); |
| 1056 Address CommitAlignedMemory(Executability executable, |
| 1057 VirtualMemory* controller); |
1046 Address AllocateAlignedMemory(size_t requested, | 1058 Address AllocateAlignedMemory(size_t requested, |
1047 size_t alignment, | 1059 size_t alignment, |
1048 Executability executable, | 1060 Executability executable, |
1049 VirtualMemory* controller); | 1061 VirtualMemory* controller); |
1050 | 1062 |
1051 void FreeMemory(VirtualMemory* reservation, Executability executable); | 1063 void FreeMemory(VirtualMemory* reservation, Executability executable); |
1052 void FreeMemory(Address addr, size_t size, Executability executable); | 1064 void FreeMemory(Address addr, size_t size, Executability executable); |
1053 | 1065 |
1054 // Commit a contiguous block of memory from the initial chunk. Assumes that | 1066 // 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 | 1067 // the address is not NULL, the size is greater than zero, and that the |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 } | 2775 } |
2764 // Must be small, since an iteration is used for lookup. | 2776 // Must be small, since an iteration is used for lookup. |
2765 static const int kMaxComments = 64; | 2777 static const int kMaxComments = 64; |
2766 }; | 2778 }; |
2767 #endif | 2779 #endif |
2768 | 2780 |
2769 | 2781 |
2770 } } // namespace v8::internal | 2782 } } // namespace v8::internal |
2771 | 2783 |
2772 #endif // V8_SPACES_H_ | 2784 #endif // V8_SPACES_H_ |
OLD | NEW |