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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 FreeBlock(void* start_arg, size_t size_arg) | 1006 FreeBlock(void* start_arg, size_t size_arg) |
1007 : start(static_cast<Address>(start_arg)), size(size_arg) { | 1007 : start(static_cast<Address>(start_arg)), size(size_arg) { |
1008 DCHECK(IsAddressAligned(start, MemoryChunk::kAlignment)); | 1008 DCHECK(IsAddressAligned(start, MemoryChunk::kAlignment)); |
1009 DCHECK(size >= static_cast<size_t>(Page::kPageSize)); | 1009 DCHECK(size >= static_cast<size_t>(Page::kPageSize)); |
1010 } | 1010 } |
1011 | 1011 |
1012 Address start; | 1012 Address start; |
1013 size_t size; | 1013 size_t size; |
1014 }; | 1014 }; |
1015 | 1015 |
1016 // All access to free_list_ require to take the free_list_mutex_. GC threads | 1016 // The global mutex guards free_list_ and allocation_list_ as GC threads may |
1017 // may access the free_list_ concurrently to the main thread. | 1017 // access both lists concurrently to the main thread. |
1018 base::Mutex free_list_mutex_; | 1018 base::Mutex code_range_mutex_; |
1019 | 1019 |
1020 // Freed blocks of memory are added to the free list. When the allocation | 1020 // Freed blocks of memory are added to the free list. When the allocation |
1021 // list is exhausted, the free list is sorted and merged to make the new | 1021 // list is exhausted, the free list is sorted and merged to make the new |
1022 // allocation list. | 1022 // allocation list. |
1023 List<FreeBlock> free_list_; | 1023 List<FreeBlock> free_list_; |
1024 | 1024 |
1025 // Memory is allocated from the free blocks on the allocation list. | 1025 // Memory is allocated from the free blocks on the allocation list. |
1026 // The block at current_allocation_block_index_ is the current block. | 1026 // The block at current_allocation_block_index_ is the current block. |
1027 List<FreeBlock> allocation_list_; | 1027 List<FreeBlock> allocation_list_; |
1028 int current_allocation_block_index_; | 1028 int current_allocation_block_index_; |
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 count = 0; | 2921 count = 0; |
2922 } | 2922 } |
2923 // Must be small, since an iteration is used for lookup. | 2923 // Must be small, since an iteration is used for lookup. |
2924 static const int kMaxComments = 64; | 2924 static const int kMaxComments = 64; |
2925 }; | 2925 }; |
2926 #endif | 2926 #endif |
2927 } | 2927 } |
2928 } // namespace v8::internal | 2928 } // namespace v8::internal |
2929 | 2929 |
2930 #endif // V8_HEAP_SPACES_H_ | 2930 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |