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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1691 // Returns the allocation pointer in this space. | 1691 // Returns the allocation pointer in this space. |
1692 Address top() { return allocation_info_.top; } | 1692 Address top() { return allocation_info_.top; } |
1693 Address limit() { return allocation_info_.limit; } | 1693 Address limit() { return allocation_info_.limit; } |
1694 | 1694 |
1695 // The allocation top and limit addresses. | 1695 // The allocation top and limit addresses. |
1696 Address* allocation_top_address() { return &allocation_info_.top; } | 1696 Address* allocation_top_address() { return &allocation_info_.top; } |
1697 Address* allocation_limit_address() { return &allocation_info_.limit; } | 1697 Address* allocation_limit_address() { return &allocation_info_.limit; } |
1698 | 1698 |
1699 // Allocate the requested number of bytes in the space if possible, return a | 1699 // Allocate the requested number of bytes in the space if possible, return a |
1700 // failure object if not. | 1700 // failure object if not. |
1701 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes); | 1701 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes); |
Hannes Payer (out of office)
2013/08/28 09:51:32
Instead of adding multiple allocation methods to s
Alexandra Mikhaylova
2013/09/24 14:56:20
Done.
| |
1702 MUST_USE_RESULT inline MaybeObject* AllocateRawForMigration(int size_in_bytes) ; | |
loislo
2013/08/27 09:04:57
style: 80 symbols
Alexandra Mikhaylova
2013/09/19 16:03:38
Done.
| |
1702 | 1703 |
1703 virtual bool ReserveSpace(int bytes); | 1704 virtual bool ReserveSpace(int bytes); |
1704 | 1705 |
1705 // Give a block of memory to the space's free list. It might be added to | 1706 // Give a block of memory to the space's free list. It might be added to |
1706 // the free list or accounted as waste. | 1707 // the free list or accounted as waste. |
1707 // If add_to_freelist is false then just accounting stats are updated and | 1708 // If add_to_freelist is false then just accounting stats are updated and |
1708 // no attempt to add area to free list is made. | 1709 // no attempt to add area to free list is made. |
1709 int Free(Address start, int size_in_bytes) { | 1710 int Free(Address start, int size_in_bytes) { |
1710 int wasted = free_list_.Free(start, size_in_bytes); | 1711 int wasted = free_list_.Free(start, size_in_bytes); |
1711 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); | 1712 accounting_stats_.DeallocateBytes(size_in_bytes - wasted); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1872 | 1873 |
1873 // Generic fast case allocation function that tries linear allocation at the | 1874 // Generic fast case allocation function that tries linear allocation at the |
1874 // address denoted by top in allocation_info_. | 1875 // address denoted by top in allocation_info_. |
1875 inline HeapObject* AllocateLinearly(int size_in_bytes); | 1876 inline HeapObject* AllocateLinearly(int size_in_bytes); |
1876 | 1877 |
1877 // Slow path of AllocateRaw. This function is space-dependent. | 1878 // Slow path of AllocateRaw. This function is space-dependent. |
1878 MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); | 1879 MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); |
1879 | 1880 |
1880 friend class PageIterator; | 1881 friend class PageIterator; |
1881 friend class SweeperThread; | 1882 friend class SweeperThread; |
1883 | |
1884 private: | |
1885 inline HeapObject* AllocateRawHelper(int size_in_bytes); | |
1882 }; | 1886 }; |
1883 | 1887 |
1884 | 1888 |
1885 class NumberAndSizeInfo BASE_EMBEDDED { | 1889 class NumberAndSizeInfo BASE_EMBEDDED { |
1886 public: | 1890 public: |
1887 NumberAndSizeInfo() : number_(0), bytes_(0) {} | 1891 NumberAndSizeInfo() : number_(0), bytes_(0) {} |
1888 | 1892 |
1889 int number() const { return number_; } | 1893 int number() const { return number_; } |
1890 void increment_number(int num) { number_ += num; } | 1894 void increment_number(int num) { number_ += num; } |
1891 | 1895 |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2878 } | 2882 } |
2879 // Must be small, since an iteration is used for lookup. | 2883 // Must be small, since an iteration is used for lookup. |
2880 static const int kMaxComments = 64; | 2884 static const int kMaxComments = 64; |
2881 }; | 2885 }; |
2882 #endif | 2886 #endif |
2883 | 2887 |
2884 | 2888 |
2885 } } // namespace v8::internal | 2889 } } // namespace v8::internal |
2886 | 2890 |
2887 #endif // V8_SPACES_H_ | 2891 #endif // V8_SPACES_H_ |
OLD | NEW |