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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // Set or clear multiple flags at a time. The flags in the mask | 450 // Set or clear multiple flags at a time. The flags in the mask |
451 // are set to the value in "flags", the rest retain the current value | 451 // are set to the value in "flags", the rest retain the current value |
452 // in flags_. | 452 // in flags_. |
453 void SetFlags(intptr_t flags, intptr_t mask) { | 453 void SetFlags(intptr_t flags, intptr_t mask) { |
454 flags_ = (flags_ & ~mask) | (flags & mask); | 454 flags_ = (flags_ & ~mask) | (flags & mask); |
455 } | 455 } |
456 | 456 |
457 // Return all current flags. | 457 // Return all current flags. |
458 intptr_t GetFlags() { return flags_; } | 458 intptr_t GetFlags() { return flags_; } |
459 | 459 |
460 intptr_t parallel_sweeping() const { | 460 |
461 return parallel_sweeping_; | 461 // PARALLEL_SWEEPING_PENDING - This page is ready for parallel sweeping. |
| 462 // PARALLEL_SWEEPING_IN_PROGRESS - This page is currently swept or was |
| 463 // swept by a sweeper thread. |
| 464 // PARALLEL_SWEEPING_DONE - The page state when sweeping is complete or |
| 465 // sweeping must not be performed on that page. |
| 466 enum ParallelSweepingState { |
| 467 PARALLEL_SWEEPING_DONE, |
| 468 PARALLEL_SWEEPING_IN_PROGRESS, |
| 469 PARALLEL_SWEEPING_PENDING |
| 470 }; |
| 471 |
| 472 ParallelSweepingState parallel_sweeping() { |
| 473 return static_cast<ParallelSweepingState>( |
| 474 NoBarrier_Load(¶llel_sweeping_)); |
462 } | 475 } |
463 | 476 |
464 void set_parallel_sweeping(intptr_t state) { | 477 void set_parallel_sweeping(ParallelSweepingState state) { |
465 parallel_sweeping_ = state; | 478 NoBarrier_Store(¶llel_sweeping_, state); |
466 } | 479 } |
467 | 480 |
468 bool TryParallelSweeping() { | 481 bool TryParallelSweeping() { |
469 return NoBarrier_CompareAndSwap(¶llel_sweeping_, 1, 0) == 1; | 482 return NoBarrier_CompareAndSwap(¶llel_sweeping_, |
| 483 PARALLEL_SWEEPING_PENDING, |
| 484 PARALLEL_SWEEPING_IN_PROGRESS) == |
| 485 PARALLEL_SWEEPING_PENDING; |
470 } | 486 } |
471 | 487 |
472 // Manage live byte count (count of bytes known to be live, | 488 // Manage live byte count (count of bytes known to be live, |
473 // because they are marked black). | 489 // because they are marked black). |
474 void ResetLiveBytes() { | 490 void ResetLiveBytes() { |
475 if (FLAG_gc_verbose) { | 491 if (FLAG_gc_verbose) { |
476 PrintF("ResetLiveBytes:%p:%x->0\n", | 492 PrintF("ResetLiveBytes:%p:%x->0\n", |
477 static_cast<void*>(this), live_byte_count_); | 493 static_cast<void*>(this), live_byte_count_); |
478 } | 494 } |
479 live_byte_count_ = 0; | 495 live_byte_count_ = 0; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 SlotsBuffer* slots_buffer_; | 711 SlotsBuffer* slots_buffer_; |
696 SkipList* skip_list_; | 712 SkipList* skip_list_; |
697 intptr_t write_barrier_counter_; | 713 intptr_t write_barrier_counter_; |
698 // Used by the incremental marker to keep track of the scanning progress in | 714 // Used by the incremental marker to keep track of the scanning progress in |
699 // large objects that have a progress bar and are scanned in increments. | 715 // large objects that have a progress bar and are scanned in increments. |
700 int progress_bar_; | 716 int progress_bar_; |
701 // Assuming the initial allocation on a page is sequential, | 717 // Assuming the initial allocation on a page is sequential, |
702 // count highest number of bytes ever allocated on the page. | 718 // count highest number of bytes ever allocated on the page. |
703 int high_water_mark_; | 719 int high_water_mark_; |
704 | 720 |
705 intptr_t parallel_sweeping_; | 721 AtomicWord parallel_sweeping_; |
706 | 722 |
707 // PagedSpace free-list statistics. | 723 // PagedSpace free-list statistics. |
708 intptr_t available_in_small_free_list_; | 724 intptr_t available_in_small_free_list_; |
709 intptr_t available_in_medium_free_list_; | 725 intptr_t available_in_medium_free_list_; |
710 intptr_t available_in_large_free_list_; | 726 intptr_t available_in_large_free_list_; |
711 intptr_t available_in_huge_free_list_; | 727 intptr_t available_in_huge_free_list_; |
712 intptr_t non_available_small_blocks_; | 728 intptr_t non_available_small_blocks_; |
713 | 729 |
714 static MemoryChunk* Initialize(Heap* heap, | 730 static MemoryChunk* Initialize(Heap* heap, |
715 Address base, | 731 Address base, |
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2942 } | 2958 } |
2943 // Must be small, since an iteration is used for lookup. | 2959 // Must be small, since an iteration is used for lookup. |
2944 static const int kMaxComments = 64; | 2960 static const int kMaxComments = 64; |
2945 }; | 2961 }; |
2946 #endif | 2962 #endif |
2947 | 2963 |
2948 | 2964 |
2949 } } // namespace v8::internal | 2965 } } // namespace v8::internal |
2950 | 2966 |
2951 #endif // V8_SPACES_H_ | 2967 #endif // V8_SPACES_H_ |
OLD | NEW |