Chromium Code Reviews| Index: src/spaces.h |
| diff --git a/src/spaces.h b/src/spaces.h |
| index 9d47f81ac63dbbf65d357769c02f6307bf6ff15f..f152a6431189a5fec3353a1628aca33555d4414b 100644 |
| --- a/src/spaces.h |
| +++ b/src/spaces.h |
| @@ -457,16 +457,30 @@ class MemoryChunk { |
| // Return all current flags. |
| intptr_t GetFlags() { return flags_; } |
| - intptr_t parallel_sweeping() const { |
| - return parallel_sweeping_; |
| + |
| + // PARALLEL_SWEEPING_PENDING - This page is ready for parallel sweeping. |
| + // PARALLEL_SWEEPING_COMPLETE - This page was swept by a sweeper thread. |
| + // PARALLEL_SWEEPING_DONE - The page state when sweeping is complete or |
| + // sweeping must not be performed on that page. |
| + enum ParallelSweepingState { |
| + PARALLEL_SWEEPING_DONE, |
| + PARALLEL_SWEEPING_COMPLETE, |
|
Jarin
2014/02/14 09:04:13
Is not PARALLEL_SWEEPING_COMPLETE more like "in pr
Hannes Payer (out of office)
2014/02/14 12:29:17
Done.
|
| + PARALLEL_SWEEPING_PENDING |
| + }; |
| + |
| + ParallelSweepingState parallel_sweeping() { |
| + return static_cast<ParallelSweepingState>(parallel_sweeping_); |
|
Jarin
2014/02/14 09:04:13
This should be NoBarrier_Load
Hannes Payer (out of office)
2014/02/14 12:29:17
Ups, I accidentally removed this one.
Done.
|
| } |
| - void set_parallel_sweeping(intptr_t state) { |
| - parallel_sweeping_ = state; |
| + void set_parallel_sweeping(ParallelSweepingState state) { |
| + NoBarrier_Store(¶llel_sweeping_, state); |
| } |
| bool TryParallelSweeping() { |
| - return NoBarrier_CompareAndSwap(¶llel_sweeping_, 1, 0) == 1; |
| + return NoBarrier_CompareAndSwap(¶llel_sweeping_, |
| + PARALLEL_SWEEPING_PENDING, |
| + PARALLEL_SWEEPING_COMPLETE) == |
| + PARALLEL_SWEEPING_PENDING; |
| } |
| // Manage live byte count (count of bytes known to be live, |
| @@ -702,7 +716,7 @@ class MemoryChunk { |
| // count highest number of bytes ever allocated on the page. |
| int high_water_mark_; |
| - intptr_t parallel_sweeping_; |
| + AtomicWord parallel_sweeping_; |
| // PagedSpace free-list statistics. |
| intptr_t available_in_small_free_list_; |