| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 available_ -= size_in_bytes; | 946 available_ -= size_in_bytes; |
| 947 } | 947 } |
| 948 | 948 |
| 949 // Allocate from available bytes (available -> size). | 949 // Allocate from available bytes (available -> size). |
| 950 void AllocateBytes(int size_in_bytes) { | 950 void AllocateBytes(int size_in_bytes) { |
| 951 available_ -= size_in_bytes; | 951 available_ -= size_in_bytes; |
| 952 size_ += size_in_bytes; | 952 size_ += size_in_bytes; |
| 953 } | 953 } |
| 954 | 954 |
| 955 // Free allocated bytes, making them available (size -> available). | 955 // Free allocated bytes, making them available (size -> available). |
| 956 void DeallocateBytes(int size_in_bytes) { | 956 void DeallocateBytes(intptr_t size_in_bytes) { |
| 957 size_ -= size_in_bytes; | 957 size_ -= size_in_bytes; |
| 958 available_ += size_in_bytes; | 958 available_ += size_in_bytes; |
| 959 } | 959 } |
| 960 | 960 |
| 961 // Waste free bytes (available -> waste). | 961 // Waste free bytes (available -> waste). |
| 962 void WasteBytes(int size_in_bytes) { | 962 void WasteBytes(int size_in_bytes) { |
| 963 available_ -= size_in_bytes; | 963 available_ -= size_in_bytes; |
| 964 waste_ += size_in_bytes; | 964 waste_ += size_in_bytes; |
| 965 } | 965 } |
| 966 | 966 |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 | 2126 |
| 2127 // Returns the object in this chunk. | 2127 // Returns the object in this chunk. |
| 2128 inline HeapObject* GetObject(); | 2128 inline HeapObject* GetObject(); |
| 2129 | 2129 |
| 2130 // Given a requested size returns the physical size of a chunk to be | 2130 // Given a requested size returns the physical size of a chunk to be |
| 2131 // allocated. | 2131 // allocated. |
| 2132 static int ChunkSizeFor(int size_in_bytes); | 2132 static int ChunkSizeFor(int size_in_bytes); |
| 2133 | 2133 |
| 2134 // Given a chunk size, returns the object size it can accommodate. Used by | 2134 // Given a chunk size, returns the object size it can accommodate. Used by |
| 2135 // LargeObjectSpace::Available. | 2135 // LargeObjectSpace::Available. |
| 2136 static int ObjectSizeFor(int chunk_size) { | 2136 static intptr_t ObjectSizeFor(intptr_t chunk_size) { |
| 2137 if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0; | 2137 if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0; |
| 2138 return chunk_size - Page::kPageSize - Page::kObjectStartOffset; | 2138 return chunk_size - Page::kPageSize - Page::kObjectStartOffset; |
| 2139 } | 2139 } |
| 2140 | 2140 |
| 2141 private: | 2141 private: |
| 2142 // A pointer to the next large object chunk in the space or NULL. | 2142 // A pointer to the next large object chunk in the space or NULL. |
| 2143 LargeObjectChunk* next_; | 2143 LargeObjectChunk* next_; |
| 2144 | 2144 |
| 2145 // The size of this chunk. | 2145 // The size of this chunk. |
| 2146 size_t size_; | 2146 size_t size_; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 | 2256 |
| 2257 private: | 2257 private: |
| 2258 LargeObjectChunk* current_; | 2258 LargeObjectChunk* current_; |
| 2259 HeapObjectCallback size_func_; | 2259 HeapObjectCallback size_func_; |
| 2260 }; | 2260 }; |
| 2261 | 2261 |
| 2262 | 2262 |
| 2263 } } // namespace v8::internal | 2263 } } // namespace v8::internal |
| 2264 | 2264 |
| 2265 #endif // V8_SPACES_H_ | 2265 #endif // V8_SPACES_H_ |
| OLD | NEW |