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

Side by Side Diff: src/spaces.h

Issue 10959011: Allow partial scanning of large arrays in order to avoid (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 3 months 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
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 static const size_t kHeaderSize = kPartiallyScannedProgress + kIntSize;
493 523
494 static const int kBodyOffset = 524 static const int kBodyOffset =
495 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize)); 525 CODE_POINTER_ALIGN(MAP_POINTER_ALIGN(kHeaderSize + Bitmap::kSize));
496 526
497 // The start offset of the object area in a page. Aligned to both maps and 527 // 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 528 // code alignment to be suitable for both. Also aligned to 32 words because
499 // the marking bitmap is arranged in 32 bit chunks. 529 // the marking bitmap is arranged in 32 bit chunks.
500 static const int kObjectStartAlignment = 32 * kPointerSize; 530 static const int kObjectStartAlignment = 32 * kPointerSize;
501 static const int kObjectStartOffset = kBodyOffset - 1 + 531 static const int kObjectStartOffset = kBodyOffset - 1 +
502 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment); 532 (kObjectStartAlignment - (kBodyOffset - 1) % kObjectStartAlignment);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // in a fixed array. 648 // in a fixed array.
619 Address owner_; 649 Address owner_;
620 Heap* heap_; 650 Heap* heap_;
621 // Used by the store buffer to keep track of which pages to mark scan-on- 651 // Used by the store buffer to keep track of which pages to mark scan-on-
622 // scavenge. 652 // scavenge.
623 int store_buffer_counter_; 653 int store_buffer_counter_;
624 // Count of bytes marked black on page. 654 // Count of bytes marked black on page.
625 int live_byte_count_; 655 int live_byte_count_;
626 SlotsBuffer* slots_buffer_; 656 SlotsBuffer* slots_buffer_;
627 SkipList* skip_list_; 657 SkipList* skip_list_;
658 int partially_scanned_progress_;
628 659
629 static MemoryChunk* Initialize(Heap* heap, 660 static MemoryChunk* Initialize(Heap* heap,
630 Address base, 661 Address base,
631 size_t size, 662 size_t size,
632 Address area_start, 663 Address area_start,
633 Address area_end, 664 Address area_end,
634 Executability executable, 665 Executability executable,
635 Space* owner); 666 Space* owner);
636 667
637 friend class MemoryAllocator; 668 friend class MemoryAllocator;
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 } 2680 }
2650 // Must be small, since an iteration is used for lookup. 2681 // Must be small, since an iteration is used for lookup.
2651 static const int kMaxComments = 64; 2682 static const int kMaxComments = 64;
2652 }; 2683 };
2653 #endif 2684 #endif
2654 2685
2655 2686
2656 } } // namespace v8::internal 2687 } } // namespace v8::internal
2657 2688
2658 #endif // V8_SPACES_H_ 2689 #endif // V8_SPACES_H_
OLDNEW
« src/mark-compact.cc ('K') | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698