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