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 4352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4363 } else if (RelocInfo::IsJSReturn(rmode)) { | 4363 } else if (RelocInfo::IsJSReturn(rmode)) { |
4364 return SlotsBuffer::JS_RETURN_SLOT; | 4364 return SlotsBuffer::JS_RETURN_SLOT; |
4365 } | 4365 } |
4366 UNREACHABLE(); | 4366 UNREACHABLE(); |
4367 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; | 4367 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; |
4368 } | 4368 } |
4369 | 4369 |
4370 | 4370 |
4371 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { | 4371 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { |
4372 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 4372 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
| 4373 RelocInfo::Mode rmode = rinfo->rmode(); |
4373 if (target_page->IsEvacuationCandidate() && | 4374 if (target_page->IsEvacuationCandidate() && |
4374 (rinfo->host() == NULL || | 4375 (rinfo->host() == NULL || |
4375 !ShouldSkipEvacuationSlotRecording(rinfo->host()))) { | 4376 !ShouldSkipEvacuationSlotRecording(rinfo->host()))) { |
4376 if (!SlotsBuffer::AddTo(&slots_buffer_allocator_, | 4377 bool success; |
4377 target_page->slots_buffer_address(), | 4378 if (RelocInfo::IsEmbeddedObject(rmode) && rinfo->IsInConstantPool()) { |
4378 SlotTypeForRMode(rinfo->rmode()), | 4379 // This doesn't need to be typed since it is just a normal heap pointer. |
4379 rinfo->pc(), | 4380 Object** target_pointer = |
4380 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 4381 reinterpret_cast<Object**>(rinfo->constant_pool_entry_address()); |
| 4382 success = SlotsBuffer::AddTo(&slots_buffer_allocator_, |
| 4383 target_page->slots_buffer_address(), |
| 4384 target_pointer, |
| 4385 SlotsBuffer::FAIL_ON_OVERFLOW); |
| 4386 } else if (RelocInfo::IsCodeTarget(rmode) && rinfo->IsInConstantPool()) { |
| 4387 success = SlotsBuffer::AddTo(&slots_buffer_allocator_, |
| 4388 target_page->slots_buffer_address(), |
| 4389 SlotsBuffer::CODE_ENTRY_SLOT, |
| 4390 rinfo->constant_pool_entry_address(), |
| 4391 SlotsBuffer::FAIL_ON_OVERFLOW); |
| 4392 } else { |
| 4393 success = SlotsBuffer::AddTo(&slots_buffer_allocator_, |
| 4394 target_page->slots_buffer_address(), |
| 4395 SlotTypeForRMode(rmode), |
| 4396 rinfo->pc(), |
| 4397 SlotsBuffer::FAIL_ON_OVERFLOW); |
| 4398 } |
| 4399 if (!success) { |
4381 EvictEvacuationCandidate(target_page); | 4400 EvictEvacuationCandidate(target_page); |
4382 } | 4401 } |
4383 } | 4402 } |
4384 } | 4403 } |
4385 | 4404 |
4386 | 4405 |
4387 void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) { | 4406 void MarkCompactCollector::RecordCodeEntrySlot(Address slot, Code* target) { |
4388 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 4407 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
4389 if (target_page->IsEvacuationCandidate() && | 4408 if (target_page->IsEvacuationCandidate() && |
4390 !ShouldSkipEvacuationSlotRecording(reinterpret_cast<Object**>(slot))) { | 4409 !ShouldSkipEvacuationSlotRecording(reinterpret_cast<Object**>(slot))) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4477 while (buffer != NULL) { | 4496 while (buffer != NULL) { |
4478 SlotsBuffer* next_buffer = buffer->next(); | 4497 SlotsBuffer* next_buffer = buffer->next(); |
4479 DeallocateBuffer(buffer); | 4498 DeallocateBuffer(buffer); |
4480 buffer = next_buffer; | 4499 buffer = next_buffer; |
4481 } | 4500 } |
4482 *buffer_address = NULL; | 4501 *buffer_address = NULL; |
4483 } | 4502 } |
4484 | 4503 |
4485 | 4504 |
4486 } } // namespace v8::internal | 4505 } } // namespace v8::internal |
OLD | NEW |