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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 } | 1408 } |
1409 } | 1409 } |
1410 | 1410 |
1411 | 1411 |
1412 void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) { | 1412 void NewSpace::UpdateInlineAllocationLimit(int size_in_bytes) { |
1413 if (heap()->inline_allocation_disabled()) { | 1413 if (heap()->inline_allocation_disabled()) { |
1414 // Lowest limit when linear allocation was disabled. | 1414 // Lowest limit when linear allocation was disabled. |
1415 Address high = to_space_.page_high(); | 1415 Address high = to_space_.page_high(); |
1416 Address new_top = allocation_info_.top() + size_in_bytes; | 1416 Address new_top = allocation_info_.top() + size_in_bytes; |
1417 allocation_info_.set_limit(Min(new_top, high)); | 1417 allocation_info_.set_limit(Min(new_top, high)); |
1418 } else if (inline_allocation_limit_step() == 0) { | |
1419 // Normal limit is the end of the current page. | |
1420 allocation_info_.set_limit(to_space_.page_high()); | |
1421 } else { | 1418 } else { |
1422 // Lower limit during incremental marking. | 1419 // Lower limit during incremental marking. |
| 1420 DCHECK(inline_allocation_limit_step_ != 0); |
1423 Address high = to_space_.page_high(); | 1421 Address high = to_space_.page_high(); |
1424 Address new_top = allocation_info_.top() + size_in_bytes; | 1422 Address new_top = allocation_info_.top() + size_in_bytes; |
1425 Address new_limit = new_top + inline_allocation_limit_step_; | 1423 Address new_limit = new_top + inline_allocation_limit_step_; |
1426 allocation_info_.set_limit(Min(new_limit, high)); | 1424 allocation_info_.set_limit(Min(new_limit, high)); |
1427 } | 1425 } |
1428 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | 1426 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
1429 } | 1427 } |
1430 | 1428 |
1431 | 1429 |
1432 bool NewSpace::AddFreshPage() { | 1430 bool NewSpace::AddFreshPage() { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 old_top = allocation_info_.top(); | 1493 old_top = allocation_info_.top(); |
1496 high = to_space_.page_high(); | 1494 high = to_space_.page_high(); |
1497 filler_size = Heap::GetFillToAlign(old_top, alignment); | 1495 filler_size = Heap::GetFillToAlign(old_top, alignment); |
1498 aligned_size_in_bytes = size_in_bytes + filler_size; | 1496 aligned_size_in_bytes = size_in_bytes + filler_size; |
1499 } | 1497 } |
1500 | 1498 |
1501 DCHECK(old_top + aligned_size_in_bytes < high); | 1499 DCHECK(old_top + aligned_size_in_bytes < high); |
1502 | 1500 |
1503 if (allocation_info_.limit() < high) { | 1501 if (allocation_info_.limit() < high) { |
1504 // Either the limit has been lowered because linear allocation was disabled | 1502 // Either the limit has been lowered because linear allocation was disabled |
1505 // or because incremental marking wants to get a chance to do a step. Set | 1503 // or because incremental marking wants to get a chance to do a step, |
1506 // the new limit accordingly. | 1504 // or because idle scavenge job wants to get a chance to post a task. |
| 1505 // Set the new limit accordingly. |
1507 if (top_on_previous_step_) { | 1506 if (top_on_previous_step_) { |
1508 Address new_top = old_top + aligned_size_in_bytes; | 1507 Address new_top = old_top + aligned_size_in_bytes; |
1509 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); | 1508 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); |
| 1509 heap()->ScheduleIdleScavengeIfNeeded(bytes_allocated); |
1510 heap()->incremental_marking()->Step( | 1510 heap()->incremental_marking()->Step( |
1511 bytes_allocated, IncrementalMarking::GC_VIA_STACK_GUARD); | 1511 bytes_allocated, IncrementalMarking::GC_VIA_STACK_GUARD); |
1512 top_on_previous_step_ = new_top; | 1512 top_on_previous_step_ = new_top; |
1513 } | 1513 } |
1514 UpdateInlineAllocationLimit(aligned_size_in_bytes); | 1514 UpdateInlineAllocationLimit(aligned_size_in_bytes); |
1515 } | 1515 } |
1516 return true; | 1516 return true; |
1517 } | 1517 } |
1518 | 1518 |
1519 | 1519 |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 object->ShortPrint(); | 3144 object->ShortPrint(); |
3145 PrintF("\n"); | 3145 PrintF("\n"); |
3146 } | 3146 } |
3147 printf(" --------------------------------------\n"); | 3147 printf(" --------------------------------------\n"); |
3148 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3148 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3149 } | 3149 } |
3150 | 3150 |
3151 #endif // DEBUG | 3151 #endif // DEBUG |
3152 } // namespace internal | 3152 } // namespace internal |
3153 } // namespace v8 | 3153 } // namespace v8 |
OLD | NEW |