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