OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/scavenger.h" | 5 #include "src/heap/scavenger.h" |
6 | 6 |
7 #include "src/contexts.h" | 7 #include "src/contexts.h" |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/heap/objects-visiting-inl.h" | 9 #include "src/heap/objects-visiting-inl.h" |
10 #include "src/heap/scavenger-inl.h" | 10 #include "src/heap/scavenger-inl.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 table_.Register(kVisitJSTypedArray, | 70 table_.Register(kVisitJSTypedArray, |
71 &ObjectEvacuationStrategy<POINTER_OBJECT>::Visit); | 71 &ObjectEvacuationStrategy<POINTER_OBJECT>::Visit); |
72 | 72 |
73 table_.Register(kVisitJSDataView, | 73 table_.Register(kVisitJSDataView, |
74 &ObjectEvacuationStrategy<POINTER_OBJECT>::Visit); | 74 &ObjectEvacuationStrategy<POINTER_OBJECT>::Visit); |
75 | 75 |
76 table_.Register(kVisitJSRegExp, | 76 table_.Register(kVisitJSRegExp, |
77 &ObjectEvacuationStrategy<POINTER_OBJECT>::Visit); | 77 &ObjectEvacuationStrategy<POINTER_OBJECT>::Visit); |
78 | 78 |
79 if (marks_handling == IGNORE_MARKS) { | 79 table_.Register(kVisitJSFunction, &EvacuateJSFunction); |
80 table_.Register( | |
81 kVisitJSFunction, | |
82 &ObjectEvacuationStrategy<POINTER_OBJECT>::template VisitSpecialized< | |
83 JSFunction::kSize>); | |
84 } else { | |
85 table_.Register(kVisitJSFunction, &EvacuateJSFunction); | |
86 } | |
87 | 80 |
88 table_.RegisterSpecializations<ObjectEvacuationStrategy<DATA_OBJECT>, | 81 table_.RegisterSpecializations<ObjectEvacuationStrategy<DATA_OBJECT>, |
89 kVisitDataObject, kVisitDataObjectGeneric>(); | 82 kVisitDataObject, kVisitDataObjectGeneric>(); |
90 | 83 |
91 table_.RegisterSpecializations<ObjectEvacuationStrategy<POINTER_OBJECT>, | 84 table_.RegisterSpecializations<ObjectEvacuationStrategy<POINTER_OBJECT>, |
92 kVisitJSObject, kVisitJSObjectGeneric>(); | 85 kVisitJSObject, kVisitJSObjectGeneric>(); |
93 | 86 |
94 table_.RegisterSpecializations<ObjectEvacuationStrategy<POINTER_OBJECT>, | 87 table_.RegisterSpecializations<ObjectEvacuationStrategy<POINTER_OBJECT>, |
95 kVisitStruct, kVisitStructGeneric>(); | 88 kVisitStruct, kVisitStructGeneric>(); |
96 } | 89 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 228 |
236 // If promotion failed, we try to copy the object to the other semi-space | 229 // If promotion failed, we try to copy the object to the other semi-space |
237 if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) return; | 230 if (SemiSpaceCopyObject<alignment>(map, slot, object, object_size)) return; |
238 | 231 |
239 FatalProcessOutOfMemory("Scavenger: semi-space copy\n"); | 232 FatalProcessOutOfMemory("Scavenger: semi-space copy\n"); |
240 } | 233 } |
241 | 234 |
242 | 235 |
243 static inline void EvacuateJSFunction(Map* map, HeapObject** slot, | 236 static inline void EvacuateJSFunction(Map* map, HeapObject** slot, |
244 HeapObject* object) { | 237 HeapObject* object) { |
245 ObjectEvacuationStrategy<POINTER_OBJECT>::template VisitSpecialized< | 238 ObjectEvacuationStrategy<POINTER_OBJECT>::Visit(map, slot, object); |
246 JSFunction::kSize>(map, slot, object); | 239 |
| 240 if (marks_handling == IGNORE_MARKS) return; |
247 | 241 |
248 MapWord map_word = object->map_word(); | 242 MapWord map_word = object->map_word(); |
249 DCHECK(map_word.IsForwardingAddress()); | 243 DCHECK(map_word.IsForwardingAddress()); |
250 HeapObject* target = map_word.ToForwardingAddress(); | 244 HeapObject* target = map_word.ToForwardingAddress(); |
251 | 245 |
252 MarkBit mark_bit = Marking::MarkBitFrom(target); | 246 MarkBit mark_bit = Marking::MarkBitFrom(target); |
253 if (Marking::IsBlack(mark_bit)) { | 247 if (Marking::IsBlack(mark_bit)) { |
254 // This object is black and it might not be rescanned by marker. | 248 // This object is black and it might not be rescanned by marker. |
255 // We should explicitly record code entry slot for compaction because | 249 // We should explicitly record code entry slot for compaction because |
256 // promotion queue processing (IterateAndMarkPointersToFromSpace) will | 250 // promotion queue processing (IterateAndMarkPointersToFromSpace) will |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 482 |
489 void ScavengeVisitor::ScavengePointer(Object** p) { | 483 void ScavengeVisitor::ScavengePointer(Object** p) { |
490 Object* object = *p; | 484 Object* object = *p; |
491 if (!heap_->InNewSpace(object)) return; | 485 if (!heap_->InNewSpace(object)) return; |
492 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 486 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
493 reinterpret_cast<HeapObject*>(object)); | 487 reinterpret_cast<HeapObject*>(object)); |
494 } | 488 } |
495 | 489 |
496 } // namespace internal | 490 } // namespace internal |
497 } // namespace v8 | 491 } // namespace v8 |
OLD | NEW |