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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 InlineAllocationStep(old_top, allocation_info_.top()); | 1403 InlineAllocationStep(old_top, allocation_info_.top()); |
1404 } | 1404 } |
1405 | 1405 |
1406 | 1406 |
1407 void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) { | 1407 void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) { |
1408 if (heap()->inline_allocation_disabled()) { | 1408 if (heap()->inline_allocation_disabled()) { |
1409 // Lowest limit when linear allocation was disabled. | 1409 // Lowest limit when linear allocation was disabled. |
1410 Address high = to_space_.page_high(); | 1410 Address high = to_space_.page_high(); |
1411 Address new_top = allocation_info_.top() + size_in_bytes; | 1411 Address new_top = allocation_info_.top() + size_in_bytes; |
1412 allocation_info_.set_limit(Min(new_top, high)); | 1412 allocation_info_.set_limit(Min(new_top, high)); |
1413 } else if (inline_allocation_limit_step() == 0) { | 1413 } else if (inline_allocation_limit_step_ == 0) { |
1414 // Normal limit is the end of the current page. | 1414 // Normal limit is the end of the current page. |
1415 allocation_info_.set_limit(to_space_.page_high()); | 1415 allocation_info_.set_limit(to_space_.page_high()); |
1416 } else { | 1416 } else { |
1417 // Lower limit during incremental marking. | 1417 // Lower limit during incremental marking. |
1418 Address high = to_space_.page_high(); | 1418 Address high = to_space_.page_high(); |
1419 Address new_top = allocation_info_.top() + size_in_bytes; | 1419 Address new_top = allocation_info_.top() + size_in_bytes; |
1420 Address new_limit = new_top + inline_allocation_limit_step_; | 1420 Address new_limit = new_top + inline_allocation_limit_step_; |
1421 allocation_info_.set_limit(Min(new_limit, high)); | 1421 allocation_info_.set_limit(Min(new_limit, high)); |
1422 } | 1422 } |
1423 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | 1423 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 old_top = allocation_info_.top(); | 1484 old_top = allocation_info_.top(); |
1485 high = to_space_.page_high(); | 1485 high = to_space_.page_high(); |
1486 filler_size = Heap::GetFillToAlign(old_top, alignment); | 1486 filler_size = Heap::GetFillToAlign(old_top, alignment); |
1487 aligned_size_in_bytes = size_in_bytes + filler_size; | 1487 aligned_size_in_bytes = size_in_bytes + filler_size; |
1488 } | 1488 } |
1489 | 1489 |
1490 DCHECK(old_top + aligned_size_in_bytes < high); | 1490 DCHECK(old_top + aligned_size_in_bytes < high); |
1491 | 1491 |
1492 if (allocation_info_.limit() < high) { | 1492 if (allocation_info_.limit() < high) { |
1493 // Either the limit has been lowered because linear allocation was disabled | 1493 // Either the limit has been lowered because linear allocation was disabled |
1494 // or because incremental marking wants to get a chance to do a step. Set | 1494 // or because incremental marking wants to get a chance to do a step, |
1495 // the new limit accordingly. | 1495 // or because idle scavenge job wants to get a chance to post a task. |
| 1496 // Set the new limit accordingly. |
1496 Address new_top = old_top + aligned_size_in_bytes; | 1497 Address new_top = old_top + aligned_size_in_bytes; |
1497 InlineAllocationStep(new_top, new_top); | 1498 InlineAllocationStep(new_top, new_top); |
1498 UpdateInlineAllocationLimit(aligned_size_in_bytes); | 1499 UpdateInlineAllocationLimit(aligned_size_in_bytes); |
1499 } | 1500 } |
1500 return true; | 1501 return true; |
1501 } | 1502 } |
1502 | 1503 |
1503 | 1504 |
1504 void NewSpace::InlineAllocationStep(Address top, Address new_top) { | 1505 void NewSpace::InlineAllocationStep(Address top, Address new_top) { |
1505 if (top_on_previous_step_) { | 1506 if (top_on_previous_step_) { |
1506 int bytes_allocated = static_cast<int>(top - top_on_previous_step_); | 1507 int bytes_allocated = static_cast<int>(top - top_on_previous_step_); |
| 1508 heap()->ScheduleIdleScavengeIfNeeded(bytes_allocated); |
1507 heap()->incremental_marking()->Step(bytes_allocated, | 1509 heap()->incremental_marking()->Step(bytes_allocated, |
1508 IncrementalMarking::GC_VIA_STACK_GUARD); | 1510 IncrementalMarking::GC_VIA_STACK_GUARD); |
1509 top_on_previous_step_ = new_top; | 1511 top_on_previous_step_ = new_top; |
1510 } | 1512 } |
1511 } | 1513 } |
1512 | 1514 |
1513 #ifdef VERIFY_HEAP | 1515 #ifdef VERIFY_HEAP |
1514 // We do not use the SemiSpaceIterator because verification doesn't assume | 1516 // We do not use the SemiSpaceIterator because verification doesn't assume |
1515 // that it works (it depends on the invariants we are checking). | 1517 // that it works (it depends on the invariants we are checking). |
1516 void NewSpace::Verify() { | 1518 void NewSpace::Verify() { |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3139 object->ShortPrint(); | 3141 object->ShortPrint(); |
3140 PrintF("\n"); | 3142 PrintF("\n"); |
3141 } | 3143 } |
3142 printf(" --------------------------------------\n"); | 3144 printf(" --------------------------------------\n"); |
3143 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3145 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3144 } | 3146 } |
3145 | 3147 |
3146 #endif // DEBUG | 3148 #endif // DEBUG |
3147 } // namespace internal | 3149 } // namespace internal |
3148 } // namespace v8 | 3150 } // namespace v8 |
OLD | NEW |