| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/heap/objects-visiting.h" | 7 #include "src/heap/objects-visiting.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // We don't record weak slots during marking or scavenges. Instead we do it | 179 // We don't record weak slots during marking or scavenges. Instead we do it |
| 180 // once when we complete mark-compact cycle. Note that write barrier has no | 180 // once when we complete mark-compact cycle. Note that write barrier has no |
| 181 // effect if we are already in the middle of compacting mark-sweep cycle and we | 181 // effect if we are already in the middle of compacting mark-sweep cycle and we |
| 182 // have to record slots manually. | 182 // have to record slots manually. |
| 183 static bool MustRecordSlots(Heap* heap) { | 183 static bool MustRecordSlots(Heap* heap) { |
| 184 return heap->gc_state() == Heap::MARK_COMPACT && | 184 return heap->gc_state() == Heap::MARK_COMPACT && |
| 185 heap->mark_compact_collector()->is_compacting(); | 185 heap->mark_compact_collector()->is_compacting(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| 189 #ifdef TRACE_RETAINING_PATH |
| 190 void SetCurrentRetainer(HeapObject* obj) { |
| 191 obj->GetHeap()->SetCurrentRetainer(obj); |
| 192 } |
| 193 |
| 194 |
| 195 void ResetCurrentRetainer(HeapObject* obj) { |
| 196 obj->GetHeap()->SetCurrentRetainer(NULL); |
| 197 } |
| 198 #endif |
| 199 |
| 189 template <class T> | 200 template <class T> |
| 190 struct WeakListVisitor; | 201 struct WeakListVisitor; |
| 191 | 202 |
| 192 | 203 |
| 193 template <class T> | 204 template <class T> |
| 194 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer) { | 205 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer) { |
| 195 Object* undefined = heap->undefined_value(); | 206 Object* undefined = heap->undefined_value(); |
| 196 Object* head = undefined; | 207 Object* head = undefined; |
| 197 T* tail = NULL; | 208 T* tail = NULL; |
| 198 MarkCompactCollector* collector = heap->mark_compact_collector(); | 209 MarkCompactCollector* collector = heap->mark_compact_collector(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 423 |
| 413 | 424 |
| 414 template Object* VisitWeakList<JSArrayBuffer>(Heap* heap, Object* list, | 425 template Object* VisitWeakList<JSArrayBuffer>(Heap* heap, Object* list, |
| 415 WeakObjectRetainer* retainer); | 426 WeakObjectRetainer* retainer); |
| 416 | 427 |
| 417 | 428 |
| 418 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, | 429 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, |
| 419 WeakObjectRetainer* retainer); | 430 WeakObjectRetainer* retainer); |
| 420 } | 431 } |
| 421 } // namespace v8::internal | 432 } // namespace v8::internal |
| OLD | NEW |