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 | |
405 // Last flag, keep at bottom. | 396 // Last flag, keep at bottom. |
406 NUM_MEMORY_CHUNK_FLAGS | 397 NUM_MEMORY_CHUNK_FLAGS |
407 }; | 398 }; |
408 | 399 |
409 | 400 |
410 static const int kPointersToHereAreInterestingMask = | 401 static const int kPointersToHereAreInterestingMask = |
411 1 << POINTERS_TO_HERE_ARE_INTERESTING; | 402 1 << POINTERS_TO_HERE_ARE_INTERESTING; |
412 | 403 |
413 static const int kPointersFromHereAreInterestingMask = | 404 static const int kPointersFromHereAreInterestingMask = |
414 1 << POINTERS_FROM_HERE_ARE_INTERESTING; | 405 1 << POINTERS_FROM_HERE_ARE_INTERESTING; |
415 | 406 |
416 static const int kEvacuationCandidateMask = | 407 static const int kEvacuationCandidateMask = |
417 1 << EVACUATION_CANDIDATE; | 408 1 << EVACUATION_CANDIDATE; |
418 | 409 |
419 static const int kSkipEvacuationSlotsRecordingMask = | 410 static const int kSkipEvacuationSlotsRecordingMask = |
420 (1 << EVACUATION_CANDIDATE) | | 411 (1 << EVACUATION_CANDIDATE) | |
421 (1 << RESCAN_ON_EVACUATION) | | 412 (1 << RESCAN_ON_EVACUATION) | |
422 (1 << IN_FROM_SPACE) | | 413 (1 << IN_FROM_SPACE) | |
423 (1 << IN_TO_SPACE); | 414 (1 << IN_TO_SPACE); |
424 | 415 |
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 } | |
444 | 416 |
445 void SetFlag(int flag) { | 417 void SetFlag(int flag) { |
446 flags_ |= static_cast<uintptr_t>(1) << flag; | 418 flags_ |= static_cast<uintptr_t>(1) << flag; |
447 } | 419 } |
448 | 420 |
449 void ClearFlag(int flag) { | 421 void ClearFlag(int flag) { |
450 flags_ &= ~(static_cast<uintptr_t>(1) << flag); | 422 flags_ &= ~(static_cast<uintptr_t>(1) << flag); |
451 } | 423 } |
452 | 424 |
453 void SetFlagTo(int flag, bool value) { | 425 void SetFlagTo(int flag, bool value) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 | 481 |
510 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; | 482 static const intptr_t kSizeOffset = kPointerSize + kPointerSize; |
511 | 483 |
512 static const intptr_t kLiveBytesOffset = | 484 static const intptr_t kLiveBytesOffset = |
513 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + | 485 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + |
514 kPointerSize + kPointerSize + | 486 kPointerSize + kPointerSize + |
515 kPointerSize + kPointerSize + kPointerSize + kIntSize; | 487 kPointerSize + kPointerSize + kPointerSize + kIntSize; |
516 | 488 |
517 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; | 489 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; |
518 | 490 |
519 static const size_t kPartiallyScannedProgress = | 491 static const size_t kHeaderSize = |
520 kSlotsBufferOffset + kPointerSize + kPointerSize; | 492 kSlotsBufferOffset + kPointerSize + kPointerSize; |
521 | |
522 static const size_t kHeaderSize = kPartiallyScannedProgress + kIntSize; | |
523 | 493 |
524 static const int kBodyOffset = | 494 static const int kBodyOffset = |
525 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); | 495 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); |
526 | 496 |
527 // The start offset of the object area in a page. Aligned to both maps and | 497 // The start offset of the object area in a page. Aligned to both maps and |
528 // code alignment to be suitable for both. Also aligned to 32 words because | 498 // code alignment to be suitable for both. Also aligned to 32 words because |
529 // the marking bitmap is arranged in 32 bit chunks. | 499 // the marking bitmap is arranged in 32 bit chunks. |
530 static const int kObjectStartAlignment = 32 * kPointerSize; | 500 static const int kObjectStartAlignment = 32 * kPointerSize; |
531 static const int kObjectStartOffset = kBodyOffset - 1 + | 501 static const int kObjectStartOffset = kBodyOffset - 1 + |
532 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); | 502 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // in a fixed array. | 618 // in a fixed array. |
649 Address owner_; | 619 Address owner_; |
650 Heap* heap_; | 620 Heap* heap_; |
651 // Used by the store buffer to keep track of which pages to mark scan-on- | 621 // Used by the store buffer to keep track of which pages to mark scan-on- |
652 // scavenge. | 622 // scavenge. |
653 int store_buffer_counter_; | 623 int store_buffer_counter_; |
654 // Count of bytes marked black on page. | 624 // Count of bytes marked black on page. |
655 int live_byte_count_; | 625 int live_byte_count_; |
656 SlotsBuffer* slots_buffer_; | 626 SlotsBuffer* slots_buffer_; |
657 SkipList* skip_list_; | 627 SkipList* skip_list_; |
658 int partially_scanned_progress_; | |
659 | 628 |
660 static MemoryChunk* Initialize(Heap* heap, | 629 static MemoryChunk* Initialize(Heap* heap, |
661 Address base, | 630 Address base, |
662 size_t size, | 631 size_t size, |
663 Address area_start, | 632 Address area_start, |
664 Address area_end, | 633 Address area_end, |
665 Executability executable, | 634 Executability executable, |
666 Space* owner); | 635 Space* owner); |
667 | 636 |
668 friend class MemoryAllocator; | 637 friend class MemoryAllocator; |
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2680 } | 2649 } |
2681 // Must be small, since an iteration is used for lookup. | 2650 // Must be small, since an iteration is used for lookup. |
2682 static const int kMaxComments = 64; | 2651 static const int kMaxComments = 64; |
2683 }; | 2652 }; |
2684 #endif | 2653 #endif |
2685 | 2654 |
2686 | 2655 |
2687 } } // namespace v8::internal | 2656 } } // namespace v8::internal |
2688 | 2657 |
2689 #endif // V8_SPACES_H_ | 2658 #endif // V8_SPACES_H_ |
OLD | NEW |