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/heap/spaces.h" | 5 #include "src/heap/spaces.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/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 chunk->heap_ = heap; | 499 chunk->heap_ = heap; |
500 chunk->size_ = size; | 500 chunk->size_ = size; |
501 chunk->area_start_ = area_start; | 501 chunk->area_start_ = area_start; |
502 chunk->area_end_ = area_end; | 502 chunk->area_end_ = area_end; |
503 chunk->flags_ = 0; | 503 chunk->flags_ = 0; |
504 chunk->set_owner(owner); | 504 chunk->set_owner(owner); |
505 chunk->InitializeReservedMemory(); | 505 chunk->InitializeReservedMemory(); |
506 chunk->old_to_new_slots_ = nullptr; | 506 chunk->old_to_new_slots_ = nullptr; |
507 chunk->old_to_old_slots_ = nullptr; | 507 chunk->old_to_old_slots_ = nullptr; |
| 508 chunk->typed_old_to_new_slots_ = nullptr; |
508 chunk->typed_old_to_old_slots_ = nullptr; | 509 chunk->typed_old_to_old_slots_ = nullptr; |
509 chunk->skip_list_ = nullptr; | 510 chunk->skip_list_ = nullptr; |
510 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; | 511 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; |
511 chunk->progress_bar_ = 0; | 512 chunk->progress_bar_ = 0; |
512 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); | 513 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); |
513 chunk->concurrent_sweeping_state().SetValue(kSweepingDone); | 514 chunk->concurrent_sweeping_state().SetValue(kSweepingDone); |
514 chunk->mutex_ = nullptr; | 515 chunk->mutex_ = nullptr; |
515 chunk->available_in_free_list_ = 0; | 516 chunk->available_in_free_list_ = 0; |
516 chunk->wasted_memory_ = 0; | 517 chunk->wasted_memory_ = 0; |
517 chunk->ResetLiveBytes(); | 518 chunk->ResetLiveBytes(); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 if (skip_list_ != nullptr) { | 1031 if (skip_list_ != nullptr) { |
1031 delete skip_list_; | 1032 delete skip_list_; |
1032 skip_list_ = nullptr; | 1033 skip_list_ = nullptr; |
1033 } | 1034 } |
1034 if (mutex_ != nullptr) { | 1035 if (mutex_ != nullptr) { |
1035 delete mutex_; | 1036 delete mutex_; |
1036 mutex_ = nullptr; | 1037 mutex_ = nullptr; |
1037 } | 1038 } |
1038 if (old_to_new_slots_ != nullptr) ReleaseOldToNewSlots(); | 1039 if (old_to_new_slots_ != nullptr) ReleaseOldToNewSlots(); |
1039 if (old_to_old_slots_ != nullptr) ReleaseOldToOldSlots(); | 1040 if (old_to_old_slots_ != nullptr) ReleaseOldToOldSlots(); |
| 1041 if (typed_old_to_new_slots_ != nullptr) ReleaseTypedOldToNewSlots(); |
| 1042 if (typed_old_to_old_slots_ != nullptr) ReleaseTypedOldToOldSlots(); |
1040 } | 1043 } |
1041 | 1044 |
1042 static SlotSet* AllocateSlotSet(size_t size, Address page_start) { | 1045 static SlotSet* AllocateSlotSet(size_t size, Address page_start) { |
1043 size_t pages = (size + Page::kPageSize - 1) / Page::kPageSize; | 1046 size_t pages = (size + Page::kPageSize - 1) / Page::kPageSize; |
1044 DCHECK(pages > 0); | 1047 DCHECK(pages > 0); |
1045 SlotSet* slot_set = new SlotSet[pages]; | 1048 SlotSet* slot_set = new SlotSet[pages]; |
1046 for (size_t i = 0; i < pages; i++) { | 1049 for (size_t i = 0; i < pages; i++) { |
1047 slot_set[i].SetPageStart(page_start + i * Page::kPageSize); | 1050 slot_set[i].SetPageStart(page_start + i * Page::kPageSize); |
1048 } | 1051 } |
1049 return slot_set; | 1052 return slot_set; |
(...skipping 12 matching lines...) Expand all Loading... |
1062 void MemoryChunk::AllocateOldToOldSlots() { | 1065 void MemoryChunk::AllocateOldToOldSlots() { |
1063 DCHECK(nullptr == old_to_old_slots_); | 1066 DCHECK(nullptr == old_to_old_slots_); |
1064 old_to_old_slots_ = AllocateSlotSet(size_, address()); | 1067 old_to_old_slots_ = AllocateSlotSet(size_, address()); |
1065 } | 1068 } |
1066 | 1069 |
1067 void MemoryChunk::ReleaseOldToOldSlots() { | 1070 void MemoryChunk::ReleaseOldToOldSlots() { |
1068 delete[] old_to_old_slots_; | 1071 delete[] old_to_old_slots_; |
1069 old_to_old_slots_ = nullptr; | 1072 old_to_old_slots_ = nullptr; |
1070 } | 1073 } |
1071 | 1074 |
| 1075 void MemoryChunk::AllocateTypedOldToNewSlots() { |
| 1076 DCHECK(nullptr == typed_old_to_new_slots_); |
| 1077 typed_old_to_new_slots_ = new TypedSlotSet(address()); |
| 1078 } |
| 1079 |
| 1080 void MemoryChunk::ReleaseTypedOldToNewSlots() { |
| 1081 delete typed_old_to_new_slots_; |
| 1082 typed_old_to_new_slots_ = nullptr; |
| 1083 } |
| 1084 |
1072 void MemoryChunk::AllocateTypedOldToOldSlots() { | 1085 void MemoryChunk::AllocateTypedOldToOldSlots() { |
1073 DCHECK(nullptr == typed_old_to_old_slots_); | 1086 DCHECK(nullptr == typed_old_to_old_slots_); |
1074 typed_old_to_old_slots_ = new TypedSlotSet(address()); | 1087 typed_old_to_old_slots_ = new TypedSlotSet(address()); |
1075 } | 1088 } |
1076 | 1089 |
1077 void MemoryChunk::ReleaseTypedOldToOldSlots() { | 1090 void MemoryChunk::ReleaseTypedOldToOldSlots() { |
1078 delete typed_old_to_old_slots_; | 1091 delete typed_old_to_old_slots_; |
1079 typed_old_to_old_slots_ = nullptr; | 1092 typed_old_to_old_slots_ = nullptr; |
1080 } | 1093 } |
1081 // ----------------------------------------------------------------------------- | 1094 // ----------------------------------------------------------------------------- |
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 object->ShortPrint(); | 3234 object->ShortPrint(); |
3222 PrintF("\n"); | 3235 PrintF("\n"); |
3223 } | 3236 } |
3224 printf(" --------------------------------------\n"); | 3237 printf(" --------------------------------------\n"); |
3225 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3238 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3226 } | 3239 } |
3227 | 3240 |
3228 #endif // DEBUG | 3241 #endif // DEBUG |
3229 } // namespace internal | 3242 } // namespace internal |
3230 } // namespace v8 | 3243 } // namespace v8 |
OLD | NEW |