| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } else { | 275 } else { |
| 276 MarkCompactCollector::MarkObject(code); | 276 MarkCompactCollector::MarkObject(code); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 | 279 |
| 280 void VisitDebugTarget(RelocInfo* rinfo) { | 280 void VisitDebugTarget(RelocInfo* rinfo) { |
| 281 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && | 281 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && |
| 282 rinfo->IsCallInstruction()); | 282 rinfo->IsCallInstruction()); |
| 283 HeapObject* code = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 283 HeapObject* code = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
| 284 MarkCompactCollector::MarkObject(code); | 284 MarkCompactCollector::MarkObject(code); |
| 285 // When compacting we convert the call to a real object pointer. | |
| 286 if (IsCompacting()) rinfo->set_call_object(code); | |
| 287 } | 285 } |
| 288 | 286 |
| 289 private: | 287 private: |
| 290 // Mark object pointed to by p. | 288 // Mark object pointed to by p. |
| 291 void MarkObjectByPointer(Object** p) { | 289 void MarkObjectByPointer(Object** p) { |
| 292 if (!(*p)->IsHeapObject()) return; | 290 if (!(*p)->IsHeapObject()) return; |
| 293 HeapObject* object = ShortCircuitConsString(p); | 291 HeapObject* object = ShortCircuitConsString(p); |
| 294 MarkCompactCollector::MarkObject(object); | 292 MarkCompactCollector::MarkObject(object); |
| 295 } | 293 } |
| 296 | 294 |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 } | 1374 } |
| 1377 | 1375 |
| 1378 void VisitCodeTarget(RelocInfo* rinfo) { | 1376 void VisitCodeTarget(RelocInfo* rinfo) { |
| 1379 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 1377 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 1380 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 1378 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 1381 VisitPointer(&target); | 1379 VisitPointer(&target); |
| 1382 rinfo->set_target_address( | 1380 rinfo->set_target_address( |
| 1383 reinterpret_cast<Code*>(target)->instruction_start()); | 1381 reinterpret_cast<Code*>(target)->instruction_start()); |
| 1384 } | 1382 } |
| 1385 | 1383 |
| 1384 void VisitDebugTarget(RelocInfo* rinfo) { |
| 1385 ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && rinfo->IsCallInstruction()); |
| 1386 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
| 1387 VisitPointer(&target); |
| 1388 rinfo->set_call_address( |
| 1389 reinterpret_cast<Code*>(target)->instruction_start()); |
| 1390 } |
| 1391 |
| 1386 private: | 1392 private: |
| 1387 void UpdatePointer(Object** p) { | 1393 void UpdatePointer(Object** p) { |
| 1388 if (!(*p)->IsHeapObject()) return; | 1394 if (!(*p)->IsHeapObject()) return; |
| 1389 | 1395 |
| 1390 HeapObject* obj = HeapObject::cast(*p); | 1396 HeapObject* obj = HeapObject::cast(*p); |
| 1391 Address old_addr = obj->address(); | 1397 Address old_addr = obj->address(); |
| 1392 Address new_addr; | 1398 Address new_addr; |
| 1393 ASSERT(!Heap::InFromSpace(obj)); | 1399 ASSERT(!Heap::InFromSpace(obj)); |
| 1394 | 1400 |
| 1395 if (Heap::new_space()->Contains(obj)) { | 1401 if (Heap::new_space()->Contains(obj)) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 | 1806 |
| 1801 void MarkCompactCollector::RebuildRSets() { | 1807 void MarkCompactCollector::RebuildRSets() { |
| 1802 #ifdef DEBUG | 1808 #ifdef DEBUG |
| 1803 ASSERT(state_ == RELOCATE_OBJECTS); | 1809 ASSERT(state_ == RELOCATE_OBJECTS); |
| 1804 state_ = REBUILD_RSETS; | 1810 state_ = REBUILD_RSETS; |
| 1805 #endif | 1811 #endif |
| 1806 Heap::RebuildRSets(); | 1812 Heap::RebuildRSets(); |
| 1807 } | 1813 } |
| 1808 | 1814 |
| 1809 } } // namespace v8::internal | 1815 } } // namespace v8::internal |
| OLD | NEW |