| 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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1710 Address top() { return allocation_info_.top; } | 1710 Address top() { return allocation_info_.top; } |
| 1711 Address limit() { return allocation_info_.limit; } | 1711 Address limit() { return allocation_info_.limit; } |
| 1712 | 1712 |
| 1713 // The allocation top and limit addresses. | 1713 // The allocation top and limit addresses. |
| 1714 Address* allocation_top_address() { return &allocation_info_.top; } | 1714 Address* allocation_top_address() { return &allocation_info_.top; } |
| 1715 Address* allocation_limit_address() { return &allocation_info_.limit; } | 1715 Address* allocation_limit_address() { return &allocation_info_.limit; } |
| 1716 | 1716 |
| 1717 // Allocate the requested number of bytes in the space if possible, return a | 1717 // Allocate the requested number of bytes in the space if possible, return a |
| 1718 // failure object if not. | 1718 // failure object if not. |
| 1719 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes); | 1719 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes); |
| 1720 MUST_USE_RESULT inline MaybeObject* AllocateRawForMigration( |
| 1721 int size_in_bytes); |
| 1720 | 1722 |
| 1721 virtual bool ReserveSpace(int bytes); | 1723 virtual bool ReserveSpace(int bytes); |
| 1722 | 1724 |
| 1723 // Give a block of memory to the space's free list. It might be added to | 1725 // Give a block of memory to the space's free list. It might be added to |
| 1724 // the free list or accounted as waste. | 1726 // the free list or accounted as waste. |
| 1725 // If add_to_freelist is false then just accounting stats are updated and | 1727 // If add_to_freelist is false then just accounting stats are updated and |
| 1726 // no attempt to add area to free list is made. | 1728 // no attempt to add area to free list is made. |
| 1727 int Free(Address start, int size_in_bytes) { | 1729 int Free(Address start, int size_in_bytes) { |
| 1728 int wasted = free_list_.Free(start, size_in_bytes); | 1730 int wasted = free_list_.Free(start, size_in_bytes); |
| 1729 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); | 1731 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 | 1892 |
| 1891 // Generic fast case allocation function that tries linear allocation at the | 1893 // Generic fast case allocation function that tries linear allocation at the |
| 1892 // address denoted by top in allocation_info_. | 1894 // address denoted by top in allocation_info_. |
| 1893 inline HeapObject* AllocateLinearly(int size_in_bytes); | 1895 inline HeapObject* AllocateLinearly(int size_in_bytes); |
| 1894 | 1896 |
| 1895 // Slow path of AllocateRaw. This function is space-dependent. | 1897 // Slow path of AllocateRaw. This function is space-dependent. |
| 1896 MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); | 1898 MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); |
| 1897 | 1899 |
| 1898 friend class PageIterator; | 1900 friend class PageIterator; |
| 1899 friend class SweeperThread; | 1901 friend class SweeperThread; |
| 1902 |
| 1903 private: |
| 1904 inline HeapObject* AllocateRawHelper(int size_in_bytes); |
| 1900 }; | 1905 }; |
| 1901 | 1906 |
| 1902 | 1907 |
| 1903 class NumberAndSizeInfo BASE_EMBEDDED { | 1908 class NumberAndSizeInfo BASE_EMBEDDED { |
| 1904 public: | 1909 public: |
| 1905 NumberAndSizeInfo() : number_(0), bytes_(0) {} | 1910 NumberAndSizeInfo() : number_(0), bytes_(0) {} |
| 1906 | 1911 |
| 1907 int number() const { return number_; } | 1912 int number() const { return number_; } |
| 1908 void increment_number(int num) { number_ += num; } | 1913 void increment_number(int num) { number_ += num; } |
| 1909 | 1914 |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2896 } | 2901 } |
| 2897 // Must be small, since an iteration is used for lookup. | 2902 // Must be small, since an iteration is used for lookup. |
| 2898 static const int kMaxComments = 64; | 2903 static const int kMaxComments = 64; |
| 2899 }; | 2904 }; |
| 2900 #endif | 2905 #endif |
| 2901 | 2906 |
| 2902 | 2907 |
| 2903 } } // namespace v8::internal | 2908 } } // namespace v8::internal |
| 2904 | 2909 |
| 2905 #endif // V8_SPACES_H_ | 2910 #endif // V8_SPACES_H_ |
| OLD | NEW |