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 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1509 Address high = to_space_.page_high(); | 1509 Address high = to_space_.page_high(); |
1510 Address new_top = allocation_info_.top() + size_in_bytes; | 1510 Address new_top = allocation_info_.top() + size_in_bytes; |
1511 allocation_info_.set_limit(Min(new_top, high)); | 1511 allocation_info_.set_limit(Min(new_top, high)); |
1512 } else if (top_on_previous_step_ == 0) { | 1512 } else if (top_on_previous_step_ == 0) { |
1513 // Normal limit is the end of the current page. | 1513 // Normal limit is the end of the current page. |
1514 allocation_info_.set_limit(to_space_.page_high()); | 1514 allocation_info_.set_limit(to_space_.page_high()); |
1515 } else { | 1515 } else { |
1516 // Lower limit during incremental marking. | 1516 // Lower limit during incremental marking. |
1517 Address high = to_space_.page_high(); | 1517 Address high = to_space_.page_high(); |
1518 Address new_top = allocation_info_.top() + size_in_bytes; | 1518 Address new_top = allocation_info_.top() + size_in_bytes; |
1519 Address new_limit = new_top + inline_allocation_limit_step_; | 1519 |
1520 intptr_t next_step = 0; | |
1521 for (int i = 0; i < inline_allocation_observers_.length(); ++i) { | |
Hannes Payer (out of office)
2015/11/09 19:26:39
Can we move that code into a helper function?
ofrobots
2015/11/09 23:00:32
Done.
| |
1522 InlineAllocationObserver* o = inline_allocation_observers_[i]; | |
1523 next_step = next_step ? Min(next_step, o->bytes_to_next_step()) | |
1524 : o->bytes_to_next_step(); | |
1525 } | |
1526 DCHECK(next_step != 0); | |
1527 Address new_limit = new_top + next_step; | |
1520 allocation_info_.set_limit(Min(new_limit, high)); | 1528 allocation_info_.set_limit(Min(new_limit, high)); |
1521 } | 1529 } |
1522 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | 1530 DCHECK_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
1523 } | 1531 } |
1524 | 1532 |
1525 | 1533 |
1526 bool NewSpace::AddFreshPage() { | 1534 bool NewSpace::AddFreshPage() { |
1527 Address top = allocation_info_.top(); | 1535 Address top = allocation_info_.top(); |
1528 if (NewSpacePage::IsAtStart(top)) { | 1536 if (NewSpacePage::IsAtStart(top)) { |
1529 // The current page is already empty. Don't try to make another. | 1537 // The current page is already empty. Don't try to make another. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1595 // Set the new limit accordingly. | 1603 // Set the new limit accordingly. |
1596 Address new_top = old_top + aligned_size_in_bytes; | 1604 Address new_top = old_top + aligned_size_in_bytes; |
1597 InlineAllocationStep(new_top, new_top); | 1605 InlineAllocationStep(new_top, new_top); |
1598 UpdateInlineAllocationLimit(aligned_size_in_bytes); | 1606 UpdateInlineAllocationLimit(aligned_size_in_bytes); |
1599 } | 1607 } |
1600 return true; | 1608 return true; |
1601 } | 1609 } |
1602 | 1610 |
1603 | 1611 |
1604 void NewSpace::UpdateInlineAllocationLimitStep() { | 1612 void NewSpace::UpdateInlineAllocationLimitStep() { |
1605 intptr_t step = 0; | 1613 top_on_previous_step_ = |
Hannes Payer (out of office)
2015/11/09 19:26:39
This method is now just updating top_on_previous_s
ofrobots
2015/11/09 23:00:32
Done.
| |
1606 for (int i = 0; i < inline_allocation_observers_.length(); ++i) { | 1614 inline_allocation_observers_.length() ? allocation_info_.top() : 0; |
1607 InlineAllocationObserver* observer = inline_allocation_observers_[i]; | |
1608 step = step ? Min(step, observer->step_size()) : observer->step_size(); | |
1609 } | |
1610 inline_allocation_limit_step_ = step; | |
1611 top_on_previous_step_ = step ? allocation_info_.top() : 0; | |
1612 UpdateInlineAllocationLimit(0); | 1615 UpdateInlineAllocationLimit(0); |
1613 } | 1616 } |
1614 | 1617 |
1615 | 1618 |
1616 void NewSpace::AddInlineAllocationObserver(InlineAllocationObserver* observer) { | 1619 void NewSpace::AddInlineAllocationObserver(InlineAllocationObserver* observer) { |
1617 inline_allocation_observers_.Add(observer); | 1620 inline_allocation_observers_.Add(observer); |
1618 UpdateInlineAllocationLimitStep(); | 1621 UpdateInlineAllocationLimitStep(); |
1619 } | 1622 } |
1620 | 1623 |
1621 | 1624 |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3298 object->ShortPrint(); | 3301 object->ShortPrint(); |
3299 PrintF("\n"); | 3302 PrintF("\n"); |
3300 } | 3303 } |
3301 printf(" --------------------------------------\n"); | 3304 printf(" --------------------------------------\n"); |
3302 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3305 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3303 } | 3306 } |
3304 | 3307 |
3305 #endif // DEBUG | 3308 #endif // DEBUG |
3306 } // namespace internal | 3309 } // namespace internal |
3307 } // namespace v8 | 3310 } // namespace v8 |
OLD | NEW |