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_SPACES_H_ | 5 #ifndef V8_SPACES_H_ |
6 #define V8_SPACES_H_ | 6 #define V8_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/platform/mutex.h" | 10 #include "src/base/platform/mutex.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 void set_next_chunk(MemoryChunk* next) { | 306 void set_next_chunk(MemoryChunk* next) { |
307 base::Release_Store(&next_chunk_, reinterpret_cast<base::AtomicWord>(next)); | 307 base::Release_Store(&next_chunk_, reinterpret_cast<base::AtomicWord>(next)); |
308 } | 308 } |
309 | 309 |
310 void set_prev_chunk(MemoryChunk* prev) { | 310 void set_prev_chunk(MemoryChunk* prev) { |
311 base::Release_Store(&prev_chunk_, reinterpret_cast<base::AtomicWord>(prev)); | 311 base::Release_Store(&prev_chunk_, reinterpret_cast<base::AtomicWord>(prev)); |
312 } | 312 } |
313 | 313 |
314 Space* owner() const { | 314 Space* owner() const { |
315 return owner_; | 315 if ((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) == |
| 316 kFailureTag) { |
| 317 return reinterpret_cast<Space*>(reinterpret_cast<intptr_t>(owner_) - |
| 318 kFailureTag); |
| 319 } else { |
| 320 return NULL; |
| 321 } |
316 } | 322 } |
317 | 323 |
318 void set_owner(Space* space) { | 324 void set_owner(Space* space) { |
319 owner_ = space; | 325 ASSERT((reinterpret_cast<intptr_t>(space) & kFailureTagMask) == 0); |
| 326 owner_ = reinterpret_cast<Address>(space) + kFailureTag; |
| 327 ASSERT((reinterpret_cast<intptr_t>(owner_) & kFailureTagMask) == |
| 328 kFailureTag); |
320 } | 329 } |
321 | 330 |
322 base::VirtualMemory* reserved_memory() { | 331 base::VirtualMemory* reserved_memory() { |
323 return &reservation_; | 332 return &reservation_; |
324 } | 333 } |
325 | 334 |
326 void InitializeReservedMemory() { | 335 void InitializeReservedMemory() { |
327 reservation_.Reset(); | 336 reservation_.Reset(); |
328 } | 337 } |
329 | 338 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 protected: | 684 protected: |
676 size_t size_; | 685 size_t size_; |
677 intptr_t flags_; | 686 intptr_t flags_; |
678 | 687 |
679 // Start and end of allocatable memory on this chunk. | 688 // Start and end of allocatable memory on this chunk. |
680 Address area_start_; | 689 Address area_start_; |
681 Address area_end_; | 690 Address area_end_; |
682 | 691 |
683 // If the chunk needs to remember its memory reservation, it is stored here. | 692 // If the chunk needs to remember its memory reservation, it is stored here. |
684 base::VirtualMemory reservation_; | 693 base::VirtualMemory reservation_; |
685 Space* owner_; | 694 // The identity of the owning space. This is tagged as a failure pointer, but |
| 695 // no failure can be in an object, so this can be distinguished from any entry |
| 696 // in a fixed array. |
| 697 Address owner_; |
686 Heap* heap_; | 698 Heap* heap_; |
687 // Used by the store buffer to keep track of which pages to mark scan-on- | 699 // Used by the store buffer to keep track of which pages to mark scan-on- |
688 // scavenge. | 700 // scavenge. |
689 int store_buffer_counter_; | 701 int store_buffer_counter_; |
690 // Count of bytes marked black on page. | 702 // Count of bytes marked black on page. |
691 int live_byte_count_; | 703 int live_byte_count_; |
692 SlotsBuffer* slots_buffer_; | 704 SlotsBuffer* slots_buffer_; |
693 SkipList* skip_list_; | 705 SkipList* skip_list_; |
694 intptr_t write_barrier_counter_; | 706 intptr_t write_barrier_counter_; |
695 // Used by the incremental marker to keep track of the scanning progress in | 707 // Used by the incremental marker to keep track of the scanning progress in |
(...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 } | 3026 } |
3015 // Must be small, since an iteration is used for lookup. | 3027 // Must be small, since an iteration is used for lookup. |
3016 static const int kMaxComments = 64; | 3028 static const int kMaxComments = 64; |
3017 }; | 3029 }; |
3018 #endif | 3030 #endif |
3019 | 3031 |
3020 | 3032 |
3021 } } // namespace v8::internal | 3033 } } // namespace v8::internal |
3022 | 3034 |
3023 #endif // V8_SPACES_H_ | 3035 #endif // V8_SPACES_H_ |
OLD | NEW |