| 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/atomic-utils.h" | 9 #include "src/atomic-utils.h" |
| 10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
| (...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2374 bool AdvancePage() { | 2374 bool AdvancePage() { |
| 2375 Page* next_page = current_page_->next_page(); | 2375 Page* next_page = current_page_->next_page(); |
| 2376 if (next_page == anchor()) return false; | 2376 if (next_page == anchor()) return false; |
| 2377 current_page_ = next_page; | 2377 current_page_ = next_page; |
| 2378 return true; | 2378 return true; |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 // Resets the space to using the first page. | 2381 // Resets the space to using the first page. |
| 2382 void Reset(); | 2382 void Reset(); |
| 2383 | 2383 |
| 2384 void ReplaceWithEmptyPage(Page* page); | 2384 bool ReplaceWithEmptyPage(Page* page); |
| 2385 | 2385 |
| 2386 // Age mark accessors. | 2386 // Age mark accessors. |
| 2387 Address age_mark() { return age_mark_; } | 2387 Address age_mark() { return age_mark_; } |
| 2388 void set_age_mark(Address mark); | 2388 void set_age_mark(Address mark); |
| 2389 | 2389 |
| 2390 // Returns the current capacity of the semispace. | 2390 // Returns the current capacity of the semispace. |
| 2391 int current_capacity() { return current_capacity_; } | 2391 int current_capacity() { return current_capacity_; } |
| 2392 | 2392 |
| 2393 // Returns the maximum capacity of the semispace. | 2393 // Returns the maximum capacity of the semispace. |
| 2394 int maximum_capacity() { return maximum_capacity_; } | 2394 int maximum_capacity() { return maximum_capacity_; } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 } | 2596 } |
| 2597 | 2597 |
| 2598 // Approximate amount of physical memory committed for this space. | 2598 // Approximate amount of physical memory committed for this space. |
| 2599 size_t CommittedPhysicalMemory() override; | 2599 size_t CommittedPhysicalMemory() override; |
| 2600 | 2600 |
| 2601 // Return the available bytes without growing. | 2601 // Return the available bytes without growing. |
| 2602 intptr_t Available() override { return Capacity() - Size(); } | 2602 intptr_t Available() override { return Capacity() - Size(); } |
| 2603 | 2603 |
| 2604 inline size_t AllocatedSinceLastGC(); | 2604 inline size_t AllocatedSinceLastGC(); |
| 2605 | 2605 |
| 2606 void ReplaceWithEmptyPage(Page* page) { | 2606 bool ReplaceWithEmptyPage(Page* page) { |
| 2607 // This method is called after flipping the semispace. | 2607 // This method is called after flipping the semispace. |
| 2608 DCHECK(page->InFromSpace()); | 2608 DCHECK(page->InFromSpace()); |
| 2609 from_space_.ReplaceWithEmptyPage(page); | 2609 return from_space_.ReplaceWithEmptyPage(page); |
| 2610 } | 2610 } |
| 2611 | 2611 |
| 2612 // Return the maximum capacity of a semispace. | 2612 // Return the maximum capacity of a semispace. |
| 2613 int MaximumCapacity() { | 2613 int MaximumCapacity() { |
| 2614 DCHECK(to_space_.maximum_capacity() == from_space_.maximum_capacity()); | 2614 DCHECK(to_space_.maximum_capacity() == from_space_.maximum_capacity()); |
| 2615 return to_space_.maximum_capacity(); | 2615 return to_space_.maximum_capacity(); |
| 2616 } | 2616 } |
| 2617 | 2617 |
| 2618 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } | 2618 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } |
| 2619 | 2619 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3038 count = 0; | 3038 count = 0; |
| 3039 } | 3039 } |
| 3040 // Must be small, since an iteration is used for lookup. | 3040 // Must be small, since an iteration is used for lookup. |
| 3041 static const int kMaxComments = 64; | 3041 static const int kMaxComments = 64; |
| 3042 }; | 3042 }; |
| 3043 #endif | 3043 #endif |
| 3044 } // namespace internal | 3044 } // namespace internal |
| 3045 } // namespace v8 | 3045 } // namespace v8 |
| 3046 | 3046 |
| 3047 #endif // V8_HEAP_SPACES_H_ | 3047 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |