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

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

Issue 2440683002: [heap] Move typed slot filtering logic into sweeper. (Closed)
Patch Set: fix test Created 4 years, 1 month 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/v8.gyp » ('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 <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base)); 520 chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base));
521 chunk->concurrent_sweeping_state().SetValue(kSweepingDone); 521 chunk->concurrent_sweeping_state().SetValue(kSweepingDone);
522 chunk->mutex_ = new base::Mutex(); 522 chunk->mutex_ = new base::Mutex();
523 chunk->available_in_free_list_ = 0; 523 chunk->available_in_free_list_ = 0;
524 chunk->wasted_memory_ = 0; 524 chunk->wasted_memory_ = 0;
525 chunk->ResetLiveBytes(); 525 chunk->ResetLiveBytes();
526 chunk->ClearLiveness(); 526 chunk->ClearLiveness();
527 chunk->set_next_chunk(nullptr); 527 chunk->set_next_chunk(nullptr);
528 chunk->set_prev_chunk(nullptr); 528 chunk->set_prev_chunk(nullptr);
529 chunk->local_tracker_ = nullptr; 529 chunk->local_tracker_ = nullptr;
530 chunk->black_area_end_marker_map_ = nullptr;
531 530
532 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); 531 DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset);
533 532
534 if (executable == EXECUTABLE) { 533 if (executable == EXECUTABLE) {
535 chunk->SetFlag(IS_EXECUTABLE); 534 chunk->SetFlag(IS_EXECUTABLE);
536 } 535 }
537 536
538 if (reservation != nullptr) { 537 if (reservation != nullptr) {
539 chunk->reservation_.TakeControl(reservation); 538 chunk->reservation_.TakeControl(reservation);
540 } 539 }
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 // skipped when scanning the heap. 1377 // skipped when scanning the heap.
1379 Address current_top = top(); 1378 Address current_top = top();
1380 Address current_limit = limit(); 1379 Address current_limit = limit();
1381 if (current_top == nullptr) { 1380 if (current_top == nullptr) {
1382 DCHECK(current_limit == nullptr); 1381 DCHECK(current_limit == nullptr);
1383 return; 1382 return;
1384 } 1383 }
1385 1384
1386 if (heap()->incremental_marking()->black_allocation()) { 1385 if (heap()->incremental_marking()->black_allocation()) {
1387 Page* page = Page::FromAllocationAreaAddress(current_top); 1386 Page* page = Page::FromAllocationAreaAddress(current_top);
1388 // We have to remember the end of the current black allocation area if
1389 // something was allocated in the current bump pointer range.
1390 if (allocation_info_.original_top() != current_top) {
1391 Address end_black_area = current_top - kPointerSize;
1392 page->AddBlackAreaEndMarker(end_black_area);
1393 }
1394 1387
1395 // Clear the bits in the unused black area. 1388 // Clear the bits in the unused black area.
1396 if (current_top != current_limit) { 1389 if (current_top != current_limit) {
1397 page->markbits()->ClearRange(page->AddressToMarkbitIndex(current_top), 1390 page->markbits()->ClearRange(page->AddressToMarkbitIndex(current_top),
1398 page->AddressToMarkbitIndex(current_limit)); 1391 page->AddressToMarkbitIndex(current_limit));
1399 page->IncrementLiveBytes(-static_cast<int>(current_limit - current_top)); 1392 page->IncrementLiveBytes(-static_cast<int>(current_limit - current_top));
1400 } 1393 }
1401 } 1394 }
1402 1395
1403 SetTopAndLimit(NULL, NULL); 1396 SetTopAndLimit(NULL, NULL);
1404 DCHECK_GE(current_limit, current_top); 1397 DCHECK_GE(current_limit, current_top);
1405 Free(current_top, current_limit - current_top); 1398 Free(current_top, current_limit - current_top);
1406 } 1399 }
1407 1400
1408 void PagedSpace::IncreaseCapacity(size_t bytes) { 1401 void PagedSpace::IncreaseCapacity(size_t bytes) {
1409 accounting_stats_.ExpandSpace(bytes); 1402 accounting_stats_.ExpandSpace(bytes);
1410 } 1403 }
1411 1404
1412 void PagedSpace::ReleasePage(Page* page) { 1405 void PagedSpace::ReleasePage(Page* page) {
1413 DCHECK_EQ(page->LiveBytes(), 0); 1406 DCHECK_EQ(page->LiveBytes(), 0);
1414 DCHECK_EQ(page->owner(), this); 1407 DCHECK_EQ(page->owner(), this);
1415 1408
1416 free_list_.EvictFreeListItems(page); 1409 free_list_.EvictFreeListItems(page);
1417 DCHECK(!free_list_.ContainsPageFreeListItems(page)); 1410 DCHECK(!free_list_.ContainsPageFreeListItems(page));
1418 1411
1419 page->ReleaseBlackAreaEndMarkerMap();
1420
1421 if (Page::FromAllocationAreaAddress(allocation_info_.top()) == page) { 1412 if (Page::FromAllocationAreaAddress(allocation_info_.top()) == page) {
1422 allocation_info_.Reset(nullptr, nullptr); 1413 allocation_info_.Reset(nullptr, nullptr);
1423 } 1414 }
1424 1415
1425 // If page is still in a list, unlink it from that list. 1416 // If page is still in a list, unlink it from that list.
1426 if (page->next_chunk() != NULL) { 1417 if (page->next_chunk() != NULL) {
1427 DCHECK(page->prev_chunk() != NULL); 1418 DCHECK(page->prev_chunk() != NULL);
1428 page->Unlink(); 1419 page->Unlink();
1429 } 1420 }
1430 1421
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 object->ShortPrint(); 3239 object->ShortPrint();
3249 PrintF("\n"); 3240 PrintF("\n");
3250 } 3241 }
3251 printf(" --------------------------------------\n"); 3242 printf(" --------------------------------------\n");
3252 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3243 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3253 } 3244 }
3254 3245
3255 #endif // DEBUG 3246 #endif // DEBUG
3256 } // namespace internal 3247 } // namespace internal
3257 } // namespace v8 3248 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698