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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->WasSwept()) { | 885 if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->WasSwept()) { |
886 static_cast<PagedSpace*>(chunk->owner())->IncrementUnsweptFreeBytes(-by); | 886 static_cast<PagedSpace*>(chunk->owner())->IncrementUnsweptFreeBytes(-by); |
887 } | 887 } |
888 chunk->IncrementLiveBytes(by); | 888 chunk->IncrementLiveBytes(by); |
889 } | 889 } |
890 | 890 |
891 | 891 |
892 // ----------------------------------------------------------------------------- | 892 // ----------------------------------------------------------------------------- |
893 // PagedSpace implementation | 893 // PagedSpace implementation |
894 | 894 |
895 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id, | 895 PagedSpace::PagedSpace(Heap* heap, intptr_t max_capacity, AllocationSpace space, |
896 Executability executable) | 896 Executability executable) |
897 : Space(heap, id, executable), | 897 : Space(heap, space, executable), |
898 free_list_(this), | 898 free_list_(this), |
899 unswept_free_bytes_(0), | 899 unswept_free_bytes_(0), |
900 end_of_unswept_pages_(NULL), | 900 end_of_unswept_pages_(NULL), |
901 emergency_memory_(NULL) { | 901 emergency_memory_(NULL) { |
902 if (id == CODE_SPACE) { | 902 area_size_ = MemoryAllocator::PageAreaSize(space); |
903 area_size_ = heap->isolate()->memory_allocator()->CodePageAreaSize(); | |
904 } else { | |
905 area_size_ = Page::kPageSize - Page::kObjectStartOffset; | |
906 } | |
907 max_capacity_ = | 903 max_capacity_ = |
908 (RoundDown(max_capacity, Page::kPageSize) / Page::kPageSize) * AreaSize(); | 904 (RoundDown(max_capacity, Page::kPageSize) / Page::kPageSize) * AreaSize(); |
909 accounting_stats_.Clear(); | 905 accounting_stats_.Clear(); |
910 | 906 |
911 allocation_info_.set_top(NULL); | 907 allocation_info_.set_top(NULL); |
912 allocation_info_.set_limit(NULL); | 908 allocation_info_.set_limit(NULL); |
913 | 909 |
914 anchor_.InitializeAsAnchor(this); | 910 anchor_.InitializeAsAnchor(this); |
915 } | 911 } |
916 | 912 |
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3169 object->ShortPrint(); | 3165 object->ShortPrint(); |
3170 PrintF("\n"); | 3166 PrintF("\n"); |
3171 } | 3167 } |
3172 printf(" --------------------------------------\n"); | 3168 printf(" --------------------------------------\n"); |
3173 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3169 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3174 } | 3170 } |
3175 | 3171 |
3176 #endif // DEBUG | 3172 #endif // DEBUG |
3177 } | 3173 } |
3178 } // namespace v8::internal | 3174 } // namespace v8::internal |
OLD | NEW |