Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: src/heap.h

Issue 14208005: Use worst-fit allocation in old space for prentured objects. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 // Predicate that governs global pre-tenuring decisions based on observed 1517 // Predicate that governs global pre-tenuring decisions based on observed
1518 // promotion rates of previous collections. 1518 // promotion rates of previous collections.
1519 inline bool ShouldGloballyPretenure() { 1519 inline bool ShouldGloballyPretenure() {
1520 return new_space_high_promotion_mode_active_; 1520 return new_space_high_promotion_mode_active_;
1521 } 1521 }
1522 1522
1523 inline intptr_t PromotedTotalSize() { 1523 inline intptr_t PromotedTotalSize() {
1524 return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); 1524 return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
1525 } 1525 }
1526 1526
1527 // TODO(hpayer): When we provide pretenuring support for all kinds of
1528 // objects we can change this heuristic and make it depend on the high
1529 // promotion mode.
1530 inline bool AggressivePromotionMode() {
1531 return PretenuredSizeOfObjects() > 0;
1532 }
1533
1534 inline int OldGenerationHighPromotionFactor() {
1535 return AggressivePromotionMode() ? 2 : 1;
1536 }
1537
1527 // True if we have reached the allocation limit in the old generation that 1538 // True if we have reached the allocation limit in the old generation that
1528 // should force the next GC (caused normally) to be a full one. 1539 // should force the next GC (caused normally) to be a full one.
1529 inline bool OldGenerationPromotionLimitReached() { 1540 inline bool OldGenerationPromotionLimitReached() {
1530 return PromotedTotalSize() > old_gen_promotion_limit_; 1541 return PromotedTotalSize() >
1542 old_gen_promotion_limit_ * OldGenerationHighPromotionFactor();
1531 } 1543 }
1532 1544
1533 inline intptr_t OldGenerationSpaceAvailable() { 1545 inline intptr_t OldGenerationSpaceAvailable() {
1534 return old_gen_allocation_limit_ - PromotedTotalSize(); 1546 return old_gen_allocation_limit_ - PromotedTotalSize();
1535 } 1547 }
1536 1548
1537 inline intptr_t OldGenerationCapacityAvailable() { 1549 inline intptr_t OldGenerationCapacityAvailable() {
1538 return max_old_generation_size_ - PromotedTotalSize(); 1550 return max_old_generation_size_ - PromotedTotalSize();
1539 } 1551 }
1540 1552
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 } 1636 }
1625 1637
1626 inline bool NextGCIsLikelyToBeFull() { 1638 inline bool NextGCIsLikelyToBeFull() {
1627 if (FLAG_gc_global) return true; 1639 if (FLAG_gc_global) return true;
1628 1640
1629 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true; 1641 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true;
1630 1642
1631 intptr_t total_promoted = PromotedTotalSize(); 1643 intptr_t total_promoted = PromotedTotalSize();
1632 1644
1633 intptr_t adjusted_promotion_limit = 1645 intptr_t adjusted_promotion_limit =
1634 old_gen_promotion_limit_ - new_space_.Capacity(); 1646 old_gen_promotion_limit_ * OldGenerationHighPromotionFactor() -
1647 new_space_.Capacity();
1635 1648
1636 if (total_promoted >= adjusted_promotion_limit) return true; 1649 if (total_promoted >= adjusted_promotion_limit) return true;
1637 1650
1638 intptr_t adjusted_allocation_limit = 1651 intptr_t adjusted_allocation_limit =
1639 old_gen_allocation_limit_ - new_space_.Capacity() / 5; 1652 old_gen_allocation_limit_ * OldGenerationHighPromotionFactor() -
1653 new_space_.Capacity() / 5;
1640 1654
1641 if (PromotedSpaceSizeOfObjects() >= adjusted_allocation_limit) return true; 1655 if (PromotedSpaceSizeOfObjects() >= adjusted_allocation_limit) return true;
1642 1656
1643 return false; 1657 return false;
1644 } 1658 }
1645 1659
1646 1660
1647 void UpdateNewSpaceReferencesInExternalStringTable( 1661 void UpdateNewSpaceReferencesInExternalStringTable(
1648 ExternalStringTableUpdaterCallback updater_func); 1662 ExternalStringTableUpdaterCallback updater_func);
1649 1663
(...skipping 14 matching lines...) Expand all
1664 1678
1665 void ClearJSFunctionResultCaches(); 1679 void ClearJSFunctionResultCaches();
1666 1680
1667 void ClearNormalizedMapCaches(); 1681 void ClearNormalizedMapCaches();
1668 1682
1669 GCTracer* tracer() { return tracer_; } 1683 GCTracer* tracer() { return tracer_; }
1670 1684
1671 // Returns the size of objects residing in non new spaces. 1685 // Returns the size of objects residing in non new spaces.
1672 intptr_t PromotedSpaceSizeOfObjects(); 1686 intptr_t PromotedSpaceSizeOfObjects();
1673 1687
1688 // TODO(hpayer): We can remove PretenuredSizeOfObjects() when
1689 // we provide pretenuring support for all kinds of objects.
1690 intptr_t PretenuredSizeOfObjects();
1691
1674 double total_regexp_code_generated() { return total_regexp_code_generated_; } 1692 double total_regexp_code_generated() { return total_regexp_code_generated_; }
1675 void IncreaseTotalRegexpCodeGenerated(int size) { 1693 void IncreaseTotalRegexpCodeGenerated(int size) {
1676 total_regexp_code_generated_ += size; 1694 total_regexp_code_generated_ += size;
1677 } 1695 }
1678 1696
1679 // Returns maximum GC pause. 1697 // Returns maximum GC pause.
1680 double get_max_gc_pause() { return max_gc_pause_; } 1698 double get_max_gc_pause() { return max_gc_pause_; }
1681 1699
1682 // Returns maximum size of objects alive after GC. 1700 // Returns maximum size of objects alive after GC.
1683 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } 1701 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; }
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 AssertNoAllocation no_alloc; // i.e. no gc allowed. 3038 AssertNoAllocation no_alloc; // i.e. no gc allowed.
3021 3039
3022 private: 3040 private:
3023 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3041 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3024 }; 3042 };
3025 #endif // DEBUG 3043 #endif // DEBUG
3026 3044
3027 } } // namespace v8::internal 3045 } } // namespace v8::internal
3028 3046
3029 #endif // V8_HEAP_H_ 3047 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698