Index: src/heap/heap-inl.h |
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h |
index f9c9235320b25df45a116cd08fd04fe7b4692451..0788d5ced44ede7bbb1980c7d7b4d9bb3afbf477 100644 |
--- a/src/heap/heap-inl.h |
+++ b/src/heap/heap-inl.h |
@@ -393,10 +393,22 @@ bool Heap::OldGenerationAllocationLimitReached() { |
return OldGenerationSpaceAvailable() < 0; |
} |
- |
-bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
+bool Heap::ShouldBePromoted(Address old_address, int object_size, |
+ 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); |
} |