Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
| 9 #include "src/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
| 10 #include "src/heap/slots-buffer.h" | 10 #include "src/heap/slots-buffer.h" |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1461 } | 1461 } |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 | 1464 |
| 1465 void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) { | 1465 void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) { |
| 1466 if (heap()->inline_allocation_disabled()) { | 1466 if (heap()->inline_allocation_disabled()) { |
| 1467 // Lowest limit when linear allocation was disabled. | 1467 // Lowest limit when linear allocation was disabled. |
| 1468 Address high = to_space_.page_high(); | 1468 Address high = to_space_.page_high(); |
| 1469 Address new_top = allocation_info_.top() + size_in_bytes; | 1469 Address new_top = allocation_info_.top() + size_in_bytes; |
| 1470 allocation_info_.set_limit(Min(new_top, high)); | 1470 allocation_info_.set_limit(Min(new_top, high)); |
| 1471 } else if (inline_allocation_limit_step() == 0) { | 1471 } else if (inline_allocation_limit_step() == 0) { |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
This case is now dead code.
ulan
2015/09/23 09:58:38
Done.
| |
| 1472 // Normal limit is the end of the current page. | 1472 // Normal limit is the end of the current page. |
| 1473 allocation_info_.set_limit(to_space_.page_high()); | 1473 allocation_info_.set_limit(to_space_.page_high()); |
| 1474 } else { | 1474 } else { |
| 1475 // Lower limit during incremental marking. | 1475 // Lower limit during incremental marking. |
| 1476 Address high = to_space_.page_high(); | 1476 Address high = to_space_.page_high(); |
| 1477 Address new_top = allocation_info_.top() + size_in_bytes; | 1477 Address new_top = allocation_info_.top() + size_in_bytes; |
| 1478 Address new_limit = new_top + inline_allocation_limit_step_; | 1478 Address new_limit = new_top + inline_allocation_limit_step_; |
| 1479 allocation_info_.set_limit(Min(new_limit, high)); | 1479 allocation_info_.set_limit(Min(new_limit, high)); |
| 1480 } | 1480 } |
| 1481 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | 1481 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1545 top_on_previous_step_ = old_top; | 1545 top_on_previous_step_ = old_top; |
| 1546 | 1546 |
| 1547 high = to_space_.page_high(); | 1547 high = to_space_.page_high(); |
| 1548 filler_size = Heap::GetFillToAlign(old_top, alignment); | 1548 filler_size = Heap::GetFillToAlign(old_top, alignment); |
| 1549 aligned_size_in_bytes = size_in_bytes + filler_size; | 1549 aligned_size_in_bytes = size_in_bytes + filler_size; |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 DCHECK(old_top + aligned_size_in_bytes < high); | 1552 DCHECK(old_top + aligned_size_in_bytes < high); |
| 1553 | 1553 |
| 1554 if (allocation_info_.limit() < high) { | 1554 if (allocation_info_.limit() < high) { |
| 1555 // Either the limit has been lowered because linear allocation was disabled | 1555 // Either the limit has been lowered because linear allocation was disabled |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
Update this comment (maybe some other comments als
ulan
2015/09/23 09:58:38
Done.
| |
| 1556 // or because incremental marking wants to get a chance to do a step. Set | 1556 // or because incremental marking wants to get a chance to do a step. Set |
| 1557 // the new limit accordingly. | 1557 // the new limit accordingly. |
| 1558 Address new_top = old_top + aligned_size_in_bytes; | 1558 Address new_top = old_top + aligned_size_in_bytes; |
| 1559 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); | 1559 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); |
| 1560 heap()->ScheduleIdleScavenge(bytes_allocated); | |
|
Hannes Payer (out of office)
2015/09/21 09:00:57
Hmm, when incremental marking is on, steps will be
ulan
2015/09/23 09:58:38
The function already checks the bytes allocated. C
| |
| 1560 heap()->incremental_marking()->Step(bytes_allocated, | 1561 heap()->incremental_marking()->Step(bytes_allocated, |
| 1561 IncrementalMarking::GC_VIA_STACK_GUARD); | 1562 IncrementalMarking::GC_VIA_STACK_GUARD); |
| 1562 UpdateInlineAllocationLimit(aligned_size_in_bytes); | 1563 UpdateInlineAllocationLimit(aligned_size_in_bytes); |
| 1563 top_on_previous_step_ = new_top; | 1564 top_on_previous_step_ = new_top; |
| 1564 } | 1565 } |
| 1565 return true; | 1566 return true; |
| 1566 } | 1567 } |
| 1567 | 1568 |
| 1568 | 1569 |
| 1569 #ifdef VERIFY_HEAP | 1570 #ifdef VERIFY_HEAP |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3184 object->ShortPrint(); | 3185 object->ShortPrint(); |
| 3185 PrintF("\n"); | 3186 PrintF("\n"); |
| 3186 } | 3187 } |
| 3187 printf(" --------------------------------------\n"); | 3188 printf(" --------------------------------------\n"); |
| 3188 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3189 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3189 } | 3190 } |
| 3190 | 3191 |
| 3191 #endif // DEBUG | 3192 #endif // DEBUG |
| 3192 } // namespace internal | 3193 } // namespace internal |
| 3193 } // namespace v8 | 3194 } // namespace v8 |
| OLD | NEW |