Chromium Code Reviews| 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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 // Identity used in error reporting. | 834 // Identity used in error reporting. |
| 835 AllocationSpace identity() { return id_; } | 835 AllocationSpace identity() { return id_; } |
| 836 | 836 |
| 837 // Returns allocated size. | 837 // Returns allocated size. |
| 838 virtual intptr_t Size() = 0; | 838 virtual intptr_t Size() = 0; |
| 839 | 839 |
| 840 // Returns size of objects. Can differ from the allocated size | 840 // Returns size of objects. Can differ from the allocated size |
| 841 // (e.g. see LargeObjectSpace). | 841 // (e.g. see LargeObjectSpace). |
| 842 virtual intptr_t SizeOfObjects() { return Size(); } | 842 virtual intptr_t SizeOfObjects() { return Size(); } |
| 843 | 843 |
| 844 // Return the total amount of memory committed for new space. | |
| 845 virtual intptr_t CommittedMemory() = 0; | |
| 846 | |
| 847 // Approximate amount of physical memory committed for this space. | |
| 848 virtual size_t CommittedPhysicalMemory() = 0; | |
| 849 | |
| 850 // Return the available bytes without growing. | |
| 851 virtual intptr_t Available() = 0; | |
| 852 | |
| 844 virtual int RoundSizeDownToObjectAlignment(int size) { | 853 virtual int RoundSizeDownToObjectAlignment(int size) { |
| 845 if (id_ == CODE_SPACE) { | 854 if (id_ == CODE_SPACE) { |
| 846 return RoundDown(size, kCodeAlignment); | 855 return RoundDown(size, kCodeAlignment); |
| 847 } else { | 856 } else { |
| 848 return RoundDown(size, kPointerSize); | 857 return RoundDown(size, kPointerSize); |
| 849 } | 858 } |
| 850 } | 859 } |
| 851 | 860 |
| 852 #ifdef DEBUG | 861 #ifdef DEBUG |
| 853 virtual void Print() = 0; | 862 virtual void Print() = 0; |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1675 void RepairFreeListsAfterDeserialization(); | 1684 void RepairFreeListsAfterDeserialization(); |
| 1676 | 1685 |
| 1677 // Prepares for a mark-compact GC. | 1686 // Prepares for a mark-compact GC. |
| 1678 void PrepareForMarkCompact(); | 1687 void PrepareForMarkCompact(); |
| 1679 | 1688 |
| 1680 // Current capacity without growing (Size() + Available()). | 1689 // Current capacity without growing (Size() + Available()). |
| 1681 intptr_t Capacity() { return accounting_stats_.Capacity(); } | 1690 intptr_t Capacity() { return accounting_stats_.Capacity(); } |
| 1682 | 1691 |
| 1683 // Total amount of memory committed for this space. For paged | 1692 // Total amount of memory committed for this space. For paged |
| 1684 // spaces this equals the capacity. | 1693 // spaces this equals the capacity. |
| 1685 intptr_t CommittedMemory() { return Capacity(); } | 1694 intptr_t CommittedMemory() override { return Capacity(); } |
| 1686 | 1695 |
| 1687 // The maximum amount of memory ever committed for this space. | 1696 // The maximum amount of memory ever committed for this space. |
| 1688 intptr_t MaximumCommittedMemory() { return accounting_stats_.MaxCapacity(); } | 1697 intptr_t MaximumCommittedMemory() { return accounting_stats_.MaxCapacity(); } |
| 1689 | 1698 |
| 1690 // Approximate amount of physical memory committed for this space. | 1699 // Approximate amount of physical memory committed for this space. |
| 1691 size_t CommittedPhysicalMemory(); | 1700 size_t CommittedPhysicalMemory() override; |
| 1692 | 1701 |
| 1693 struct SizeStats { | 1702 struct SizeStats { |
| 1694 intptr_t Total() { | 1703 intptr_t Total() { |
| 1695 return small_size_ + medium_size_ + large_size_ + huge_size_; | 1704 return small_size_ + medium_size_ + large_size_ + huge_size_; |
| 1696 } | 1705 } |
| 1697 | 1706 |
| 1698 intptr_t small_size_; | 1707 intptr_t small_size_; |
| 1699 intptr_t medium_size_; | 1708 intptr_t medium_size_; |
| 1700 intptr_t large_size_; | 1709 intptr_t large_size_; |
| 1701 intptr_t huge_size_; | 1710 intptr_t huge_size_; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1716 | 1725 |
| 1717 // Increases the number of available bytes of that space. | 1726 // Increases the number of available bytes of that space. |
| 1718 void AddToAccountingStats(intptr_t bytes) { | 1727 void AddToAccountingStats(intptr_t bytes) { |
| 1719 accounting_stats_.DeallocateBytes(bytes); | 1728 accounting_stats_.DeallocateBytes(bytes); |
| 1720 } | 1729 } |
| 1721 | 1730 |
| 1722 // Available bytes without growing. These are the bytes on the free list. | 1731 // Available bytes without growing. These are the bytes on the free list. |
| 1723 // The bytes in the linear allocation area are not included in this total | 1732 // The bytes in the linear allocation area are not included in this total |
| 1724 // because updating the stats would slow down allocation. New pages are | 1733 // because updating the stats would slow down allocation. New pages are |
| 1725 // immediately added to the free list so they show up here. | 1734 // immediately added to the free list so they show up here. |
| 1726 intptr_t Available() { return free_list_.available(); } | 1735 intptr_t Available() override { return free_list_.available(); } |
| 1727 | 1736 |
| 1728 // Allocated bytes in this space. Garbage bytes that were not found due to | 1737 // Allocated bytes in this space. Garbage bytes that were not found due to |
| 1729 // concurrent sweeping are counted as being allocated! The bytes in the | 1738 // concurrent sweeping are counted as being allocated! The bytes in the |
| 1730 // current linear allocation area (between top and limit) are also counted | 1739 // current linear allocation area (between top and limit) are also counted |
| 1731 // here. | 1740 // here. |
| 1732 virtual intptr_t Size() { return accounting_stats_.Size(); } | 1741 virtual intptr_t Size() override { return accounting_stats_.Size(); } |
|
rmcilroy
2015/04/16 13:49:05
Only one of 'virtual' or 'override' [1], so in thi
ssid
2015/04/16 16:40:29
Thanks, done.
| |
| 1733 | 1742 |
| 1734 // As size, but the bytes in lazily swept pages are estimated and the bytes | 1743 // As size, but the bytes in lazily swept pages are estimated and the bytes |
| 1735 // in the current linear allocation area are not included. | 1744 // in the current linear allocation area are not included. |
| 1736 virtual intptr_t SizeOfObjects(); | 1745 virtual intptr_t SizeOfObjects() override; |
| 1737 | 1746 |
| 1738 // Wasted bytes in this space. These are just the bytes that were thrown away | 1747 // Wasted bytes in this space. These are just the bytes that were thrown away |
| 1739 // due to being too small to use for allocation. They do not include the | 1748 // due to being too small to use for allocation. They do not include the |
| 1740 // free bytes that were not found at all due to lazy sweeping. | 1749 // free bytes that were not found at all due to lazy sweeping. |
| 1741 virtual intptr_t Waste() { return accounting_stats_.Waste(); } | 1750 virtual intptr_t Waste() { return accounting_stats_.Waste(); } |
| 1742 | 1751 |
| 1743 // Returns the allocation pointer in this space. | 1752 // Returns the allocation pointer in this space. |
| 1744 Address top() { return allocation_info_.top(); } | 1753 Address top() { return allocation_info_.top(); } |
| 1745 Address limit() { return allocation_info_.limit(); } | 1754 Address limit() { return allocation_info_.limit(); } |
| 1746 | 1755 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1801 // Verify integrity of this space. | 1810 // Verify integrity of this space. |
| 1802 virtual void Verify(ObjectVisitor* visitor); | 1811 virtual void Verify(ObjectVisitor* visitor); |
| 1803 | 1812 |
| 1804 // Overridden by subclasses to verify space-specific object | 1813 // Overridden by subclasses to verify space-specific object |
| 1805 // properties (e.g., only maps or free-list nodes are in map space). | 1814 // properties (e.g., only maps or free-list nodes are in map space). |
| 1806 virtual void VerifyObject(HeapObject* obj) {} | 1815 virtual void VerifyObject(HeapObject* obj) {} |
| 1807 #endif | 1816 #endif |
| 1808 | 1817 |
| 1809 #ifdef DEBUG | 1818 #ifdef DEBUG |
| 1810 // Print meta info and objects in this space. | 1819 // Print meta info and objects in this space. |
| 1811 virtual void Print(); | 1820 virtual void Print() override; |
| 1812 | 1821 |
| 1813 // Reports statistics for the space | 1822 // Reports statistics for the space |
| 1814 void ReportStatistics(); | 1823 void ReportStatistics(); |
| 1815 | 1824 |
| 1816 // Report code object related statistics | 1825 // Report code object related statistics |
| 1817 void CollectCodeStatistics(); | 1826 void CollectCodeStatistics(); |
| 1818 static void ReportCodeStatistics(Isolate* isolate); | 1827 static void ReportCodeStatistics(Isolate* isolate); |
| 1819 static void ResetCodeStatistics(Isolate* isolate); | 1828 static void ResetCodeStatistics(Isolate* isolate); |
| 1820 #endif | 1829 #endif |
| 1821 | 1830 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2126 reinterpret_cast<uintptr_t>(start_); | 2135 reinterpret_cast<uintptr_t>(start_); |
| 2127 } | 2136 } |
| 2128 | 2137 |
| 2129 // True if the object is a heap object in the address range of this | 2138 // True if the object is a heap object in the address range of this |
| 2130 // semispace (not necessarily below the allocation pointer). | 2139 // semispace (not necessarily below the allocation pointer). |
| 2131 bool Contains(Object* o) { | 2140 bool Contains(Object* o) { |
| 2132 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; | 2141 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; |
| 2133 } | 2142 } |
| 2134 | 2143 |
| 2135 // If we don't have these here then SemiSpace will be abstract. However | 2144 // If we don't have these here then SemiSpace will be abstract. However |
| 2136 // they should never be called. | 2145 // they should never be called: |
| 2137 virtual intptr_t Size() { | 2146 |
| 2147 virtual intptr_t Size() override { | |
| 2138 UNREACHABLE(); | 2148 UNREACHABLE(); |
| 2139 return 0; | 2149 return 0; |
| 2140 } | 2150 } |
| 2141 | 2151 |
| 2152 virtual intptr_t SizeOfObjects() override { return Size(); } | |
| 2153 | |
| 2154 virtual intptr_t CommittedMemory() override { | |
| 2155 UNREACHABLE(); | |
| 2156 return 0; | |
| 2157 } | |
| 2158 | |
| 2159 virtual intptr_t Available() override { | |
| 2160 UNREACHABLE(); | |
| 2161 return 0; | |
| 2162 } | |
| 2163 | |
| 2164 | |
| 2142 bool is_committed() { return committed_; } | 2165 bool is_committed() { return committed_; } |
| 2143 bool Commit(); | 2166 bool Commit(); |
| 2144 bool Uncommit(); | 2167 bool Uncommit(); |
| 2145 | 2168 |
| 2146 NewSpacePage* first_page() { return anchor_.next_page(); } | 2169 NewSpacePage* first_page() { return anchor_.next_page(); } |
| 2147 NewSpacePage* current_page() { return current_page_; } | 2170 NewSpacePage* current_page() { return current_page_; } |
| 2148 | 2171 |
| 2149 #ifdef VERIFY_HEAP | 2172 #ifdef VERIFY_HEAP |
| 2150 virtual void Verify(); | 2173 virtual void Verify(); |
| 2151 #endif | 2174 #endif |
| 2152 | 2175 |
| 2153 #ifdef DEBUG | 2176 #ifdef DEBUG |
| 2154 virtual void Print(); | 2177 virtual void Print() override; |
|
rmcilroy
2015/04/16 13:49:05
I don't think you intended to change this.
ssid
2015/04/16 16:40:29
This was needed to maintain consistency in the fil
| |
| 2155 // Validate a range of of addresses in a SemiSpace. | 2178 // Validate a range of of addresses in a SemiSpace. |
| 2156 // The "from" address must be on a page prior to the "to" address, | 2179 // The "from" address must be on a page prior to the "to" address, |
| 2157 // in the linked page order, or it must be earlier on the same page. | 2180 // in the linked page order, or it must be earlier on the same page. |
| 2158 static void AssertValidRange(Address from, Address to); | 2181 static void AssertValidRange(Address from, Address to); |
| 2159 #else | 2182 #else |
| 2160 // Do nothing. | 2183 // Do nothing. |
| 2161 inline static void AssertValidRange(Address from, Address to) {} | 2184 inline static void AssertValidRange(Address from, Address to) {} |
| 2162 #endif | 2185 #endif |
| 2163 | 2186 |
| 2164 // Returns the current total capacity of the semispace. | 2187 // Returns the current total capacity of the semispace. |
| 2165 int TotalCapacity() { return total_capacity_; } | 2188 int TotalCapacity() { return total_capacity_; } |
| 2166 | 2189 |
| 2167 // Returns the target for total capacity of the semispace. | 2190 // Returns the target for total capacity of the semispace. |
| 2168 int TargetCapacity() { return target_capacity_; } | 2191 int TargetCapacity() { return target_capacity_; } |
| 2169 | 2192 |
| 2170 // Returns the maximum total capacity of the semispace. | 2193 // Returns the maximum total capacity of the semispace. |
| 2171 int MaximumTotalCapacity() { return maximum_total_capacity_; } | 2194 int MaximumTotalCapacity() { return maximum_total_capacity_; } |
| 2172 | 2195 |
| 2173 // Returns the initial capacity of the semispace. | 2196 // Returns the initial capacity of the semispace. |
| 2174 int InitialTotalCapacity() { return initial_total_capacity_; } | 2197 int InitialTotalCapacity() { return initial_total_capacity_; } |
| 2175 | 2198 |
| 2176 SemiSpaceId id() { return id_; } | 2199 SemiSpaceId id() { return id_; } |
| 2177 | 2200 |
| 2178 static void Swap(SemiSpace* from, SemiSpace* to); | 2201 static void Swap(SemiSpace* from, SemiSpace* to); |
| 2179 | 2202 |
| 2180 // Returns the maximum amount of memory ever committed by the semi space. | 2203 // Returns the maximum amount of memory ever committed by the semi space. |
| 2181 size_t MaximumCommittedMemory() { return maximum_committed_; } | 2204 size_t MaximumCommittedMemory() { return maximum_committed_; } |
| 2182 | 2205 |
| 2183 // Approximate amount of physical memory committed for this space. | 2206 // Approximate amount of physical memory committed for this space. |
| 2184 size_t CommittedPhysicalMemory(); | 2207 size_t CommittedPhysicalMemory() override; |
| 2185 | 2208 |
| 2186 private: | 2209 private: |
| 2187 // Flips the semispace between being from-space and to-space. | 2210 // Flips the semispace between being from-space and to-space. |
| 2188 // Copies the flags into the masked positions on all pages in the space. | 2211 // Copies the flags into the masked positions on all pages in the space. |
| 2189 void FlipPages(intptr_t flags, intptr_t flag_mask); | 2212 void FlipPages(intptr_t flags, intptr_t flag_mask); |
| 2190 | 2213 |
| 2191 // Updates Capacity and MaximumCommitted based on new capacity. | 2214 // Updates Capacity and MaximumCommitted based on new capacity. |
| 2192 void SetCapacity(int new_capacity); | 2215 void SetCapacity(int new_capacity); |
| 2193 | 2216 |
| 2194 NewSpacePage* anchor() { return &anchor_; } | 2217 NewSpacePage* anchor() { return &anchor_; } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2353 return (reinterpret_cast<uintptr_t>(a) & address_mask_) == | 2376 return (reinterpret_cast<uintptr_t>(a) & address_mask_) == |
| 2354 reinterpret_cast<uintptr_t>(start_); | 2377 reinterpret_cast<uintptr_t>(start_); |
| 2355 } | 2378 } |
| 2356 | 2379 |
| 2357 bool Contains(Object* o) { | 2380 bool Contains(Object* o) { |
| 2358 Address a = reinterpret_cast<Address>(o); | 2381 Address a = reinterpret_cast<Address>(o); |
| 2359 return (reinterpret_cast<uintptr_t>(a) & object_mask_) == object_expected_; | 2382 return (reinterpret_cast<uintptr_t>(a) & object_mask_) == object_expected_; |
| 2360 } | 2383 } |
| 2361 | 2384 |
| 2362 // Return the allocated bytes in the active semispace. | 2385 // Return the allocated bytes in the active semispace. |
| 2363 virtual intptr_t Size() { | 2386 virtual intptr_t Size() override { |
| 2364 return pages_used_ * NewSpacePage::kAreaSize + | 2387 return pages_used_ * NewSpacePage::kAreaSize + |
| 2365 static_cast<int>(top() - to_space_.page_low()); | 2388 static_cast<int>(top() - to_space_.page_low()); |
| 2366 } | 2389 } |
| 2367 | 2390 |
| 2368 // The same, but returning an int. We have to have the one that returns | 2391 // The same, but returning an int. We have to have the one that returns |
| 2369 // intptr_t because it is inherited, but if we know we are dealing with the | 2392 // intptr_t because it is inherited, but if we know we are dealing with the |
| 2370 // new space, which can't get as big as the other spaces then this is useful: | 2393 // new space, which can't get as big as the other spaces then this is useful: |
| 2371 int SizeAsInt() { return static_cast<int>(Size()); } | 2394 int SizeAsInt() { return static_cast<int>(Size()); } |
| 2372 | 2395 |
| 2373 // Return the allocatable capacity of a semispace. | 2396 // Return the allocatable capacity of a semispace. |
| 2374 intptr_t Capacity() { | 2397 intptr_t Capacity() { |
| 2375 SLOW_DCHECK(to_space_.TotalCapacity() == from_space_.TotalCapacity()); | 2398 SLOW_DCHECK(to_space_.TotalCapacity() == from_space_.TotalCapacity()); |
| 2376 return (to_space_.TotalCapacity() / Page::kPageSize) * | 2399 return (to_space_.TotalCapacity() / Page::kPageSize) * |
| 2377 NewSpacePage::kAreaSize; | 2400 NewSpacePage::kAreaSize; |
| 2378 } | 2401 } |
| 2379 | 2402 |
| 2380 // Return the current size of a semispace, allocatable and non-allocatable | 2403 // Return the current size of a semispace, allocatable and non-allocatable |
| 2381 // memory. | 2404 // memory. |
| 2382 intptr_t TotalCapacity() { | 2405 intptr_t TotalCapacity() { |
| 2383 DCHECK(to_space_.TotalCapacity() == from_space_.TotalCapacity()); | 2406 DCHECK(to_space_.TotalCapacity() == from_space_.TotalCapacity()); |
| 2384 return to_space_.TotalCapacity(); | 2407 return to_space_.TotalCapacity(); |
| 2385 } | 2408 } |
| 2386 | 2409 |
| 2387 // Return the total amount of memory committed for new space. | 2410 // Return the total amount of memory committed for new space. |
| 2388 intptr_t CommittedMemory() { | 2411 intptr_t CommittedMemory() override { |
| 2389 if (from_space_.is_committed()) return 2 * Capacity(); | 2412 if (from_space_.is_committed()) return 2 * Capacity(); |
| 2390 return TotalCapacity(); | 2413 return TotalCapacity(); |
| 2391 } | 2414 } |
| 2392 | 2415 |
| 2393 // Return the total amount of memory committed for new space. | 2416 // Return the total amount of memory committed for new space. |
| 2394 intptr_t MaximumCommittedMemory() { | 2417 intptr_t MaximumCommittedMemory() { |
| 2395 return to_space_.MaximumCommittedMemory() + | 2418 return to_space_.MaximumCommittedMemory() + |
| 2396 from_space_.MaximumCommittedMemory(); | 2419 from_space_.MaximumCommittedMemory(); |
| 2397 } | 2420 } |
| 2398 | 2421 |
| 2399 // Approximate amount of physical memory committed for this space. | 2422 // Approximate amount of physical memory committed for this space. |
| 2400 size_t CommittedPhysicalMemory(); | 2423 size_t CommittedPhysicalMemory() override; |
| 2401 | 2424 |
| 2402 // Return the available bytes without growing. | 2425 // Return the available bytes without growing. |
| 2403 intptr_t Available() { return Capacity() - Size(); } | 2426 intptr_t Available() override { return Capacity() - Size(); } |
| 2404 | 2427 |
| 2405 // Return the maximum capacity of a semispace. | 2428 // Return the maximum capacity of a semispace. |
| 2406 int MaximumCapacity() { | 2429 int MaximumCapacity() { |
| 2407 DCHECK(to_space_.MaximumTotalCapacity() == | 2430 DCHECK(to_space_.MaximumTotalCapacity() == |
| 2408 from_space_.MaximumTotalCapacity()); | 2431 from_space_.MaximumTotalCapacity()); |
| 2409 return to_space_.MaximumTotalCapacity(); | 2432 return to_space_.MaximumTotalCapacity(); |
| 2410 } | 2433 } |
| 2411 | 2434 |
| 2412 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } | 2435 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } |
| 2413 | 2436 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2510 // if successful. | 2533 // if successful. |
| 2511 bool AddFreshPage(); | 2534 bool AddFreshPage(); |
| 2512 | 2535 |
| 2513 #ifdef VERIFY_HEAP | 2536 #ifdef VERIFY_HEAP |
| 2514 // Verify the active semispace. | 2537 // Verify the active semispace. |
| 2515 virtual void Verify(); | 2538 virtual void Verify(); |
| 2516 #endif | 2539 #endif |
| 2517 | 2540 |
| 2518 #ifdef DEBUG | 2541 #ifdef DEBUG |
| 2519 // Print the active semispace. | 2542 // Print the active semispace. |
| 2520 virtual void Print() { to_space_.Print(); } | 2543 virtual void Print() override { to_space_.Print(); } |
| 2521 #endif | 2544 #endif |
| 2522 | 2545 |
| 2523 // Iterates the active semispace to collect statistics. | 2546 // Iterates the active semispace to collect statistics. |
| 2524 void CollectStatistics(); | 2547 void CollectStatistics(); |
| 2525 // Reports previously collected statistics of the active semispace. | 2548 // Reports previously collected statistics of the active semispace. |
| 2526 void ReportStatistics(); | 2549 void ReportStatistics(); |
| 2527 // Clears previously collected statistics. | 2550 // Clears previously collected statistics. |
| 2528 void ClearHistograms(); | 2551 void ClearHistograms(); |
| 2529 | 2552 |
| 2530 // Record the allocation or promotion of a heap object. Note that we don't | 2553 // Record the allocation or promotion of a heap object. Note that we don't |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2681 } | 2704 } |
| 2682 | 2705 |
| 2683 // Shared implementation of AllocateRaw, AllocateRawCode and | 2706 // Shared implementation of AllocateRaw, AllocateRawCode and |
| 2684 // AllocateRawFixedArray. | 2707 // AllocateRawFixedArray. |
| 2685 MUST_USE_RESULT AllocationResult | 2708 MUST_USE_RESULT AllocationResult |
| 2686 AllocateRaw(int object_size, Executability executable); | 2709 AllocateRaw(int object_size, Executability executable); |
| 2687 | 2710 |
| 2688 bool CanAllocateSize(int size) { return Size() + size <= max_capacity_; } | 2711 bool CanAllocateSize(int size) { return Size() + size <= max_capacity_; } |
| 2689 | 2712 |
| 2690 // Available bytes for objects in this space. | 2713 // Available bytes for objects in this space. |
| 2691 inline intptr_t Available(); | 2714 inline intptr_t Available() override; |
| 2692 | 2715 |
| 2693 virtual intptr_t Size() { return size_; } | 2716 virtual intptr_t Size() override { return size_; } |
| 2694 | 2717 |
| 2695 virtual intptr_t SizeOfObjects() { return objects_size_; } | 2718 virtual intptr_t SizeOfObjects() override { return objects_size_; } |
| 2696 | 2719 |
| 2697 intptr_t MaximumCommittedMemory() { return maximum_committed_; } | 2720 intptr_t MaximumCommittedMemory() { return maximum_committed_; } |
| 2698 | 2721 |
| 2699 intptr_t CommittedMemory() { return Size(); } | 2722 intptr_t CommittedMemory() override { return Size(); } |
| 2700 | 2723 |
| 2701 // Approximate amount of physical memory committed for this space. | 2724 // Approximate amount of physical memory committed for this space. |
| 2702 size_t CommittedPhysicalMemory(); | 2725 size_t CommittedPhysicalMemory() override; |
| 2703 | 2726 |
| 2704 int PageCount() { return page_count_; } | 2727 int PageCount() { return page_count_; } |
| 2705 | 2728 |
| 2706 // Finds an object for a given address, returns a Smi if it is not found. | 2729 // Finds an object for a given address, returns a Smi if it is not found. |
| 2707 // The function iterates through all objects in this space, may be slow. | 2730 // The function iterates through all objects in this space, may be slow. |
| 2708 Object* FindObject(Address a); | 2731 Object* FindObject(Address a); |
| 2709 | 2732 |
| 2710 // Finds a large object page containing the given address, returns NULL | 2733 // Finds a large object page containing the given address, returns NULL |
| 2711 // if such a page doesn't exist. | 2734 // if such a page doesn't exist. |
| 2712 LargePage* FindPage(Address a); | 2735 LargePage* FindPage(Address a); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2836 count = 0; | 2859 count = 0; |
| 2837 } | 2860 } |
| 2838 // Must be small, since an iteration is used for lookup. | 2861 // Must be small, since an iteration is used for lookup. |
| 2839 static const int kMaxComments = 64; | 2862 static const int kMaxComments = 64; |
| 2840 }; | 2863 }; |
| 2841 #endif | 2864 #endif |
| 2842 } | 2865 } |
| 2843 } // namespace v8::internal | 2866 } // namespace v8::internal |
| 2844 | 2867 |
| 2845 #endif // V8_HEAP_SPACES_H_ | 2868 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |