Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 compacting_(false), | 67 compacting_(false), |
| 68 was_marked_incrementally_(false), | 68 was_marked_incrementally_(false), |
| 69 sweeping_pending_(false), | 69 sweeping_pending_(false), |
| 70 pending_sweeper_jobs_semaphore_(0), | 70 pending_sweeper_jobs_semaphore_(0), |
| 71 sequential_sweeping_(false), | 71 sequential_sweeping_(false), |
| 72 tracer_(NULL), | 72 tracer_(NULL), |
| 73 migration_slots_buffer_(NULL), | 73 migration_slots_buffer_(NULL), |
| 74 heap_(heap), | 74 heap_(heap), |
| 75 code_flusher_(NULL), | 75 code_flusher_(NULL), |
| 76 encountered_weak_collections_(NULL), | 76 encountered_weak_collections_(NULL), |
| 77 have_code_to_deoptimize_(false) { } | 77 have_code_to_deoptimize_(false), |
| 78 evacuation_scope_(0) { } | |
| 78 | 79 |
| 79 #ifdef VERIFY_HEAP | 80 #ifdef VERIFY_HEAP |
| 80 class VerifyMarkingVisitor: public ObjectVisitor { | 81 class VerifyMarkingVisitor: public ObjectVisitor { |
| 81 public: | 82 public: |
| 82 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} | 83 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} |
| 83 | 84 |
| 84 void VisitPointers(Object** start, Object** end) { | 85 void VisitPointers(Object** start, Object** end) { |
| 85 for (Object** current = start; current < end; current++) { | 86 for (Object** current = start; current < end; current++) { |
| 86 if ((*current)->IsHeapObject()) { | 87 if ((*current)->IsHeapObject()) { |
| 87 HeapObject* object = HeapObject::cast(*current); | 88 HeapObject* object = HeapObject::cast(*current); |
| (...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2835 ASSERT(IsAligned(size, kPointerSize)); | 2836 ASSERT(IsAligned(size, kPointerSize)); |
| 2836 | 2837 |
| 2837 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2838 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
| 2838 Object* value = Memory::Object_at(src_slot); | 2839 Object* value = Memory::Object_at(src_slot); |
| 2839 | 2840 |
| 2840 Memory::Object_at(dst_slot) = value; | 2841 Memory::Object_at(dst_slot) = value; |
| 2841 | 2842 |
| 2842 if (heap_->InNewSpace(value)) { | 2843 if (heap_->InNewSpace(value)) { |
| 2843 heap_->store_buffer()->Mark(dst_slot); | 2844 heap_->store_buffer()->Mark(dst_slot); |
| 2844 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) { | 2845 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) { |
| 2845 SlotsBuffer::AddTo(&slots_buffer_allocator_, | 2846 SlotsBuffer::AddTo(heap_, |
| 2847 &slots_buffer_allocator_, | |
| 2846 &migration_slots_buffer_, | 2848 &migration_slots_buffer_, |
| 2847 reinterpret_cast<Object**>(dst_slot), | 2849 reinterpret_cast<Object**>(dst_slot), |
| 2848 SlotsBuffer::IGNORE_OVERFLOW); | 2850 SlotsBuffer::IGNORE_OVERFLOW); |
| 2849 } | 2851 } |
| 2850 | 2852 |
| 2851 src_slot += kPointerSize; | 2853 src_slot += kPointerSize; |
| 2852 dst_slot += kPointerSize; | 2854 dst_slot += kPointerSize; |
| 2853 } | 2855 } |
| 2854 | 2856 |
| 2855 if (compacting_ && HeapObject::FromAddress(dst)->IsJSFunction()) { | 2857 if (compacting_ && HeapObject::FromAddress(dst)->IsJSFunction()) { |
| 2856 Address code_entry_slot = dst + JSFunction::kCodeEntryOffset; | 2858 Address code_entry_slot = dst + JSFunction::kCodeEntryOffset; |
| 2857 Address code_entry = Memory::Address_at(code_entry_slot); | 2859 Address code_entry = Memory::Address_at(code_entry_slot); |
| 2858 | 2860 |
| 2859 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { | 2861 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { |
| 2860 SlotsBuffer::AddTo(&slots_buffer_allocator_, | 2862 SlotsBuffer::AddTo(heap_, |
| 2863 &slots_buffer_allocator_, | |
| 2861 &migration_slots_buffer_, | 2864 &migration_slots_buffer_, |
| 2862 SlotsBuffer::CODE_ENTRY_SLOT, | 2865 SlotsBuffer::CODE_ENTRY_SLOT, |
| 2863 code_entry_slot, | 2866 code_entry_slot, |
| 2864 SlotsBuffer::IGNORE_OVERFLOW); | 2867 SlotsBuffer::IGNORE_OVERFLOW); |
| 2865 } | 2868 } |
| 2866 } | 2869 } |
| 2867 } else if (dest == CODE_SPACE) { | 2870 } else if (dest == CODE_SPACE) { |
| 2868 PROFILE(isolate(), CodeMoveEvent(src, dst)); | 2871 PROFILE(isolate(), CodeMoveEvent(src, dst)); |
| 2869 heap()->MoveBlock(dst, src, size); | 2872 heap()->MoveBlock(dst, src, size); |
| 2870 SlotsBuffer::AddTo(&slots_buffer_allocator_, | 2873 SlotsBuffer::AddTo(heap_, |
| 2874 &slots_buffer_allocator_, | |
| 2871 &migration_slots_buffer_, | 2875 &migration_slots_buffer_, |
| 2872 SlotsBuffer::RELOCATED_CODE_OBJECT, | 2876 SlotsBuffer::RELOCATED_CODE_OBJECT, |
| 2873 dst, | 2877 dst, |
| 2874 SlotsBuffer::IGNORE_OVERFLOW); | 2878 SlotsBuffer::IGNORE_OVERFLOW); |
| 2875 Code::cast(HeapObject::FromAddress(dst))->Relocate(dst - src); | 2879 Code::cast(HeapObject::FromAddress(dst))->Relocate(dst - src); |
| 2876 } else { | 2880 } else { |
| 2877 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE); | 2881 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE); |
| 2878 heap()->MoveBlock(dst, src, size); | 2882 heap()->MoveBlock(dst, src, size); |
| 2879 } | 2883 } |
| 2880 Memory::Address_at(src) = dst; | 2884 Memory::Address_at(src) = dst; |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3467 GCTracer::Scope::MC_UPDATE_OLD_TO_NEW_POINTERS); | 3471 GCTracer::Scope::MC_UPDATE_OLD_TO_NEW_POINTERS); |
| 3468 StoreBufferRebuildScope scope(heap_, | 3472 StoreBufferRebuildScope scope(heap_, |
| 3469 heap_->store_buffer(), | 3473 heap_->store_buffer(), |
| 3470 &Heap::ScavengeStoreBufferCallback); | 3474 &Heap::ScavengeStoreBufferCallback); |
| 3471 heap_->store_buffer()->IteratePointersToNewSpaceAndClearMaps( | 3475 heap_->store_buffer()->IteratePointersToNewSpaceAndClearMaps( |
| 3472 &UpdatePointer); | 3476 &UpdatePointer); |
| 3473 } | 3477 } |
| 3474 | 3478 |
| 3475 { GCTracer::Scope gc_scope(tracer_, | 3479 { GCTracer::Scope gc_scope(tracer_, |
| 3476 GCTracer::Scope::MC_UPDATE_POINTERS_TO_EVACUATED); | 3480 GCTracer::Scope::MC_UPDATE_POINTERS_TO_EVACUATED); |
| 3477 SlotsBuffer::UpdateSlotsRecordedIn(heap_, | 3481 migration_slots_buffer_->UpdateSlotsRecordedIn( |
| 3478 migration_slots_buffer_, | 3482 code_slots_filtering_required); |
| 3479 code_slots_filtering_required); | |
| 3480 if (FLAG_trace_fragmentation) { | 3483 if (FLAG_trace_fragmentation) { |
| 3481 PrintF(" migration slots buffer: %d\n", | 3484 PrintF(" migration slots buffer: %d\n", |
| 3482 SlotsBuffer::SizeOfChain(migration_slots_buffer_)); | 3485 SlotsBuffer::SizeOfChain(migration_slots_buffer_)); |
| 3483 } | 3486 } |
| 3484 | 3487 |
| 3485 if (compacting_ && was_marked_incrementally_) { | 3488 if (compacting_ && was_marked_incrementally_) { |
| 3486 // It's difficult to filter out slots recorded for large objects. | 3489 // It's difficult to filter out slots recorded for large objects. |
| 3487 LargeObjectIterator it(heap_->lo_space()); | 3490 LargeObjectIterator it(heap_->lo_space()); |
| 3488 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 3491 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
| 3489 // LargeObjectSpace is not swept yet thus we have to skip | 3492 // LargeObjectSpace is not swept yet thus we have to skip |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 3501 | 3504 |
| 3502 int npages = evacuation_candidates_.length(); | 3505 int npages = evacuation_candidates_.length(); |
| 3503 { GCTracer::Scope gc_scope( | 3506 { GCTracer::Scope gc_scope( |
| 3504 tracer_, GCTracer::Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED); | 3507 tracer_, GCTracer::Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED); |
| 3505 for (int i = 0; i < npages; i++) { | 3508 for (int i = 0; i < npages; i++) { |
| 3506 Page* p = evacuation_candidates_[i]; | 3509 Page* p = evacuation_candidates_[i]; |
| 3507 ASSERT(p->IsEvacuationCandidate() || | 3510 ASSERT(p->IsEvacuationCandidate() || |
| 3508 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); | 3511 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); |
| 3509 | 3512 |
| 3510 if (p->IsEvacuationCandidate()) { | 3513 if (p->IsEvacuationCandidate()) { |
| 3511 SlotsBuffer::UpdateSlotsRecordedIn(heap_, | 3514 p->slots_buffer()->UpdateSlotsRecordedIn(code_slots_filtering_required); |
| 3512 p->slots_buffer(), | |
| 3513 code_slots_filtering_required); | |
| 3514 if (FLAG_trace_fragmentation) { | 3515 if (FLAG_trace_fragmentation) { |
| 3515 PrintF(" page %p slots buffer: %d\n", | 3516 PrintF(" page %p slots buffer: %d\n", |
| 3516 reinterpret_cast<void*>(p), | 3517 reinterpret_cast<void*>(p), |
| 3517 SlotsBuffer::SizeOfChain(p->slots_buffer())); | 3518 SlotsBuffer::SizeOfChain(p->slots_buffer())); |
| 3518 } | 3519 } |
| 3519 | 3520 |
| 3520 // Important: skip list should be cleared only after roots were updated | 3521 // Important: skip list should be cleared only after roots were updated |
| 3521 // because root iteration traverses the stack and might have to find | 3522 // because root iteration traverses the stack and might have to find |
| 3522 // code objects from non-updated pc pointing into evacuation candidate. | 3523 // code objects from non-updated pc pointing into evacuation candidate. |
| 3523 SkipList* list = p->skip_list(); | 3524 SkipList* list = p->skip_list(); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4207 state_ = SWEEP_SPACES; | 4208 state_ = SWEEP_SPACES; |
| 4208 #endif | 4209 #endif |
| 4209 SweeperType how_to_sweep = | 4210 SweeperType how_to_sweep = |
| 4210 FLAG_lazy_sweeping ? LAZY_CONSERVATIVE : CONSERVATIVE; | 4211 FLAG_lazy_sweeping ? LAZY_CONSERVATIVE : CONSERVATIVE; |
| 4211 if (AreSweeperThreadsActivated()) { | 4212 if (AreSweeperThreadsActivated()) { |
| 4212 if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE; | 4213 if (FLAG_parallel_sweeping) how_to_sweep = PARALLEL_CONSERVATIVE; |
| 4213 if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE; | 4214 if (FLAG_concurrent_sweeping) how_to_sweep = CONCURRENT_CONSERVATIVE; |
| 4214 } | 4215 } |
| 4215 if (sweep_precisely_) how_to_sweep = PRECISE; | 4216 if (sweep_precisely_) how_to_sweep = PRECISE; |
| 4216 | 4217 |
| 4218 EvacuationScope no_evacuation(this); | |
|
Michael Starzinger
2014/03/06 10:47:25
nit: The naming of this scope (the local variable,
| |
| 4217 // Unlink evacuation candidates before sweeper threads access the list of | 4219 // Unlink evacuation candidates before sweeper threads access the list of |
| 4218 // pages to avoid race condition. | 4220 // pages to avoid race condition. |
| 4219 UnlinkEvacuationCandidates(); | 4221 UnlinkEvacuationCandidates(); |
| 4220 | 4222 |
| 4221 // Noncompacting collections simply sweep the spaces to clear the mark | 4223 // Noncompacting collections simply sweep the spaces to clear the mark |
| 4222 // bits and free the nonlive blocks (for old and map spaces). We sweep | 4224 // bits and free the nonlive blocks (for old and map spaces). We sweep |
| 4223 // the map space last because freeing non-live maps overwrites them and | 4225 // the map space last because freeing non-live maps overwrites them and |
| 4224 // the other spaces rely on possibly non-live maps to get the sizes for | 4226 // the other spaces rely on possibly non-live maps to get the sizes for |
| 4225 // non-live objects. | 4227 // non-live objects. |
| 4226 SequentialSweepingScope scope(this); | 4228 SequentialSweepingScope scope(this); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4325 MarkCompactMarkingVisitor::Initialize(); | 4327 MarkCompactMarkingVisitor::Initialize(); |
| 4326 IncrementalMarking::Initialize(); | 4328 IncrementalMarking::Initialize(); |
| 4327 } | 4329 } |
| 4328 | 4330 |
| 4329 | 4331 |
| 4330 bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) { | 4332 bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) { |
| 4331 return reinterpret_cast<uintptr_t>(slot) < NUMBER_OF_SLOT_TYPES; | 4333 return reinterpret_cast<uintptr_t>(slot) < NUMBER_OF_SLOT_TYPES; |
| 4332 } | 4334 } |
| 4333 | 4335 |
| 4334 | 4336 |
| 4335 bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator, | |
| 4336 SlotsBuffer** buffer_address, | |
| 4337 SlotType type, | |
| 4338 Address addr, | |
| 4339 AdditionMode mode) { | |
| 4340 SlotsBuffer* buffer = *buffer_address; | |
| 4341 if (buffer == NULL || !buffer->HasSpaceForTypedSlot()) { | |
| 4342 if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) { | |
| 4343 allocator->DeallocateChain(buffer_address); | |
| 4344 return false; | |
| 4345 } | |
| 4346 buffer = allocator->AllocateBuffer(buffer); | |
| 4347 *buffer_address = buffer; | |
| 4348 } | |
| 4349 ASSERT(buffer->HasSpaceForTypedSlot()); | |
| 4350 buffer->Add(reinterpret_cast<ObjectSlot>(type)); | |
| 4351 buffer->Add(reinterpret_cast<ObjectSlot>(addr)); | |
| 4352 return true; | |
| 4353 } | |
| 4354 | |
| 4355 | |
| 4356 static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { | 4337 static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { |
| 4357 if (RelocInfo::IsCodeTarget(rmode)) { | 4338 if (RelocInfo::IsCodeTarget(rmode)) { |
| 4358 return SlotsBuffer::CODE_TARGET_SLOT; | 4339 return SlotsBuffer::CODE_TARGET_SLOT; |
| 4359 } else if (RelocInfo::IsEmbeddedObject(rmode)) { | 4340 } else if (RelocInfo::IsEmbeddedObject(rmode)) { |
| 4360 return SlotsBuffer::EMBEDDED_OBJECT_SLOT; | 4341 return SlotsBuffer::EMBEDDED_OBJECT_SLOT; |
| 4361 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { | 4342 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { |
| 4362 return SlotsBuffer::DEBUG_TARGET_SLOT; | 4343 return SlotsBuffer::DEBUG_TARGET_SLOT; |
| 4363 } else if (RelocInfo::IsJSReturn(rmode)) { | 4344 } else if (RelocInfo::IsJSReturn(rmode)) { |
| 4364 return SlotsBuffer::JS_RETURN_SLOT; | 4345 return SlotsBuffer::JS_RETURN_SLOT; |
| 4365 } | 4346 } |
| 4366 UNREACHABLE(); | 4347 UNREACHABLE(); |
| 4367 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; | 4348 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; |
| 4368 } | 4349 } |
| 4369 | 4350 |
| 4370 | 4351 |
| 4371 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { | 4352 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { |
| 4372 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 4353 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
| 4373 if (target_page->IsEvacuationCandidate() && | 4354 if (target_page->IsEvacuationCandidate() && |
| 4374 (rinfo->host() == NULL || | 4355 (rinfo->host() == NULL || |
| 4375 !ShouldSkipEvacuationSlotRecording(rinfo->host()))) { | 4356 !ShouldSkipEvacuationSlotRecording(rinfo->host()))) { |
| 4376 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 4357 if (!SlotsBuffer::AddTo(heap_, |
| 4358 &slots_buffer_allocator_, | |
| 4377 target_page->slots_buffer_address(), | 4359 target_page->slots_buffer_address(), |
| 4378 SlotTypeForRMode(rinfo->rmode()), | 4360 SlotTypeForRMode(rinfo->rmode()), |
| 4379 rinfo->pc(), | 4361 rinfo->pc(), |
| 4380 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 4362 SlotsBuffer::FAIL_ON_OVERFLOW)) { |
| 4381 EvictEvacuationCandidate(target_page); | 4363 EvictEvacuationCandidate(target_page); |
| 4382 } | 4364 } |
| 4383 } | 4365 } |
| 4384 } | 4366 } |
| 4385 | 4367 |
| 4386 | 4368 |
| 4387 void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) { | 4369 void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) { |
| 4388 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 4370 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
| 4389 if (target_page->IsEvacuationCandidate() && | 4371 if (target_page->IsEvacuationCandidate() && |
| 4390 !ShouldSkipEvacuationSlotRecording(reinterpret_cast<Object**>(slot))) { | 4372 !ShouldSkipEvacuationSlotRecording(reinterpret_cast<Object**>(slot))) { |
| 4391 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 4373 if (!SlotsBuffer::AddTo(heap_, |
| 4374 &slots_buffer_allocator_, | |
| 4392 target_page->slots_buffer_address(), | 4375 target_page->slots_buffer_address(), |
| 4393 SlotsBuffer::CODE_ENTRY_SLOT, | 4376 SlotsBuffer::CODE_ENTRY_SLOT, |
| 4394 slot, | 4377 slot, |
| 4395 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 4378 SlotsBuffer::FAIL_ON_OVERFLOW)) { |
| 4396 EvictEvacuationCandidate(target_page); | 4379 EvictEvacuationCandidate(target_page); |
| 4397 } | 4380 } |
| 4398 } | 4381 } |
| 4399 } | 4382 } |
| 4400 | 4383 |
| 4401 | 4384 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 4412 } | 4395 } |
| 4413 } | 4396 } |
| 4414 | 4397 |
| 4415 | 4398 |
| 4416 static inline SlotsBuffer::SlotType DecodeSlotType( | 4399 static inline SlotsBuffer::SlotType DecodeSlotType( |
| 4417 SlotsBuffer::ObjectSlot slot) { | 4400 SlotsBuffer::ObjectSlot slot) { |
| 4418 return static_cast<SlotsBuffer::SlotType>(reinterpret_cast<intptr_t>(slot)); | 4401 return static_cast<SlotsBuffer::SlotType>(reinterpret_cast<intptr_t>(slot)); |
| 4419 } | 4402 } |
| 4420 | 4403 |
| 4421 | 4404 |
| 4422 void SlotsBuffer::UpdateSlots(Heap* heap) { | 4405 void SlotsBuffer::UpdateSlots() { |
| 4423 PointersUpdatingVisitor v(heap); | 4406 PointersUpdatingVisitor v(heap_); |
| 4424 | 4407 |
| 4425 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { | 4408 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { |
| 4426 ObjectSlot slot = slots_[slot_idx]; | 4409 ObjectSlot slot = slots_[slot_idx]; |
| 4427 if (!IsTypedSlot(slot)) { | 4410 if (!IsTypedSlot(slot)) { |
| 4428 PointersUpdatingVisitor::UpdateSlot(heap, slot); | 4411 PointersUpdatingVisitor::UpdateSlot(heap_, slot); |
| 4429 } else { | 4412 } else { |
| 4430 ++slot_idx; | 4413 ++slot_idx; |
| 4431 ASSERT(slot_idx < idx_); | 4414 ASSERT(slot_idx < idx_); |
| 4432 UpdateSlot(heap->isolate(), | 4415 UpdateSlot(heap_->isolate(), |
| 4433 &v, | 4416 &v, |
| 4434 DecodeSlotType(slot), | 4417 DecodeSlotType(slot), |
| 4435 reinterpret_cast<Address>(slots_[slot_idx])); | 4418 reinterpret_cast<Address>(slots_[slot_idx])); |
| 4436 } | 4419 } |
| 4437 } | 4420 } |
| 4438 } | 4421 } |
| 4439 | 4422 |
| 4440 | 4423 |
| 4441 void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) { | 4424 void SlotsBuffer::UpdateSlotsWithFilter() { |
| 4442 PointersUpdatingVisitor v(heap); | 4425 PointersUpdatingVisitor v(heap_); |
| 4443 | 4426 |
| 4444 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { | 4427 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { |
| 4445 ObjectSlot slot = slots_[slot_idx]; | 4428 ObjectSlot slot = slots_[slot_idx]; |
| 4446 if (!IsTypedSlot(slot)) { | 4429 if (!IsTypedSlot(slot)) { |
| 4447 if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) { | 4430 if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) { |
| 4448 PointersUpdatingVisitor::UpdateSlot(heap, slot); | 4431 PointersUpdatingVisitor::UpdateSlot(heap_, slot); |
| 4449 } | 4432 } |
| 4450 } else { | 4433 } else { |
| 4451 ++slot_idx; | 4434 ++slot_idx; |
| 4452 ASSERT(slot_idx < idx_); | 4435 ASSERT(slot_idx < idx_); |
| 4453 Address pc = reinterpret_cast<Address>(slots_[slot_idx]); | 4436 Address pc = reinterpret_cast<Address>(slots_[slot_idx]); |
| 4454 if (!IsOnInvalidatedCodeObject(pc)) { | 4437 if (!IsOnInvalidatedCodeObject(pc)) { |
| 4455 UpdateSlot(heap->isolate(), | 4438 UpdateSlot(heap_->isolate(), |
| 4456 &v, | 4439 &v, |
| 4457 DecodeSlotType(slot), | 4440 DecodeSlotType(slot), |
| 4458 reinterpret_cast<Address>(slots_[slot_idx])); | 4441 reinterpret_cast<Address>(slots_[slot_idx])); |
| 4459 } | 4442 } |
| 4460 } | 4443 } |
| 4461 } | 4444 } |
| 4462 } | 4445 } |
| 4463 | 4446 |
| 4464 | 4447 |
| 4465 SlotsBuffer* SlotsBufferAllocator::AllocateBuffer(SlotsBuffer* next_buffer) { | 4448 SlotsBuffer* SlotsBufferAllocator::AllocateBuffer(Heap* heap, |
| 4466 return new SlotsBuffer(next_buffer); | 4449 SlotsBuffer* next_buffer) { |
| 4450 return new SlotsBuffer(heap, next_buffer); | |
| 4467 } | 4451 } |
| 4468 | 4452 |
| 4469 | 4453 |
| 4470 void SlotsBufferAllocator::DeallocateBuffer(SlotsBuffer* buffer) { | 4454 void SlotsBufferAllocator::DeallocateBuffer(SlotsBuffer* buffer) { |
| 4471 delete buffer; | 4455 delete buffer; |
| 4472 } | 4456 } |
| 4473 | 4457 |
| 4474 | 4458 |
| 4475 void SlotsBufferAllocator::DeallocateChain(SlotsBuffer** buffer_address) { | 4459 void SlotsBufferAllocator::DeallocateChain(SlotsBuffer** buffer_address) { |
| 4476 SlotsBuffer* buffer = *buffer_address; | 4460 SlotsBuffer* buffer = *buffer_address; |
| 4477 while (buffer != NULL) { | 4461 while (buffer != NULL) { |
| 4478 SlotsBuffer* next_buffer = buffer->next(); | 4462 SlotsBuffer* next_buffer = buffer->next(); |
| 4479 DeallocateBuffer(buffer); | 4463 DeallocateBuffer(buffer); |
| 4480 buffer = next_buffer; | 4464 buffer = next_buffer; |
| 4481 } | 4465 } |
| 4482 *buffer_address = NULL; | 4466 *buffer_address = NULL; |
| 4483 } | 4467 } |
| 4484 | 4468 |
| 4485 | 4469 |
| 4486 } } // namespace v8::internal | 4470 } } // namespace v8::internal |
| OLD | NEW |