Index: src/heap/heap-inl.h |
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h |
index f9c9235320b25df45a116cd08fd04fe7b4692451..b53b697e55799fa7f069f0ba21b6bb53153da9e5 100644 |
--- a/src/heap/heap-inl.h |
+++ b/src/heap/heap-inl.h |
@@ -393,10 +393,30 @@ bool Heap::OldGenerationAllocationLimitReached() { |
return OldGenerationSpaceAvailable() < 0; |
} |
+PromotionMode Heap::CurrentPromotionMode() { |
+ if (incremental_marking()->IsMarking()) { |
+ return PROMOTE_MARKED; |
+ } else { |
+ return DEFAULT_PROMOTION; |
+ } |
+} |
-bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
+bool Heap::ShouldBePromoted(Address old_address, int object_size, |
Hannes Payer (out of office)
2016/05/25 05:35:46
How about templatizing this function based on mode
ulan
2016/05/25 08:24:09
The callers would have to check the mode at runtim
|
+ PromotionMode promotion_mode) { |
Page* page = Page::FromAddress(old_address); |
Address age_mark = new_space_.age_mark(); |
+ |
+ if (promotion_mode == FORCE_PROMOTION) { |
+ return true; |
+ } |
+ |
+ if (promotion_mode == PROMOTE_MARKED) { |
+ MarkBit mark_bit = Marking::MarkBitFrom(old_address); |
+ if (!Marking::IsWhite(mark_bit)) { |
+ return true; |
+ } |
+ } |
+ |
return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
(!page->ContainsLimit(age_mark) || old_address < age_mark); |
} |