| 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 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 // forwards most functions to the appropriate semispace. | 2359 // forwards most functions to the appropriate semispace. |
| 2360 | 2360 |
| 2361 class NewSpace : public Space { | 2361 class NewSpace : public Space { |
| 2362 public: | 2362 public: |
| 2363 // Constructor. | 2363 // Constructor. |
| 2364 explicit NewSpace(Heap* heap) | 2364 explicit NewSpace(Heap* heap) |
| 2365 : Space(heap, NEW_SPACE, NOT_EXECUTABLE), | 2365 : Space(heap, NEW_SPACE, NOT_EXECUTABLE), |
| 2366 to_space_(heap, kToSpace), | 2366 to_space_(heap, kToSpace), |
| 2367 from_space_(heap, kFromSpace), | 2367 from_space_(heap, kFromSpace), |
| 2368 reservation_(), | 2368 reservation_(), |
| 2369 inline_allocation_limit_step_(0) {} | 2369 inline_allocation_limit_step_(0), |
| 2370 top_on_previous_step_(0) {} |
| 2370 | 2371 |
| 2371 // Sets up the new space using the given chunk. | 2372 // Sets up the new space using the given chunk. |
| 2372 bool SetUp(int reserved_semispace_size_, int max_semi_space_size); | 2373 bool SetUp(int reserved_semispace_size_, int max_semi_space_size); |
| 2373 | 2374 |
| 2374 // Tears down the space. Heap memory was not allocated by the space, so it | 2375 // Tears down the space. Heap memory was not allocated by the space, so it |
| 2375 // is not deallocated here. | 2376 // is not deallocated here. |
| 2376 void TearDown(); | 2377 void TearDown(); |
| 2377 | 2378 |
| 2378 // True if the space has been set up but not torn down. | 2379 // True if the space has been set up but not torn down. |
| 2379 bool HasBeenSetUp() { | 2380 bool HasBeenSetUp() { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 MUST_USE_RESULT INLINE(AllocationResult AllocateRaw( | 2542 MUST_USE_RESULT INLINE(AllocationResult AllocateRaw( |
| 2542 int size_in_bytes, AllocationAlignment alignment)); | 2543 int size_in_bytes, AllocationAlignment alignment)); |
| 2543 | 2544 |
| 2544 // Reset the allocation pointer to the beginning of the active semispace. | 2545 // Reset the allocation pointer to the beginning of the active semispace. |
| 2545 void ResetAllocationInfo(); | 2546 void ResetAllocationInfo(); |
| 2546 | 2547 |
| 2547 void UpdateInlineAllocationLimit(int size_in_bytes); | 2548 void UpdateInlineAllocationLimit(int size_in_bytes); |
| 2548 void LowerInlineAllocationLimit(intptr_t step) { | 2549 void LowerInlineAllocationLimit(intptr_t step) { |
| 2549 inline_allocation_limit_step_ = step; | 2550 inline_allocation_limit_step_ = step; |
| 2550 UpdateInlineAllocationLimit(0); | 2551 UpdateInlineAllocationLimit(0); |
| 2551 top_on_previous_step_ = allocation_info_.top(); | 2552 top_on_previous_step_ = step ? allocation_info_.top() : 0; |
| 2552 } | 2553 } |
| 2553 | 2554 |
| 2554 // Get the extent of the inactive semispace (for use as a marking stack, | 2555 // Get the extent of the inactive semispace (for use as a marking stack, |
| 2555 // or to zap it). Notice: space-addresses are not necessarily on the | 2556 // or to zap it). Notice: space-addresses are not necessarily on the |
| 2556 // same page, so FromSpaceStart() might be above FromSpaceEnd(). | 2557 // same page, so FromSpaceStart() might be above FromSpaceEnd(). |
| 2557 Address FromSpacePageLow() { return from_space_.page_low(); } | 2558 Address FromSpacePageLow() { return from_space_.page_low(); } |
| 2558 Address FromSpacePageHigh() { return from_space_.page_high(); } | 2559 Address FromSpacePageHigh() { return from_space_.page_high(); } |
| 2559 Address FromSpaceStart() { return from_space_.space_start(); } | 2560 Address FromSpaceStart() { return from_space_.space_start(); } |
| 2560 Address FromSpaceEnd() { return from_space_.space_end(); } | 2561 Address FromSpaceEnd() { return from_space_.space_end(); } |
| 2561 | 2562 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2898 count = 0; | 2899 count = 0; |
| 2899 } | 2900 } |
| 2900 // Must be small, since an iteration is used for lookup. | 2901 // Must be small, since an iteration is used for lookup. |
| 2901 static const int kMaxComments = 64; | 2902 static const int kMaxComments = 64; |
| 2902 }; | 2903 }; |
| 2903 #endif | 2904 #endif |
| 2904 } | 2905 } |
| 2905 } // namespace v8::internal | 2906 } // namespace v8::internal |
| 2906 | 2907 |
| 2907 #endif // V8_HEAP_SPACES_H_ | 2908 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |