| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 rinfo->IsPatchedReturnSequence()) || | 202 rinfo->IsPatchedReturnSequence()) || |
| 203 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 203 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
| 204 rinfo->IsPatchedDebugBreakSlotSequence())); | 204 rinfo->IsPatchedDebugBreakSlotSequence())); |
| 205 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 205 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
| 206 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 206 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 207 StaticVisitor::MarkObject(heap, target); | 207 StaticVisitor::MarkObject(heap, target); |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 template<typename StaticVisitor> | 211 template<typename StaticVisitor> |
| 212 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget( |
| 213 Heap* heap, RelocInfo* rinfo) { |
| 214 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 215 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 216 // Monomorphic ICs are preserved when possible, but need to be flushed |
| 217 // when they might be keeping a Context alive, or when the heap is about |
| 218 // to be serialized. |
| 219 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub() |
| 220 && (target->ic_state() == MEGAMORPHIC || Serializer::enabled() || |
| 221 heap->isolate()->context_exit_happened() || |
| 222 target->ic_age() != heap->global_ic_age())) { |
| 223 IC::Clear(rinfo->pc()); |
| 224 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 225 } |
| 226 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 227 StaticVisitor::MarkObject(heap, target); |
| 228 } |
| 229 |
| 230 |
| 231 template<typename StaticVisitor> |
| 212 void StaticMarkingVisitor<StaticVisitor>::VisitGlobalContext( | 232 void StaticMarkingVisitor<StaticVisitor>::VisitGlobalContext( |
| 213 Map* map, HeapObject* object) { | 233 Map* map, HeapObject* object) { |
| 214 FixedBodyVisitor<StaticVisitor, | 234 FixedBodyVisitor<StaticVisitor, |
| 215 Context::MarkCompactBodyDescriptor, | 235 Context::MarkCompactBodyDescriptor, |
| 216 void>::Visit(map, object); | 236 void>::Visit(map, object); |
| 217 | 237 |
| 218 MarkCompactCollector* collector = map->GetHeap()->mark_compact_collector(); | 238 MarkCompactCollector* collector = map->GetHeap()->mark_compact_collector(); |
| 219 for (int idx = Context::FIRST_WEAK_SLOT; | 239 for (int idx = Context::FIRST_WEAK_SLOT; |
| 220 idx < Context::GLOBAL_CONTEXT_SLOTS; | 240 idx < Context::GLOBAL_CONTEXT_SLOTS; |
| 221 ++idx) { | 241 ++idx) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 RelocIterator it(this, mode_mask); | 320 RelocIterator it(this, mode_mask); |
| 301 for (; !it.done(); it.next()) { | 321 for (; !it.done(); it.next()) { |
| 302 it.rinfo()->template Visit<StaticVisitor>(heap); | 322 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 303 } | 323 } |
| 304 } | 324 } |
| 305 | 325 |
| 306 | 326 |
| 307 } } // namespace v8::internal | 327 } } // namespace v8::internal |
| 308 | 328 |
| 309 #endif // V8_OBJECTS_VISITING_INL_H_ | 329 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |