OLD | NEW |
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 EVACUATION_CANDIDATE, | 386 EVACUATION_CANDIDATE, |
387 RESCAN_ON_EVACUATION, | 387 RESCAN_ON_EVACUATION, |
388 | 388 |
389 // Pages swept precisely can be iterated, hitting only the live objects. | 389 // Pages swept precisely can be iterated, hitting only the live objects. |
390 // Whereas those swept conservatively cannot be iterated over. Both flags | 390 // Whereas those swept conservatively cannot be iterated over. Both flags |
391 // indicate that marking bits have been cleared by the sweeper, otherwise | 391 // indicate that marking bits have been cleared by the sweeper, otherwise |
392 // marking bits are still intact. | 392 // marking bits are still intact. |
393 WAS_SWEPT_PRECISELY, | 393 WAS_SWEPT_PRECISELY, |
394 WAS_SWEPT_CONSERVATIVELY, | 394 WAS_SWEPT_CONSERVATIVELY, |
395 | 395 |
| 396 // Used for large objects only. Indicates that the object has been |
| 397 // partially scanned by the incremental mark-sweep GC. Objects that have |
| 398 // been partially scanned are marked black so that the write barrier |
| 399 // triggers for them, and they are counted as live bytes. If the mutator |
| 400 // writes to them they may be turned grey and subtracted from the live byte |
| 401 // list. They move back to the marking deque either by an iteration over |
| 402 // the large object space or in the write barrier. |
| 403 IS_PARTIALLY_SCANNED, |
| 404 |
396 // Last flag, keep at bottom. | 405 // Last flag, keep at bottom. |
397 NUM_MEMORY_CHUNK_FLAGS | 406 NUM_MEMORY_CHUNK_FLAGS |
398 }; | 407 }; |
399 | 408 |
400 | 409 |
401 static const int kPointersToHereAreInterestingMask = | 410 static const int kPointersToHereAreInterestingMask = |
402 1 << POINTERS_TO_HERE_ARE_INTERESTING; | 411 1 << POINTERS_TO_HERE_ARE_INTERESTING; |
403 | 412 |
404 static const int kPointersFromHereAreInterestingMask = | 413 static const int kPointersFromHereAreInterestingMask = |
405 1 << POINTERS_FROM_HERE_ARE_INTERESTING; | 414 1 << POINTERS_FROM_HERE_ARE_INTERESTING; |
406 | 415 |
407 static const int kEvacuationCandidateMask = | 416 static const int kEvacuationCandidateMask = |
408 1 << EVACUATION_CANDIDATE; | 417 1 << EVACUATION_CANDIDATE; |
409 | 418 |
410 static const int kSkipEvacuationSlotsRecordingMask = | 419 static const int kSkipEvacuationSlotsRecordingMask = |
411 (1 << EVACUATION_CANDIDATE) | | 420 (1 << EVACUATION_CANDIDATE) | |
412 (1 << RESCAN_ON_EVACUATION) | | 421 (1 << RESCAN_ON_EVACUATION) | |
413 (1 << IN_FROM_SPACE) | | 422 (1 << IN_FROM_SPACE) | |
414 (1 << IN_TO_SPACE); | 423 (1 << IN_TO_SPACE); |
415 | 424 |
| 425 static const int kIsPartiallyScannedMask = 1 << IS_PARTIALLY_SCANNED; |
| 426 |
| 427 void SetPartiallyScannedProgress(int progress) { |
| 428 SetFlag(IS_PARTIALLY_SCANNED); |
| 429 partially_scanned_progress_ = progress; |
| 430 } |
| 431 |
| 432 bool IsPartiallyScanned() { |
| 433 return IsFlagSet(IS_PARTIALLY_SCANNED); |
| 434 } |
| 435 |
| 436 void SetCompletelyScanned() { |
| 437 ClearFlag(IS_PARTIALLY_SCANNED); |
| 438 } |
| 439 |
| 440 int PartiallyScannedProgress() { |
| 441 ASSERT(IsPartiallyScanned()); |
| 442 return partially_scanned_progress_; |
| 443 } |
416 | 444 |
417 void SetFlag(int flag) { | 445 void SetFlag(int flag) { |
418 flags_ |= static_cast<uintptr_t>(1) << flag; | 446 flags_ |= static_cast<uintptr_t>(1) << flag; |
419 } | 447 } |
420 | 448 |
421 void ClearFlag(int flag) { | 449 void ClearFlag(int flag) { |
422 flags_ &= ~(static_cast<uintptr_t>(1) << flag); | 450 flags_ &= ~(static_cast<uintptr_t>(1) << flag); |
423 } | 451 } |
424 | 452 |
425 void SetFlagTo(int flag, bool value) { | 453 void SetFlagTo(int flag, bool value) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 509 |
482 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; | 510 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; |
483 | 511 |
484 static const intptr_t kLiveBytesOffset = | 512 static const intptr_t kLiveBytesOffset = |
485 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + | 513 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + |
486 kPointerSize + kPointerSize + | 514 kPointerSize + kPointerSize + |
487 kPointerSize + kPointerSize + kPointerSize + kIntSize; | 515 kPointerSize + kPointerSize + kPointerSize + kIntSize; |
488 | 516 |
489 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; | 517 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; |
490 | 518 |
491 static const size_t kHeaderSize = | 519 static const size_t kPartiallyScannedProgress = |
492 kSlotsBufferOffset + kPointerSize + kPointerSize; | 520 kSlotsBufferOffset + kPointerSize + kPointerSize; |
| 521 |
| 522 // Actually the partially_scanned_progress_ member is only an int, but on |
| 523 // 64 bit the size of MemoryChunk gets rounded up to a 64 bit size so we |
| 524 // have to have the header start kPointerSize after the |
| 525 // partially_scanned_progress_ member. |
| 526 static const size_t kHeaderSize = kPartiallyScannedProgress + kPointerSize; |
493 | 527 |
494 static const int kBodyOffset = | 528 static const int kBodyOffset = |
495 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); | 529 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); |
496 | 530 |
497 // The start offset of the object area in a page. Aligned to both maps and | 531 // The start offset of the object area in a page. Aligned to both maps and |
498 // code alignment to be suitable for both. Also aligned to 32 words because | 532 // code alignment to be suitable for both. Also aligned to 32 words because |
499 // the marking bitmap is arranged in 32 bit chunks. | 533 // the marking bitmap is arranged in 32 bit chunks. |
500 static const int kObjectStartAlignment = 32 * kPointerSize; | 534 static const int kObjectStartAlignment = 32 * kPointerSize; |
501 static const int kObjectStartOffset = kBodyOffset - 1 + | 535 static const int kObjectStartOffset = kBodyOffset - 1 + |
502 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); | 536 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 // in a fixed array. | 652 // in a fixed array. |
619 Address owner_; | 653 Address owner_; |
620 Heap* heap_; | 654 Heap* heap_; |
621 // Used by the store buffer to keep track of which pages to mark scan-on- | 655 // Used by the store buffer to keep track of which pages to mark scan-on- |
622 // scavenge. | 656 // scavenge. |
623 int store_buffer_counter_; | 657 int store_buffer_counter_; |
624 // Count of bytes marked black on page. | 658 // Count of bytes marked black on page. |
625 int live_byte_count_; | 659 int live_byte_count_; |
626 SlotsBuffer* slots_buffer_; | 660 SlotsBuffer* slots_buffer_; |
627 SkipList* skip_list_; | 661 SkipList* skip_list_; |
| 662 int partially_scanned_progress_; |
628 | 663 |
629 static MemoryChunk* Initialize(Heap* heap, | 664 static MemoryChunk* Initialize(Heap* heap, |
630 Address base, | 665 Address base, |
631 size_t size, | 666 size_t size, |
632 Address area_start, | 667 Address area_start, |
633 Address area_end, | 668 Address area_end, |
634 Executability executable, | 669 Executability executable, |
635 Space* owner); | 670 Space* owner); |
636 | 671 |
637 friend class MemoryAllocator; | 672 friend class MemoryAllocator; |
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 } | 2684 } |
2650 // Must be small, since an iteration is used for lookup. | 2685 // Must be small, since an iteration is used for lookup. |
2651 static const int kMaxComments = 64; | 2686 static const int kMaxComments = 64; |
2652 }; | 2687 }; |
2653 #endif | 2688 #endif |
2654 | 2689 |
2655 | 2690 |
2656 } } // namespace v8::internal | 2691 } } // namespace v8::internal |
2657 | 2692 |
2658 #endif // V8_SPACES_H_ | 2693 #endif // V8_SPACES_H_ |
OLD | NEW |