| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 EVACUATION_CANDIDATE, | 393 EVACUATION_CANDIDATE, |
| 394 RESCAN_ON_EVACUATION, | 394 RESCAN_ON_EVACUATION, |
| 395 | 395 |
| 396 // Pages swept precisely can be iterated, hitting only the live objects. | 396 // Pages swept precisely can be iterated, hitting only the live objects. |
| 397 // Whereas those swept conservatively cannot be iterated over. Both flags | 397 // Whereas those swept conservatively cannot be iterated over. Both flags |
| 398 // indicate that marking bits have been cleared by the sweeper, otherwise | 398 // indicate that marking bits have been cleared by the sweeper, otherwise |
| 399 // marking bits are still intact. | 399 // marking bits are still intact. |
| 400 WAS_SWEPT_PRECISELY, | 400 WAS_SWEPT_PRECISELY, |
| 401 WAS_SWEPT_CONSERVATIVELY, | 401 WAS_SWEPT_CONSERVATIVELY, |
| 402 | 402 |
| 403 // Used for large objects only. Indicates that the object has been | |
| 404 // partially scanned by the incremental mark-sweep GC. Objects that have | |
| 405 // been partially scanned are marked black so that the write barrier | |
| 406 // triggers for them, and they are counted as live bytes. If the mutator | |
| 407 // writes to them they may be turned grey and subtracted from the live byte | |
| 408 // list. They move back to the marking deque either by an iteration over | |
| 409 // the large object space or in the write barrier. | |
| 410 IS_PARTIALLY_SCANNED, | |
| 411 | |
| 412 // Last flag, keep at bottom. | 403 // Last flag, keep at bottom. |
| 413 NUM_MEMORY_CHUNK_FLAGS | 404 NUM_MEMORY_CHUNK_FLAGS |
| 414 }; | 405 }; |
| 415 | 406 |
| 416 | 407 |
| 417 static const int kPointersToHereAreInterestingMask = | 408 static const int kPointersToHereAreInterestingMask = |
| 418 1 << POINTERS_TO_HERE_ARE_INTERESTING; | 409 1 << POINTERS_TO_HERE_ARE_INTERESTING; |
| 419 | 410 |
| 420 static const int kPointersFromHereAreInterestingMask = | 411 static const int kPointersFromHereAreInterestingMask = |
| 421 1 << POINTERS_FROM_HERE_ARE_INTERESTING; | 412 1 << POINTERS_FROM_HERE_ARE_INTERESTING; |
| 422 | 413 |
| 423 static const int kEvacuationCandidateMask = | 414 static const int kEvacuationCandidateMask = |
| 424 1 << EVACUATION_CANDIDATE; | 415 1 << EVACUATION_CANDIDATE; |
| 425 | 416 |
| 426 static const int kSkipEvacuationSlotsRecordingMask = | 417 static const int kSkipEvacuationSlotsRecordingMask = |
| 427 (1 << EVACUATION_CANDIDATE) | | 418 (1 << EVACUATION_CANDIDATE) | |
| 428 (1 << RESCAN_ON_EVACUATION) | | 419 (1 << RESCAN_ON_EVACUATION) | |
| 429 (1 << IN_FROM_SPACE) | | 420 (1 << IN_FROM_SPACE) | |
| 430 (1 << IN_TO_SPACE); | 421 (1 << IN_TO_SPACE); |
| 431 | 422 |
| 432 static const int kIsPartiallyScannedMask = 1 << IS_PARTIALLY_SCANNED; | |
| 433 | |
| 434 void SetPartiallyScannedProgress(int progress) { | |
| 435 SetFlag(IS_PARTIALLY_SCANNED); | |
| 436 partially_scanned_progress_ = progress; | |
| 437 } | |
| 438 | |
| 439 bool IsPartiallyScanned() { | |
| 440 return IsFlagSet(IS_PARTIALLY_SCANNED); | |
| 441 } | |
| 442 | |
| 443 void SetCompletelyScanned() { | |
| 444 ClearFlag(IS_PARTIALLY_SCANNED); | |
| 445 } | |
| 446 | |
| 447 int PartiallyScannedProgress() { | |
| 448 ASSERT(IsPartiallyScanned()); | |
| 449 return partially_scanned_progress_; | |
| 450 } | |
| 451 | 423 |
| 452 void SetFlag(int flag) { | 424 void SetFlag(int flag) { |
| 453 flags_ |= static_cast<uintptr_t>(1) << flag; | 425 flags_ |= static_cast<uintptr_t>(1) << flag; |
| 454 } | 426 } |
| 455 | 427 |
| 456 void ClearFlag(int flag) { | 428 void ClearFlag(int flag) { |
| 457 flags_ &= ~(static_cast<uintptr_t>(1) << flag); | 429 flags_ &= ~(static_cast<uintptr_t>(1) << flag); |
| 458 } | 430 } |
| 459 | 431 |
| 460 void SetFlagTo(int flag, bool value) { | 432 void SetFlagTo(int flag, bool value) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 499 |
| 528 static const intptr_t kLiveBytesOffset = | 500 static const intptr_t kLiveBytesOffset = |
| 529 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + | 501 kSizeOffset + kPointerSize + kPointerSize + kPointerSize + |
| 530 kPointerSize + kPointerSize + | 502 kPointerSize + kPointerSize + |
| 531 kPointerSize + kPointerSize + kPointerSize + kIntSize; | 503 kPointerSize + kPointerSize + kPointerSize + kIntSize; |
| 532 | 504 |
| 533 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; | 505 static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize; |
| 534 | 506 |
| 535 static const size_t kWriteBarrierCounterOffset = | 507 static const size_t kWriteBarrierCounterOffset = |
| 536 kSlotsBufferOffset + kPointerSize + kPointerSize; | 508 kSlotsBufferOffset + kPointerSize + kPointerSize; |
| 537 static const size_t kPartiallyScannedProgress = | |
| 538 kWriteBarrierCounterOffset + kPointerSize; | |
| 539 | 509 |
| 540 // Actually the partially_scanned_progress_ member is only an int, but on | 510 static const size_t kHeaderSize = kWriteBarrierCounterOffset + kPointerSize; |
| 541 // 64 bit the size of MemoryChunk gets rounded up to a 64 bit size so we | |
| 542 // have to have the header start kPointerSize after the | |
| 543 // partially_scanned_progress_ member. | |
| 544 static const size_t kHeaderSize = kPartiallyScannedProgress + kPointerSize; | |
| 545 | 511 |
| 546 static const int kBodyOffset = | 512 static const int kBodyOffset = |
| 547 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); | 513 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); |
| 548 | 514 |
| 549 // The start offset of the object area in a page. Aligned to both maps and | 515 // The start offset of the object area in a page. Aligned to both maps and |
| 550 // code alignment to be suitable for both. Also aligned to 32 words because | 516 // code alignment to be suitable for both. Also aligned to 32 words because |
| 551 // the marking bitmap is arranged in 32 bit chunks. | 517 // the marking bitmap is arranged in 32 bit chunks. |
| 552 static const int kObjectStartAlignment = 32 * kPointerSize; | 518 static const int kObjectStartAlignment = 32 * kPointerSize; |
| 553 static const int kObjectStartOffset = kBodyOffset - 1 + | 519 static const int kObjectStartOffset = kBodyOffset - 1 + |
| 554 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); | 520 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 Address owner_; | 637 Address owner_; |
| 672 Heap* heap_; | 638 Heap* heap_; |
| 673 // Used by the store buffer to keep track of which pages to mark scan-on- | 639 // Used by the store buffer to keep track of which pages to mark scan-on- |
| 674 // scavenge. | 640 // scavenge. |
| 675 int store_buffer_counter_; | 641 int store_buffer_counter_; |
| 676 // Count of bytes marked black on page. | 642 // Count of bytes marked black on page. |
| 677 int live_byte_count_; | 643 int live_byte_count_; |
| 678 SlotsBuffer* slots_buffer_; | 644 SlotsBuffer* slots_buffer_; |
| 679 SkipList* skip_list_; | 645 SkipList* skip_list_; |
| 680 intptr_t write_barrier_counter_; | 646 intptr_t write_barrier_counter_; |
| 681 int partially_scanned_progress_; | |
| 682 | 647 |
| 683 static MemoryChunk* Initialize(Heap* heap, | 648 static MemoryChunk* Initialize(Heap* heap, |
| 684 Address base, | 649 Address base, |
| 685 size_t size, | 650 size_t size, |
| 686 Address area_start, | 651 Address area_start, |
| 687 Address area_end, | 652 Address area_end, |
| 688 Executability executable, | 653 Executability executable, |
| 689 Space* owner); | 654 Space* owner); |
| 690 | 655 |
| 691 friend class MemoryAllocator; | 656 friend class MemoryAllocator; |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 } | 2668 } |
| 2704 // Must be small, since an iteration is used for lookup. | 2669 // Must be small, since an iteration is used for lookup. |
| 2705 static const int kMaxComments = 64; | 2670 static const int kMaxComments = 64; |
| 2706 }; | 2671 }; |
| 2707 #endif | 2672 #endif |
| 2708 | 2673 |
| 2709 | 2674 |
| 2710 } } // namespace v8::internal | 2675 } } // namespace v8::internal |
| 2711 | 2676 |
| 2712 #endif // V8_SPACES_H_ | 2677 #endif // V8_SPACES_H_ |
| OLD | NEW |