| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget( | 305 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget( |
| 306 Heap* heap, RelocInfo* rinfo) { | 306 Heap* heap, RelocInfo* rinfo) { |
| 307 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 307 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 308 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 308 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 309 // Monomorphic ICs are preserved when possible, but need to be flushed | 309 // Monomorphic ICs are preserved when possible, but need to be flushed |
| 310 // when they might be keeping a Context alive, or when the heap is about | 310 // when they might be keeping a Context alive, or when the heap is about |
| 311 // to be serialized. | 311 // to be serialized. |
| 312 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() | 312 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() |
| 313 && (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC || | 313 && (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC || |
| 314 target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() || | 314 target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() || |
| 315 Serializer::enabled() || target->ic_age() != heap->global_ic_age())) { | 315 Serializer::enabled() || target->ic_age() != heap->global_ic_age() || |
| 316 target->is_invalidated_weak_stub())) { |
| 316 IC::Clear(target->GetIsolate(), rinfo->pc(), | 317 IC::Clear(target->GetIsolate(), rinfo->pc(), |
| 317 rinfo->host()->constant_pool()); | 318 rinfo->host()->constant_pool()); |
| 318 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 319 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 319 } | 320 } |
| 320 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 321 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 321 StaticVisitor::MarkObject(heap, target); | 322 StaticVisitor::MarkObject(heap, target); |
| 322 } | 323 } |
| 323 | 324 |
| 324 | 325 |
| 325 template<typename StaticVisitor> | 326 template<typename StaticVisitor> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 int index = constant_pool->first_code_ptr_index() + i; | 495 int index = constant_pool->first_code_ptr_index() + i; |
| 495 Address code_entry = | 496 Address code_entry = |
| 496 reinterpret_cast<Address>(constant_pool->RawFieldOfElementAt(index)); | 497 reinterpret_cast<Address>(constant_pool->RawFieldOfElementAt(index)); |
| 497 StaticVisitor::VisitCodeEntry(heap, code_entry); | 498 StaticVisitor::VisitCodeEntry(heap, code_entry); |
| 498 } | 499 } |
| 499 for (int i = 0; i < constant_pool->count_of_heap_ptr_entries(); i++) { | 500 for (int i = 0; i < constant_pool->count_of_heap_ptr_entries(); i++) { |
| 500 int index = constant_pool->first_heap_ptr_index() + i; | 501 int index = constant_pool->first_heap_ptr_index() + i; |
| 501 Object** slot = constant_pool->RawFieldOfElementAt(index); | 502 Object** slot = constant_pool->RawFieldOfElementAt(index); |
| 502 HeapObject* object = HeapObject::cast(*slot); | 503 HeapObject* object = HeapObject::cast(*slot); |
| 503 heap->mark_compact_collector()->RecordSlot(slot, slot, object); | 504 heap->mark_compact_collector()->RecordSlot(slot, slot, object); |
| 504 if (!(constant_pool->get_weak_object_state() == | 505 bool is_weak_object = |
| 506 (constant_pool->get_weak_object_state() == |
| 505 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && | 507 ConstantPoolArray::WEAK_OBJECTS_IN_OPTIMIZED_CODE && |
| 506 Code::IsWeakObjectInOptimizedCode(object))) { | 508 Code::IsWeakObjectInOptimizedCode(object)) || |
| 509 (constant_pool->get_weak_object_state() == |
| 510 ConstantPoolArray::WEAK_OBJECTS_IN_IC && |
| 511 Code::IsWeakObjectInIC(object)); |
| 512 if (!is_weak_object) { |
| 507 StaticVisitor::MarkObject(heap, object); | 513 StaticVisitor::MarkObject(heap, object); |
| 508 } | 514 } |
| 509 } | 515 } |
| 510 } | 516 } |
| 511 | 517 |
| 512 | 518 |
| 513 template<typename StaticVisitor> | 519 template<typename StaticVisitor> |
| 514 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction( | 520 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction( |
| 515 Map* map, HeapObject* object) { | 521 Map* map, HeapObject* object) { |
| 516 Heap* heap = map->GetHeap(); | 522 Heap* heap = map->GetHeap(); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 RelocIterator it(this, mode_mask); | 954 RelocIterator it(this, mode_mask); |
| 949 for (; !it.done(); it.next()) { | 955 for (; !it.done(); it.next()) { |
| 950 it.rinfo()->template Visit<StaticVisitor>(heap); | 956 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 951 } | 957 } |
| 952 } | 958 } |
| 953 | 959 |
| 954 | 960 |
| 955 } } // namespace v8::internal | 961 } } // namespace v8::internal |
| 956 | 962 |
| 957 #endif // V8_OBJECTS_VISITING_INL_H_ | 963 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |