Chromium Code Reviews| Index: src/heap/spaces.h |
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
| index 69a8d89fccba5c5aa06f91d2a1995870b70ef033..f94d01ed0d67f08f5e613a08045b2291a3e6df28 100644 |
| --- a/src/heap/spaces.h |
| +++ b/src/heap/spaces.h |
| @@ -2476,6 +2476,8 @@ class NewSpace : public Space { |
| from_space_(heap, kFromSpace), |
| reservation_(), |
| inline_allocation_limit_step_(0), |
| + incremental_marking_step_(0), |
| + idle_scavenge_step_(0), |
| top_on_previous_step_(0) {} |
| // Sets up the new space using the given chunk. |
| @@ -2649,10 +2651,14 @@ class NewSpace : public Space { |
| void ResetAllocationInfo(); |
| void UpdateInlineAllocationLimit(int size_in_bytes); |
| - void LowerInlineAllocationLimit(intptr_t step) { |
| - inline_allocation_limit_step_ = step; |
| - UpdateInlineAllocationLimit(0); |
| - top_on_previous_step_ = step ? allocation_info_.top() : 0; |
| + |
| + void SetIncrementalMarkingStep(intptr_t step) { |
| + incremental_marking_step_ = step; |
| + LowerInlineAllocationLimit(); |
| + } |
| + void SetIdleScavengeStep(intptr_t step) { |
| + idle_scavenge_step_ = step; |
| + LowerInlineAllocationLimit(); |
| } |
| // Get the extent of the inactive semispace (for use as a marking stack, |
| @@ -2728,6 +2734,19 @@ class NewSpace : public Space { |
| // Update allocation info to match the current to-space page. |
| void UpdateAllocationInfo(); |
| + void LowerInlineAllocationLimit() { |
| + intptr_t step; |
| + if (incremental_marking_step_ && idle_scavenge_step_) { |
| + step = Min(incremental_marking_step_, idle_scavenge_step_); |
| + } else { |
| + step = incremental_marking_step_ ? incremental_marking_step_ |
| + : idle_scavenge_step_; |
| + } |
| + inline_allocation_limit_step_ = step; |
| + top_on_previous_step_ = step ? allocation_info_.top() : 0; |
| + UpdateInlineAllocationLimit(0); |
| + } |
| + |
| Address chunk_base_; |
| uintptr_t chunk_size_; |
| @@ -2747,11 +2766,14 @@ class NewSpace : public Space { |
| // mark-compact collection. |
| AllocationInfo allocation_info_; |
| - // When incremental marking is active we will set allocation_info_.limit |
| - // to be lower than actual limit and then will gradually increase it |
| - // in steps to guarantee that we do incremental marking steps even |
| - // when all allocation is performed from inlined generated code. |
| + // When inline allocation stepping is active, either because of incremental |
| + // marking or because of idle scavenge, we 'interrupt' inline allocation every |
| + // once in a while. This is done by setting allocation_info_.limit to be lower |
| + // than the actual limit and and increasing it in steps to guarantee that the |
| + // observers are notified periodically. |
| intptr_t inline_allocation_limit_step_; |
|
Hannes Payer (out of office)
2015/10/13 16:51:24
Having a state that belongs to incremental marking
|
| + intptr_t incremental_marking_step_; |
| + intptr_t idle_scavenge_step_; |
| Address top_on_previous_step_; |
| @@ -2761,8 +2783,7 @@ class NewSpace : public Space { |
| bool EnsureAllocation(int size_in_bytes, AllocationAlignment alignment); |
| // If we are doing inline allocation in steps, this method performs the 'step' |
| - // operation. Right now incremental marking is the only consumer of inline |
| - // allocation steps. top is the memory address of the bump pointer at the last |
| + // operation. top is the memory address of the bump pointer at the last |
| // inline allocation (i.e. it determines the numbers of bytes actually |
| // allocated since the last step.) new_top is the address of the bump pointer |
| // where the next byte is going to be allocated from. top and new_top may be |