Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: src/heap/spaces.cc

Issue 2007253002: Reland of "[heap] Fine-grained JSArrayBuffer tracking" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed coment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 chunk->InitializeReservedMemory(); 504 chunk->InitializeReservedMemory();
505 chunk->old_to_new_slots_ = nullptr; 505 chunk->old_to_new_slots_ = nullptr;
506 chunk->old_to_old_slots_ = nullptr; 506 chunk->old_to_old_slots_ = nullptr;
507 chunk->typed_old_to_new_slots_ = nullptr; 507 chunk->typed_old_to_new_slots_ = nullptr;
508 chunk->typed_old_to_old_slots_ = nullptr; 508 chunk->typed_old_to_old_slots_ = nullptr;
509 chunk->skip_list_ = nullptr; 509 chunk->skip_list_ = nullptr;
510 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity; 510 chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity;
511 chunk->progress_bar_ = 0; 511 chunk->progress_bar_ = 0;
512 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); 512 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base));
513 chunk->concurrent_sweeping_state().SetValue(kSweepingDone); 513 chunk->concurrent_sweeping_state().SetValue(kSweepingDone);
514 chunk->mutex_ = nullptr; 514 chunk->mutex_ = new base::Mutex();
515 chunk->available_in_free_list_ = 0; 515 chunk->available_in_free_list_ = 0;
516 chunk->wasted_memory_ = 0; 516 chunk->wasted_memory_ = 0;
517 chunk->ResetLiveBytes(); 517 chunk->ResetLiveBytes();
518 Bitmap::Clear(chunk); 518 Bitmap::Clear(chunk);
519 chunk->set_next_chunk(nullptr); 519 chunk->set_next_chunk(nullptr);
520 chunk->set_prev_chunk(nullptr); 520 chunk->set_prev_chunk(nullptr);
521 chunk->local_tracker_.SetValue(nullptr);
521 522
522 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); 523 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset);
523 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset); 524 DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset);
524 525
525 if (executable == EXECUTABLE) { 526 if (executable == EXECUTABLE) {
526 chunk->SetFlag(IS_EXECUTABLE); 527 chunk->SetFlag(IS_EXECUTABLE);
527 } 528 }
528 529
529 if (reservation != nullptr) { 530 if (reservation != nullptr) {
530 chunk->reservation_.TakeControl(reservation); 531 chunk->reservation_.TakeControl(reservation);
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
1040 if (typed_old_to_new_slots_ != nullptr) ReleaseTypedOldToNewSlots(); 1041 if (typed_old_to_new_slots_ != nullptr) ReleaseTypedOldToNewSlots();
1041 if (typed_old_to_old_slots_ != nullptr) ReleaseTypedOldToOldSlots(); 1042 if (typed_old_to_old_slots_ != nullptr) ReleaseTypedOldToOldSlots();
1043
1044 if (local_tracker_.Value() != nullptr) ReleaseLocalTracker();
1042 } 1045 }
1043 1046
1044 static SlotSet* AllocateSlotSet(size_t size, Address page_start) { 1047 static SlotSet* AllocateSlotSet(size_t size, Address page_start) {
1045 size_t pages = (size + Page::kPageSize - 1) / Page::kPageSize; 1048 size_t pages = (size + Page::kPageSize - 1) / Page::kPageSize;
1046 DCHECK(pages > 0); 1049 DCHECK(pages > 0);
1047 SlotSet* slot_set = new SlotSet[pages]; 1050 SlotSet* slot_set = new SlotSet[pages];
1048 for (size_t i = 0; i < pages; i++) { 1051 for (size_t i = 0; i < pages; i++) {
1049 slot_set[i].SetPageStart(page_start + i * Page::kPageSize); 1052 slot_set[i].SetPageStart(page_start + i * Page::kPageSize);
1050 } 1053 }
1051 return slot_set; 1054 return slot_set;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 1086
1084 void MemoryChunk::AllocateTypedOldToOldSlots() { 1087 void MemoryChunk::AllocateTypedOldToOldSlots() {
1085 DCHECK(nullptr == typed_old_to_old_slots_); 1088 DCHECK(nullptr == typed_old_to_old_slots_);
1086 typed_old_to_old_slots_ = new TypedSlotSet(address()); 1089 typed_old_to_old_slots_ = new TypedSlotSet(address());
1087 } 1090 }
1088 1091
1089 void MemoryChunk::ReleaseTypedOldToOldSlots() { 1092 void MemoryChunk::ReleaseTypedOldToOldSlots() {
1090 delete typed_old_to_old_slots_; 1093 delete typed_old_to_old_slots_;
1091 typed_old_to_old_slots_ = nullptr; 1094 typed_old_to_old_slots_ = nullptr;
1092 } 1095 }
1096
1097 void MemoryChunk::ReleaseLocalTracker() {
1098 delete local_tracker_.Value();
1099 local_tracker_.SetValue(nullptr);
1100 }
1101
1093 // ----------------------------------------------------------------------------- 1102 // -----------------------------------------------------------------------------
1094 // PagedSpace implementation 1103 // PagedSpace implementation
1095 1104
1096 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) == 1105 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::NEW_SPACE) ==
1097 ObjectSpace::kObjectSpaceNewSpace); 1106 ObjectSpace::kObjectSpaceNewSpace);
1098 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) == 1107 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::OLD_SPACE) ==
1099 ObjectSpace::kObjectSpaceOldSpace); 1108 ObjectSpace::kObjectSpaceOldSpace);
1100 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) == 1109 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::CODE_SPACE) ==
1101 ObjectSpace::kObjectSpaceCodeSpace); 1110 ObjectSpace::kObjectSpaceCodeSpace);
1102 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) == 1111 STATIC_ASSERT(static_cast<ObjectSpace>(1 << AllocationSpace::MAP_SPACE) ==
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 object->ShortPrint(); 3244 object->ShortPrint();
3236 PrintF("\n"); 3245 PrintF("\n");
3237 } 3246 }
3238 printf(" --------------------------------------\n"); 3247 printf(" --------------------------------------\n");
3239 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3248 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3240 } 3249 }
3241 3250
3242 #endif // DEBUG 3251 #endif // DEBUG
3243 } // namespace internal 3252 } // namespace internal
3244 } // namespace v8 3253 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698