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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); | 2862 DCHECK(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); |
2863 Object* stub = rinfo->code_age_stub(); | 2863 Object* stub = rinfo->code_age_stub(); |
2864 DCHECK(stub != NULL); | 2864 DCHECK(stub != NULL); |
2865 VisitPointer(&stub); | 2865 VisitPointer(&stub); |
2866 if (stub != rinfo->code_age_stub()) { | 2866 if (stub != rinfo->code_age_stub()) { |
2867 rinfo->set_code_age_stub(Code::cast(stub)); | 2867 rinfo->set_code_age_stub(Code::cast(stub)); |
2868 } | 2868 } |
2869 } | 2869 } |
2870 | 2870 |
2871 void VisitDebugTarget(RelocInfo* rinfo) { | 2871 void VisitDebugTarget(RelocInfo* rinfo) { |
2872 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && | 2872 DCHECK(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
2873 rinfo->IsPatchedReturnSequence()) || | 2873 rinfo->IsPatchedDebugBreakSlotSequence()); |
2874 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 2874 Object* target = |
2875 rinfo->IsPatchedDebugBreakSlotSequence())); | 2875 Code::GetCodeFromTargetAddress(rinfo->debug_call_address()); |
2876 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | |
2877 VisitPointer(&target); | 2876 VisitPointer(&target); |
2878 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2877 rinfo->set_debug_call_address(Code::cast(target)->instruction_start()); |
2879 } | 2878 } |
2880 | 2879 |
2881 static inline void UpdateSlot(Heap* heap, Object** slot) { | 2880 static inline void UpdateSlot(Heap* heap, Object** slot) { |
2882 Object* obj = reinterpret_cast<Object*>( | 2881 Object* obj = reinterpret_cast<Object*>( |
2883 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | 2882 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
2884 | 2883 |
2885 if (!obj->IsHeapObject()) return; | 2884 if (!obj->IsHeapObject()) return; |
2886 | 2885 |
2887 HeapObject* heap_obj = HeapObject::cast(obj); | 2886 HeapObject* heap_obj = HeapObject::cast(obj); |
2888 | 2887 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 case SlotsBuffer::RELOCATED_CODE_OBJECT: { | 3427 case SlotsBuffer::RELOCATED_CODE_OBJECT: { |
3429 HeapObject* obj = HeapObject::FromAddress(addr); | 3428 HeapObject* obj = HeapObject::FromAddress(addr); |
3430 Code::cast(obj)->CodeIterateBody(v); | 3429 Code::cast(obj)->CodeIterateBody(v); |
3431 break; | 3430 break; |
3432 } | 3431 } |
3433 case SlotsBuffer::DEBUG_TARGET_SLOT: { | 3432 case SlotsBuffer::DEBUG_TARGET_SLOT: { |
3434 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION, 0, NULL); | 3433 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION, 0, NULL); |
3435 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); | 3434 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); |
3436 break; | 3435 break; |
3437 } | 3436 } |
3438 case SlotsBuffer::JS_RETURN_SLOT: { | |
3439 RelocInfo rinfo(addr, RelocInfo::JS_RETURN, 0, NULL); | |
3440 if (rinfo.IsPatchedReturnSequence()) rinfo.Visit(isolate, v); | |
3441 break; | |
3442 } | |
3443 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { | 3437 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { |
3444 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); | 3438 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); |
3445 rinfo.Visit(isolate, v); | 3439 rinfo.Visit(isolate, v); |
3446 break; | 3440 break; |
3447 } | 3441 } |
3448 case SlotsBuffer::OBJECT_SLOT: { | 3442 case SlotsBuffer::OBJECT_SLOT: { |
3449 v->VisitPointer(reinterpret_cast<Object**>(addr)); | 3443 v->VisitPointer(reinterpret_cast<Object**>(addr)); |
3450 break; | 3444 break; |
3451 } | 3445 } |
3452 default: | 3446 default: |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4522 | 4516 |
4523 static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { | 4517 static inline SlotsBuffer::SlotType SlotTypeForRMode(RelocInfo::Mode rmode) { |
4524 if (RelocInfo::IsCodeTarget(rmode)) { | 4518 if (RelocInfo::IsCodeTarget(rmode)) { |
4525 return SlotsBuffer::CODE_TARGET_SLOT; | 4519 return SlotsBuffer::CODE_TARGET_SLOT; |
4526 } else if (RelocInfo::IsCell(rmode)) { | 4520 } else if (RelocInfo::IsCell(rmode)) { |
4527 return SlotsBuffer::CELL_TARGET_SLOT; | 4521 return SlotsBuffer::CELL_TARGET_SLOT; |
4528 } else if (RelocInfo::IsEmbeddedObject(rmode)) { | 4522 } else if (RelocInfo::IsEmbeddedObject(rmode)) { |
4529 return SlotsBuffer::EMBEDDED_OBJECT_SLOT; | 4523 return SlotsBuffer::EMBEDDED_OBJECT_SLOT; |
4530 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { | 4524 } else if (RelocInfo::IsDebugBreakSlot(rmode)) { |
4531 return SlotsBuffer::DEBUG_TARGET_SLOT; | 4525 return SlotsBuffer::DEBUG_TARGET_SLOT; |
4532 } else if (RelocInfo::IsJSReturn(rmode)) { | |
4533 return SlotsBuffer::JS_RETURN_SLOT; | |
4534 } | 4526 } |
4535 UNREACHABLE(); | 4527 UNREACHABLE(); |
4536 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; | 4528 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; |
4537 } | 4529 } |
4538 | 4530 |
4539 | 4531 |
4540 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { | 4532 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { |
4541 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 4533 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
4542 RelocInfo::Mode rmode = rinfo->rmode(); | 4534 RelocInfo::Mode rmode = rinfo->rmode(); |
4543 if (target_page->IsEvacuationCandidate() && | 4535 if (target_page->IsEvacuationCandidate() && |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4653 SlotsBuffer* buffer = *buffer_address; | 4645 SlotsBuffer* buffer = *buffer_address; |
4654 while (buffer != NULL) { | 4646 while (buffer != NULL) { |
4655 SlotsBuffer* next_buffer = buffer->next(); | 4647 SlotsBuffer* next_buffer = buffer->next(); |
4656 DeallocateBuffer(buffer); | 4648 DeallocateBuffer(buffer); |
4657 buffer = next_buffer; | 4649 buffer = next_buffer; |
4658 } | 4650 } |
4659 *buffer_address = NULL; | 4651 *buffer_address = NULL; |
4660 } | 4652 } |
4661 } // namespace internal | 4653 } // namespace internal |
4662 } // namespace v8 | 4654 } // namespace v8 |
OLD | NEW |