Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index d6a83346fab226b70ba9816222077bf99b14ffd9..7320be3ad2f44cc3b5599ab674b9c49893aafe13 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -3373,6 +3373,8 @@ AllocationResult Heap::CopyCode(Code* code) { |
// We have to iterate over the object and process its pointers when black |
// allocation is on. |
incremental_marking()->IterateBlackObject(new_code); |
+ // Record all references to embedded objects in the new code object. |
+ RecordWritesIntoCode(new_code); |
return new_code; |
} |
@@ -5788,6 +5790,13 @@ void Heap::RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, |
source_page, reinterpret_cast<Address>(host), slot_type, addr); |
} |
+void Heap::RecordWritesIntoCode(Code* code) { |
+ for (RelocIterator it(code, RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); |
+ !it.done(); it.next()) { |
+ RecordWriteIntoCode(code, it.rinfo(), it.rinfo()->target_object()); |
+ } |
+} |
+ |
Space* AllSpaces::next() { |
switch (counter_++) { |
case NEW_SPACE: |
@@ -5805,7 +5814,6 @@ Space* AllSpaces::next() { |
} |
} |
- |
PagedSpace* PagedSpaces::next() { |
switch (counter_++) { |
case OLD_SPACE: |