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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 3b8a9eadb385bd92b9c0d29659bd01fccdd2fe3b..f3bcf33fbb542cf85bfb327a5bf53b3b45e4493b 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1524,10 +1524,22 @@ class Heap {
return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
}
+ // TODO(hpayer): When we provide pretenuring support for all kinds of
+ // objects we can change this heuristic and make it depend on the high
+ // promotion mode.
+ inline bool AggressivePromotionMode() {
+ return PretenuredSizeOfObjects() > 0;
+ }
+
+ inline int OldGenerationHighPromotionFactor() {
+ return AggressivePromotionMode() ? 2 : 1;
+ }
+
// True if we have reached the allocation limit in the old generation that
// should force the next GC (caused normally) to be a full one.
inline bool OldGenerationPromotionLimitReached() {
- return PromotedTotalSize() > old_gen_promotion_limit_;
+ return PromotedTotalSize() >
+ old_gen_promotion_limit_ * OldGenerationHighPromotionFactor();
}
inline intptr_t OldGenerationSpaceAvailable() {
@@ -1631,12 +1643,14 @@ class Heap {
intptr_t total_promoted = PromotedTotalSize();
intptr_t adjusted_promotion_limit =
- old_gen_promotion_limit_ - new_space_.Capacity();
+ old_gen_promotion_limit_ * OldGenerationHighPromotionFactor() -
+ new_space_.Capacity();
if (total_promoted >= adjusted_promotion_limit) return true;
intptr_t adjusted_allocation_limit =
- old_gen_allocation_limit_ - new_space_.Capacity() / 5;
+ old_gen_allocation_limit_ * OldGenerationHighPromotionFactor() -
+ new_space_.Capacity() / 5;
if (PromotedSpaceSizeOfObjects() >= adjusted_allocation_limit) return true;
@@ -1671,6 +1685,10 @@ class Heap {
// Returns the size of objects residing in non new spaces.
intptr_t PromotedSpaceSizeOfObjects();
+ // TODO(hpayer): We can remove PretenuredSizeOfObjects() when
+ // we provide pretenuring support for all kinds of objects.
+ intptr_t PretenuredSizeOfObjects();
+
double total_regexp_code_generated() { return total_regexp_code_generated_; }
void IncreaseTotalRegexpCodeGenerated(int size) {
total_regexp_code_generated_ += size;
« 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