OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_OBJECTS_VISITING_INL_H_ | 5 #ifndef V8_OBJECTS_VISITING_INL_H_ |
6 #define V8_OBJECTS_VISITING_INL_H_ | 6 #define V8_OBJECTS_VISITING_INL_H_ |
7 | 7 |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 table_.Register(kVisitJSDataView, &VisitJSDataView); | 184 table_.Register(kVisitJSDataView, &VisitJSDataView); |
185 | 185 |
186 // Registration for kVisitJSRegExp is done by StaticVisitor. | 186 // Registration for kVisitJSRegExp is done by StaticVisitor. |
187 | 187 |
188 table_.Register( | 188 table_.Register( |
189 kVisitCell, | 189 kVisitCell, |
190 &FixedBodyVisitor<StaticVisitor, Cell::BodyDescriptor, void>::Visit); | 190 &FixedBodyVisitor<StaticVisitor, Cell::BodyDescriptor, void>::Visit); |
191 | 191 |
192 table_.Register(kVisitPropertyCell, &VisitPropertyCell); | 192 table_.Register(kVisitPropertyCell, &VisitPropertyCell); |
193 | 193 |
194 table_.Register(kVisitWeakCell, &VisitWeakCell); | |
195 | |
194 table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, | 196 table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, |
195 kVisitDataObjectGeneric>(); | 197 kVisitDataObjectGeneric>(); |
196 | 198 |
197 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, | 199 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, |
198 kVisitJSObjectGeneric>(); | 200 kVisitJSObjectGeneric>(); |
199 | 201 |
200 table_.template RegisterSpecializations<StructObjectVisitor, kVisitStruct, | 202 table_.template RegisterSpecializations<StructObjectVisitor, kVisitStruct, |
201 kVisitStructGeneric>(); | 203 kVisitStructGeneric>(); |
202 } | 204 } |
203 | 205 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 } | 345 } |
344 | 346 |
345 StaticVisitor::VisitPointers( | 347 StaticVisitor::VisitPointers( |
346 heap, | 348 heap, |
347 HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset), | 349 HeapObject::RawField(object, PropertyCell::kPointerFieldsBeginOffset), |
348 HeapObject::RawField(object, PropertyCell::kPointerFieldsEndOffset)); | 350 HeapObject::RawField(object, PropertyCell::kPointerFieldsEndOffset)); |
349 } | 351 } |
350 | 352 |
351 | 353 |
352 template <typename StaticVisitor> | 354 template <typename StaticVisitor> |
355 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, | |
356 HeapObject* object) { | |
357 Heap* heap = map->GetHeap(); | |
358 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); | |
359 // Enqueue weak cell in linked list of encountered weak collections. | |
360 if (weak_cell->next() == heap->undefined_value()) { | |
Erik Corry
2014/10/14 13:37:22
I think this should set to smi zero.
Since there'
ulan
2014/10/14 14:05:41
Good idea about skipping cleared weak cells. Added
| |
361 weak_cell->set_next(heap->encountered_weak_cells()); | |
362 heap->set_encountered_weak_cells(weak_cell); | |
363 } | |
364 } | |
365 | |
366 | |
367 template <typename StaticVisitor> | |
353 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( | 368 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( |
354 Map* map, HeapObject* object) { | 369 Map* map, HeapObject* object) { |
355 Heap* heap = map->GetHeap(); | 370 Heap* heap = map->GetHeap(); |
356 | 371 |
357 Object** slot = | 372 Object** slot = |
358 HeapObject::RawField(object, AllocationSite::kDependentCodeOffset); | 373 HeapObject::RawField(object, AllocationSite::kDependentCodeOffset); |
359 if (FLAG_collect_maps) { | 374 if (FLAG_collect_maps) { |
360 // Mark allocation site dependent codes array but do not push it onto | 375 // Mark allocation site dependent codes array but do not push it onto |
361 // marking stack, this will make references from it weak. We will clean | 376 // marking stack, this will make references from it weak. We will clean |
362 // dead codes when we iterate over allocation sites in | 377 // dead codes when we iterate over allocation sites in |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
925 | 940 |
926 RelocIterator it(this, mode_mask); | 941 RelocIterator it(this, mode_mask); |
927 for (; !it.done(); it.next()) { | 942 for (; !it.done(); it.next()) { |
928 it.rinfo()->template Visit<StaticVisitor>(heap); | 943 it.rinfo()->template Visit<StaticVisitor>(heap); |
929 } | 944 } |
930 } | 945 } |
931 } | 946 } |
932 } // namespace v8::internal | 947 } // namespace v8::internal |
933 | 948 |
934 #endif // V8_OBJECTS_VISITING_INL_H_ | 949 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |