OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 // The allocation top address. | 1757 // The allocation top address. |
1758 Address* allocation_top_address() { return allocation_info_.top_address(); } | 1758 Address* allocation_top_address() { return allocation_info_.top_address(); } |
1759 | 1759 |
1760 // The allocation limit address. | 1760 // The allocation limit address. |
1761 Address* allocation_limit_address() { | 1761 Address* allocation_limit_address() { |
1762 return allocation_info_.limit_address(); | 1762 return allocation_info_.limit_address(); |
1763 } | 1763 } |
1764 | 1764 |
1765 // Allocate the requested number of bytes in the space if possible, return a | 1765 // Allocate the requested number of bytes in the space if possible, return a |
1766 // failure object if not. | 1766 // failure object if not. |
1767 MUST_USE_RESULT inline AllocationResult AllocateRaw(int size_in_bytes); | 1767 MUST_USE_RESULT inline AllocationResult AllocateRawUnaligned( |
| 1768 int size_in_bytes); |
1768 | 1769 |
1769 // Allocate the requested number of bytes in the space double aligned if | 1770 // Allocate the requested number of bytes in the space double aligned if |
1770 // possible, return a failure object if not. | 1771 // possible, return a failure object if not. |
1771 MUST_USE_RESULT inline AllocationResult AllocateRawAligned( | 1772 MUST_USE_RESULT inline AllocationResult AllocateRawAligned( |
1772 int size_in_bytes, AllocationAlignment alignment); | 1773 int size_in_bytes, AllocationAlignment alignment); |
1773 | 1774 |
| 1775 // Allocate the requested number of bytes in the space and consider allocation |
| 1776 // alignment if needed. |
| 1777 MUST_USE_RESULT inline AllocationResult AllocateRaw( |
| 1778 int size_in_bytes, AllocationAlignment alignment); |
| 1779 |
1774 // Give a block of memory to the space's free list. It might be added to | 1780 // Give a block of memory to the space's free list. It might be added to |
1775 // the free list or accounted as waste. | 1781 // the free list or accounted as waste. |
1776 // If add_to_freelist is false then just accounting stats are updated and | 1782 // If add_to_freelist is false then just accounting stats are updated and |
1777 // no attempt to add area to free list is made. | 1783 // no attempt to add area to free list is made. |
1778 int Free(Address start, int size_in_bytes) { | 1784 int Free(Address start, int size_in_bytes) { |
1779 int wasted = free_list_.Free(start, size_in_bytes); | 1785 int wasted = free_list_.Free(start, size_in_bytes); |
1780 accounting_stats_.DeallocateBytes(size_in_bytes); | 1786 accounting_stats_.DeallocateBytes(size_in_bytes); |
1781 accounting_stats_.WasteBytes(wasted); | 1787 accounting_stats_.WasteBytes(wasted); |
1782 return size_in_bytes - wasted; | 1788 return size_in_bytes - wasted; |
1783 } | 1789 } |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 Address* allocation_top_address() { return allocation_info_.top_address(); } | 2500 Address* allocation_top_address() { return allocation_info_.top_address(); } |
2495 | 2501 |
2496 // The allocation limit address. | 2502 // The allocation limit address. |
2497 Address* allocation_limit_address() { | 2503 Address* allocation_limit_address() { |
2498 return allocation_info_.limit_address(); | 2504 return allocation_info_.limit_address(); |
2499 } | 2505 } |
2500 | 2506 |
2501 MUST_USE_RESULT INLINE(AllocationResult AllocateRawAligned( | 2507 MUST_USE_RESULT INLINE(AllocationResult AllocateRawAligned( |
2502 int size_in_bytes, AllocationAlignment alignment)); | 2508 int size_in_bytes, AllocationAlignment alignment)); |
2503 | 2509 |
2504 MUST_USE_RESULT INLINE(AllocationResult AllocateRaw(int size_in_bytes)); | 2510 MUST_USE_RESULT INLINE( |
| 2511 AllocationResult AllocateRawUnaligned(int size_in_bytes)); |
| 2512 |
| 2513 MUST_USE_RESULT INLINE(AllocationResult AllocateRaw( |
| 2514 int size_in_bytes, AllocationAlignment alignment)); |
2505 | 2515 |
2506 // Reset the allocation pointer to the beginning of the active semispace. | 2516 // Reset the allocation pointer to the beginning of the active semispace. |
2507 void ResetAllocationInfo(); | 2517 void ResetAllocationInfo(); |
2508 | 2518 |
2509 void UpdateInlineAllocationLimit(int size_in_bytes); | 2519 void UpdateInlineAllocationLimit(int size_in_bytes); |
2510 void LowerInlineAllocationLimit(intptr_t step) { | 2520 void LowerInlineAllocationLimit(intptr_t step) { |
2511 inline_allocation_limit_step_ = step; | 2521 inline_allocation_limit_step_ = step; |
2512 UpdateInlineAllocationLimit(0); | 2522 UpdateInlineAllocationLimit(0); |
2513 top_on_previous_step_ = allocation_info_.top(); | 2523 top_on_previous_step_ = allocation_info_.top(); |
2514 } | 2524 } |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2859 count = 0; | 2869 count = 0; |
2860 } | 2870 } |
2861 // Must be small, since an iteration is used for lookup. | 2871 // Must be small, since an iteration is used for lookup. |
2862 static const int kMaxComments = 64; | 2872 static const int kMaxComments = 64; |
2863 }; | 2873 }; |
2864 #endif | 2874 #endif |
2865 } | 2875 } |
2866 } // namespace v8::internal | 2876 } // namespace v8::internal |
2867 | 2877 |
2868 #endif // V8_HEAP_SPACES_H_ | 2878 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |