OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 collect_maps_ = FLAG_collect_maps && !was_marked_incrementally_; | 476 collect_maps_ = FLAG_collect_maps && !was_marked_incrementally_; |
477 | 477 |
478 // Rather than passing the tracer around we stash it in a static member | 478 // Rather than passing the tracer around we stash it in a static member |
479 // variable. | 479 // variable. |
480 tracer_ = tracer; | 480 tracer_ = tracer; |
481 | 481 |
482 #ifdef DEBUG | 482 #ifdef DEBUG |
483 ASSERT(state_ == IDLE); | 483 ASSERT(state_ == IDLE); |
484 state_ = PREPARE_GC; | 484 state_ = PREPARE_GC; |
485 #endif | 485 #endif |
486 ASSERT(!FLAG_always_compact || !FLAG_never_compact); | 486 if (FLAG_never_compact) FLAG_always_compact = false; |
487 | 487 |
488 if (collect_maps_) CreateBackPointers(); | 488 if (collect_maps_) CreateBackPointers(); |
489 #ifdef ENABLE_GDB_JIT_INTERFACE | 489 #ifdef ENABLE_GDB_JIT_INTERFACE |
490 if (FLAG_gdbjit) { | 490 if (FLAG_gdbjit) { |
491 // If GDBJIT interface is active disable compaction. | 491 // If GDBJIT interface is active disable compaction. |
492 compacting_collection_ = false; | 492 compacting_collection_ = false; |
493 } | 493 } |
494 #endif | 494 #endif |
495 | 495 |
496 // Clear marking bits for precise sweeping to collect all garbage. | 496 // Clear marking bits for precise sweeping to collect all garbage. |
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2447 VisitPointer(&target); | 2447 VisitPointer(&target); |
2448 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2448 rinfo->set_call_address(Code::cast(target)->instruction_start()); |
2449 } | 2449 } |
2450 | 2450 |
2451 private: | 2451 private: |
2452 inline void UpdatePointer(Object** p) { | 2452 inline void UpdatePointer(Object** p) { |
2453 if (!(*p)->IsHeapObject()) return; | 2453 if (!(*p)->IsHeapObject()) return; |
2454 | 2454 |
2455 HeapObject* obj = HeapObject::cast(*p); | 2455 HeapObject* obj = HeapObject::cast(*p); |
2456 | 2456 |
2457 if (heap_->InNewSpace(obj) || | 2457 MapWord map_word = obj->map_word(); |
2458 MarkCompactCollector::IsOnEvacuationCandidate(obj)) { | 2458 if (map_word.IsForwardingAddress()) { |
2459 ASSERT(obj->map_word().IsForwardingAddress()); | 2459 ASSERT(heap_->InFromSpace(obj) || |
| 2460 MarkCompactCollector::IsOnEvacuationCandidate(obj)); |
2460 *p = obj->map_word().ToForwardingAddress(); | 2461 *p = obj->map_word().ToForwardingAddress(); |
2461 ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(*p)); | 2462 ASSERT(!heap_->InFromSpace(*p) && |
| 2463 !MarkCompactCollector::IsOnEvacuationCandidate(*p)); |
2462 } | 2464 } |
2463 } | 2465 } |
2464 | 2466 |
2465 Heap* heap_; | 2467 Heap* heap_; |
2466 }; | 2468 }; |
2467 | 2469 |
2468 | 2470 |
2469 static void UpdatePointer(HeapObject** p, HeapObject* object) { | 2471 static void UpdatePointer(HeapObject** p, HeapObject* object) { |
2470 ASSERT(*p == object); | 2472 ASSERT(*p == object); |
2471 | 2473 |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3831 while (buffer != NULL) { | 3833 while (buffer != NULL) { |
3832 SlotsBuffer* next_buffer = buffer->next(); | 3834 SlotsBuffer* next_buffer = buffer->next(); |
3833 DeallocateBuffer(buffer); | 3835 DeallocateBuffer(buffer); |
3834 buffer = next_buffer; | 3836 buffer = next_buffer; |
3835 } | 3837 } |
3836 *buffer_address = NULL; | 3838 *buffer_address = NULL; |
3837 } | 3839 } |
3838 | 3840 |
3839 | 3841 |
3840 } } // namespace v8::internal | 3842 } } // namespace v8::internal |
OLD | NEW |