| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // These are just thin wrappers around OS::Allocate and OS::Free, | 386 // These are just thin wrappers around OS::Allocate and OS::Free, |
| 387 // but keep track of allocated bytes as part of heap. | 387 // but keep track of allocated bytes as part of heap. |
| 388 static void* AllocateRawMemory(const size_t requested, | 388 static void* AllocateRawMemory(const size_t requested, |
| 389 size_t* allocated, | 389 size_t* allocated, |
| 390 Executability executable); | 390 Executability executable); |
| 391 static void FreeRawMemory(void* buf, size_t length); | 391 static void FreeRawMemory(void* buf, size_t length); |
| 392 | 392 |
| 393 // Returns the maximum available bytes of heaps. | 393 // Returns the maximum available bytes of heaps. |
| 394 static int Available() { return capacity_ < size_ ? 0 : capacity_ - size_; } | 394 static int Available() { return capacity_ < size_ ? 0 : capacity_ - size_; } |
| 395 | 395 |
| 396 // Returns allocated spaces in bytes. |
| 397 static int Size() { return size_; } |
| 398 |
| 396 // Returns maximum available bytes that the old space can have. | 399 // Returns maximum available bytes that the old space can have. |
| 397 static int MaxAvailable() { | 400 static int MaxAvailable() { |
| 398 return (Available() / Page::kPageSize) * Page::kObjectAreaSize; | 401 return (Available() / Page::kPageSize) * Page::kObjectAreaSize; |
| 399 } | 402 } |
| 400 | 403 |
| 401 // Links two pages. | 404 // Links two pages. |
| 402 static inline void SetNextPage(Page* prev, Page* next); | 405 static inline void SetNextPage(Page* prev, Page* next); |
| 403 | 406 |
| 404 // Returns the next page of a given page. | 407 // Returns the next page of a given page. |
| 405 static inline Page* GetNextPage(Page* p); | 408 static inline Page* GetNextPage(Page* p); |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 | 1795 |
| 1793 private: | 1796 private: |
| 1794 LargeObjectChunk* current_; | 1797 LargeObjectChunk* current_; |
| 1795 HeapObjectCallback size_func_; | 1798 HeapObjectCallback size_func_; |
| 1796 }; | 1799 }; |
| 1797 | 1800 |
| 1798 | 1801 |
| 1799 } } // namespace v8::internal | 1802 } } // namespace v8::internal |
| 1800 | 1803 |
| 1801 #endif // V8_SPACES_H_ | 1804 #endif // V8_SPACES_H_ |
| OLD | NEW |