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

Side by Side Diff: src/spaces.h

Issue 11362246: Implement progress bar for large objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/spaces.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 EVACUATION_CANDIDATE, 390 EVACUATION_CANDIDATE,
391 RESCAN_ON_EVACUATION, 391 RESCAN_ON_EVACUATION,
392 392
393 // Pages swept precisely can be iterated, hitting only the live objects. 393 // Pages swept precisely can be iterated, hitting only the live objects.
394 // Whereas those swept conservatively cannot be iterated over. Both flags 394 // Whereas those swept conservatively cannot be iterated over. Both flags
395 // indicate that marking bits have been cleared by the sweeper, otherwise 395 // indicate that marking bits have been cleared by the sweeper, otherwise
396 // marking bits are still intact. 396 // marking bits are still intact.
397 WAS_SWEPT_PRECISELY, 397 WAS_SWEPT_PRECISELY,
398 WAS_SWEPT_CONSERVATIVELY, 398 WAS_SWEPT_CONSERVATIVELY,
399 399
400 // Large objects can have a progress bar in their page header. These object
401 // are scanned in increments and will be kept black while being scanned.
402 // Even if the mutator writes to them they will be kept black and a white
403 // to grey transition is performed in the value.
404 HAS_PROGRESS_BAR,
405
400 // Last flag, keep at bottom. 406 // Last flag, keep at bottom.
401 NUM_MEMORY_CHUNK_FLAGS 407 NUM_MEMORY_CHUNK_FLAGS
402 }; 408 };
403 409
404 410
405 static const int kPointersToHereAreInterestingMask = 411 static const int kPointersToHereAreInterestingMask =
406 1 << POINTERS_TO_HERE_ARE_INTERESTING; 412 1 << POINTERS_TO_HERE_ARE_INTERESTING;
407 413
408 static const int kPointersFromHereAreInterestingMask = 414 static const int kPointersFromHereAreInterestingMask =
409 1 << POINTERS_FROM_HERE_ARE_INTERESTING; 415 1 << POINTERS_FROM_HERE_ARE_INTERESTING;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 479 }
474 480
475 int write_barrier_counter() { 481 int write_barrier_counter() {
476 return static_cast<int>(write_barrier_counter_); 482 return static_cast<int>(write_barrier_counter_);
477 } 483 }
478 484
479 void set_write_barrier_counter(int counter) { 485 void set_write_barrier_counter(int counter) {
480 write_barrier_counter_ = counter; 486 write_barrier_counter_ = counter;
481 } 487 }
482 488
489 int progress_bar() {
490 ASSERT(IsFlagSet(HAS_PROGRESS_BAR));
491 return progress_bar_;
492 }
493
494 void set_progress_bar(int progress_bar) {
495 ASSERT(IsFlagSet(HAS_PROGRESS_BAR));
496 progress_bar_ = progress_bar;
497 }
498
499 void ResetProgressBar() {
500 if (IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR)) {
501 set_progress_bar(0);
502 ClearFlag(MemoryChunk::HAS_PROGRESS_BAR);
503 }
504 }
505
483 506
484 static void IncrementLiveBytesFromGC(Address address, int by) { 507 static void IncrementLiveBytesFromGC(Address address, int by) {
485 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by); 508 MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
486 } 509 }
487 510
488 static void IncrementLiveBytesFromMutator(Address address, int by); 511 static void IncrementLiveBytesFromMutator(Address address, int by);
489 512
490 static const intptr_t kAlignment = 513 static const intptr_t kAlignment =
491 (static_cast<uintptr_t>(1) << kPageSizeBits); 514 (static_cast<uintptr_t>(1) << kPageSizeBits);
492 515
493 static const intptr_t kAlignmentMask = kAlignment - 1; 516 static const intptr_t kAlignmentMask = kAlignment - 1;
494 517
495 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; 518 static const intptr_t kSizeOffset = kPointerSize + kPointerSize;
496 519
497 static const intptr_t kLiveBytesOffset = 520 static const intptr_t kLiveBytesOffset =
498 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + 521 kSizeOffset + kPointerSize + kPointerSize + kPointerSize +
499 kPointerSize + kPointerSize + 522 kPointerSize + kPointerSize +
500 kPointerSize + kPointerSize + kPointerSize + kIntSize; 523 kPointerSize + kPointerSize + kPointerSize + kIntSize;
501 524
502 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; 525 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize;
503 526
504 static const size_t kWriteBarrierCounterOffset = 527 static const size_t kWriteBarrierCounterOffset =
505 kSlotsBufferOffset + kPointerSize + kPointerSize; 528 kSlotsBufferOffset + kPointerSize + kPointerSize;
506 529
507 static const size_t kHeaderSize = 530 static const size_t kHeaderSize =
508 kWriteBarrierCounterOffset + kPointerSize + kPointerSize; 531 kWriteBarrierCounterOffset + kPointerSize + kIntSize + kIntSize;
509 532
510 static const int kBodyOffset = 533 static const int kBodyOffset =
511 CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize); 534 CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize);
512 535
513 // The start offset of the object area in a page. Aligned to both maps and 536 // The start offset of the object area in a page. Aligned to both maps and
514 // code alignment to be suitable for both. Also aligned to 32 words because 537 // code alignment to be suitable for both. Also aligned to 32 words because
515 // the marking bitmap is arranged in 32 bit chunks. 538 // the marking bitmap is arranged in 32 bit chunks.
516 static const int kObjectStartAlignment = 32 * kPointerSize; 539 static const int kObjectStartAlignment = 32 * kPointerSize;
517 static const int kObjectStartOffset = kBodyOffset - 1 + 540 static const int kObjectStartOffset = kBodyOffset - 1 +
518 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); 541 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 Address owner_; 665 Address owner_;
643 Heap* heap_; 666 Heap* heap_;
644 // Used by the store buffer to keep track of which pages to mark scan-on- 667 // Used by the store buffer to keep track of which pages to mark scan-on-
645 // scavenge. 668 // scavenge.
646 int store_buffer_counter_; 669 int store_buffer_counter_;
647 // Count of bytes marked black on page. 670 // Count of bytes marked black on page.
648 int live_byte_count_; 671 int live_byte_count_;
649 SlotsBuffer* slots_buffer_; 672 SlotsBuffer* slots_buffer_;
650 SkipList* skip_list_; 673 SkipList* skip_list_;
651 intptr_t write_barrier_counter_; 674 intptr_t write_barrier_counter_;
675 // Used by the incremental marker to keep track of the scanning progress in
676 // large objects that have a progress bar and are scanned in increments.
677 int progress_bar_;
652 // Assuming the initial allocation on a page is sequential, 678 // Assuming the initial allocation on a page is sequential,
653 // count highest number of bytes ever allocated on the page. 679 // count highest number of bytes ever allocated on the page.
654 int high_water_mark_; 680 int high_water_mark_;
655 681
656 static MemoryChunk* Initialize(Heap* heap, 682 static MemoryChunk* Initialize(Heap* heap,
657 Address base, 683 Address base,
658 size_t size, 684 size_t size,
659 Address area_start, 685 Address area_start,
660 Address area_end, 686 Address area_end,
661 Executability executable, 687 Executability executable,
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 } 2722 }
2697 // Must be small, since an iteration is used for lookup. 2723 // Must be small, since an iteration is used for lookup.
2698 static const int kMaxComments = 64; 2724 static const int kMaxComments = 64;
2699 }; 2725 };
2700 #endif 2726 #endif
2701 2727
2702 2728
2703 } } // namespace v8::internal 2729 } } // namespace v8::internal
2704 2730
2705 #endif // V8_SPACES_H_ 2731 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698