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 #include "src/heap/array-buffer-tracker.h" | 8 #include "src/heap/array-buffer-tracker.h" |
9 #include "src/heap/mark-compact.h" | 9 #include "src/heap/mark-compact.h" |
10 #include "src/heap/objects-visiting.h" | 10 #include "src/heap/objects-visiting.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( | 288 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( |
289 Map* map, HeapObject* object) { | 289 Map* map, HeapObject* object) { |
290 FixedBodyVisitor<StaticVisitor, BytecodeArray::MarkingBodyDescriptor, | 290 FixedBodyVisitor<StaticVisitor, BytecodeArray::MarkingBodyDescriptor, |
291 void>::Visit(map, object); | 291 void>::Visit(map, object); |
292 BytecodeArray::cast(object)->MakeOlder(); | 292 BytecodeArray::cast(object)->MakeOlder(); |
293 } | 293 } |
294 | 294 |
295 template <typename StaticVisitor> | 295 template <typename StaticVisitor> |
296 void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( | 296 void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext( |
297 Map* map, HeapObject* object) { | 297 Map* map, HeapObject* object) { |
| 298 // GC can happen when the context is not fully initialized, |
| 299 // so the cache can be undefined. |
| 300 Object* cache = |
| 301 Context::cast(object)->get(Context::NORMALIZED_MAP_CACHE_INDEX); |
| 302 if (cache->IsNormalizedMapCache()) { |
| 303 NormalizedMapCache::cast(cache)->Clear(); |
| 304 } |
298 FixedBodyVisitor<StaticVisitor, Context::MarkCompactBodyDescriptor, | 305 FixedBodyVisitor<StaticVisitor, Context::MarkCompactBodyDescriptor, |
299 void>::Visit(map, object); | 306 void>::Visit(map, object); |
300 } | 307 } |
301 | 308 |
302 | 309 |
303 template <typename StaticVisitor> | 310 template <typename StaticVisitor> |
304 void StaticMarkingVisitor<StaticVisitor>::VisitMap(Map* map, | 311 void StaticMarkingVisitor<StaticVisitor>::VisitMap(Map* map, |
305 HeapObject* object) { | 312 HeapObject* object) { |
306 Heap* heap = map->GetHeap(); | 313 Heap* heap = map->GetHeap(); |
307 Map* map_object = Map::cast(object); | 314 Map* map_object = Map::cast(object); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 646 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
640 void> JSFunctionWeakCodeBodyVisitor; | 647 void> JSFunctionWeakCodeBodyVisitor; |
641 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 648 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
642 } | 649 } |
643 | 650 |
644 | 651 |
645 } // namespace internal | 652 } // namespace internal |
646 } // namespace v8 | 653 } // namespace v8 |
647 | 654 |
648 #endif // V8_OBJECTS_VISITING_INL_H_ | 655 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |