OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 template<typename StaticVisitor> | 257 template<typename StaticVisitor> |
258 void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( | 258 void StaticMarkingVisitor<StaticVisitor>::VisitEmbeddedPointer( |
259 Heap* heap, RelocInfo* rinfo) { | 259 Heap* heap, RelocInfo* rinfo) { |
260 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 260 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
261 ASSERT(!rinfo->target_object()->IsConsString()); | 261 ASSERT(!rinfo->target_object()->IsConsString()); |
262 HeapObject* object = HeapObject::cast(rinfo->target_object()); | 262 HeapObject* object = HeapObject::cast(rinfo->target_object()); |
263 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); | 263 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); |
| 264 // TODO(ulan): It could be better to record slots only for strongly embedded |
| 265 // objects here and record slots for weakly embedded object during clearing |
| 266 // of non-live references in mark-compact. |
264 if (!Code::IsWeakEmbeddedObject(rinfo->host()->kind(), object)) { | 267 if (!Code::IsWeakEmbeddedObject(rinfo->host()->kind(), object)) { |
265 StaticVisitor::MarkObject(heap, object); | 268 StaticVisitor::MarkObject(heap, object); |
266 } | 269 } |
267 } | 270 } |
268 | 271 |
269 | 272 |
270 template<typename StaticVisitor> | 273 template<typename StaticVisitor> |
271 void StaticMarkingVisitor<StaticVisitor>::VisitCell( | 274 void StaticMarkingVisitor<StaticVisitor>::VisitCell( |
272 Heap* heap, RelocInfo* rinfo) { | 275 Heap* heap, RelocInfo* rinfo) { |
273 ASSERT(rinfo->rmode() == RelocInfo::CELL); | 276 ASSERT(rinfo->rmode() == RelocInfo::CELL); |
274 Cell* cell = rinfo->target_cell(); | 277 Cell* cell = rinfo->target_cell(); |
275 StaticVisitor::MarkObject(heap, cell); | 278 // No need to record slots because the cell space is not compacted during GC. |
| 279 if (!Code::IsWeakEmbeddedObject(rinfo->host()->kind(), cell)) { |
| 280 StaticVisitor::MarkObject(heap, cell); |
| 281 } |
276 } | 282 } |
277 | 283 |
278 | 284 |
279 template<typename StaticVisitor> | 285 template<typename StaticVisitor> |
280 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget( | 286 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget( |
281 Heap* heap, RelocInfo* rinfo) { | 287 Heap* heap, RelocInfo* rinfo) { |
282 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 288 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
283 rinfo->IsPatchedReturnSequence()) || | 289 rinfo->IsPatchedReturnSequence()) || |
284 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 290 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
285 rinfo->IsPatchedDebugBreakSlotSequence())); | 291 rinfo->IsPatchedDebugBreakSlotSequence())); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 RelocIterator it(this, mode_mask); | 934 RelocIterator it(this, mode_mask); |
929 for (; !it.done(); it.next()) { | 935 for (; !it.done(); it.next()) { |
930 it.rinfo()->template Visit<StaticVisitor>(heap); | 936 it.rinfo()->template Visit<StaticVisitor>(heap); |
931 } | 937 } |
932 } | 938 } |
933 | 939 |
934 | 940 |
935 } } // namespace v8::internal | 941 } } // namespace v8::internal |
936 | 942 |
937 #endif // V8_OBJECTS_VISITING_INL_H_ | 943 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |