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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 Page* page = Page::FromAddress(addr); | 1007 Page* page = Page::FromAddress(addr); |
1008 SkipList* list = page->skip_list(); | 1008 SkipList* list = page->skip_list(); |
1009 if (list == NULL) { | 1009 if (list == NULL) { |
1010 list = new SkipList(); | 1010 list = new SkipList(); |
1011 page->set_skip_list(list); | 1011 page->set_skip_list(list); |
1012 } | 1012 } |
1013 | 1013 |
1014 list->AddObject(addr, size); | 1014 list->AddObject(addr, size); |
1015 } | 1015 } |
1016 | 1016 |
| 1017 void Lock() { mutex_.Lock(); } |
| 1018 |
| 1019 void Unlock() { mutex_.Unlock(); } |
| 1020 |
1017 private: | 1021 private: |
1018 static const int kRegionSizeLog2 = 13; | 1022 static const int kRegionSizeLog2 = 13; |
1019 static const int kRegionSize = 1 << kRegionSizeLog2; | 1023 static const int kRegionSize = 1 << kRegionSizeLog2; |
1020 static const int kSize = Page::kPageSize / kRegionSize; | 1024 static const int kSize = Page::kPageSize / kRegionSize; |
1021 | 1025 |
1022 STATIC_ASSERT(Page::kPageSize % kRegionSize == 0); | 1026 STATIC_ASSERT(Page::kPageSize % kRegionSize == 0); |
1023 | 1027 |
1024 Address starts_[kSize]; | 1028 Address starts_[kSize]; |
| 1029 base::Mutex mutex_; |
1025 }; | 1030 }; |
1026 | 1031 |
1027 | 1032 |
1028 // ---------------------------------------------------------------------------- | 1033 // ---------------------------------------------------------------------------- |
1029 // A space acquires chunks of memory from the operating system. The memory | 1034 // A space acquires chunks of memory from the operating system. The memory |
1030 // allocator allocated and deallocates pages for the paged heap spaces and large | 1035 // allocator allocated and deallocates pages for the paged heap spaces and large |
1031 // pages for large object space. | 1036 // pages for large object space. |
1032 // | 1037 // |
1033 // Each space has to manage it's own pages. | 1038 // Each space has to manage it's own pages. |
1034 // | 1039 // |
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2885 count = 0; | 2890 count = 0; |
2886 } | 2891 } |
2887 // Must be small, since an iteration is used for lookup. | 2892 // Must be small, since an iteration is used for lookup. |
2888 static const int kMaxComments = 64; | 2893 static const int kMaxComments = 64; |
2889 }; | 2894 }; |
2890 #endif | 2895 #endif |
2891 } | 2896 } |
2892 } // namespace v8::internal | 2897 } // namespace v8::internal |
2893 | 2898 |
2894 #endif // V8_HEAP_SPACES_H_ | 2899 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |