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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // ------------------------------------------------------------------------- | 55 // ------------------------------------------------------------------------- |
56 // MarkCompactCollector | 56 // MarkCompactCollector |
57 | 57 |
58 MarkCompactCollector::MarkCompactCollector() : // NOLINT | 58 MarkCompactCollector::MarkCompactCollector() : // NOLINT |
59 #ifdef DEBUG | 59 #ifdef DEBUG |
60 state_(IDLE), | 60 state_(IDLE), |
61 #endif | 61 #endif |
62 sweep_precisely_(false), | 62 sweep_precisely_(false), |
63 reduce_memory_footprint_(false), | 63 reduce_memory_footprint_(false), |
64 abort_incremental_marking_(false), | 64 abort_incremental_marking_(false), |
| 65 marking_parity_(ODD_MARKING_PARITY), |
65 compacting_(false), | 66 compacting_(false), |
66 was_marked_incrementally_(false), | 67 was_marked_incrementally_(false), |
67 tracer_(NULL), | 68 tracer_(NULL), |
68 migration_slots_buffer_(NULL), | 69 migration_slots_buffer_(NULL), |
69 heap_(NULL), | 70 heap_(NULL), |
70 code_flusher_(NULL), | 71 code_flusher_(NULL), |
71 encountered_weak_maps_(NULL) { } | 72 encountered_weak_maps_(NULL) { } |
72 | 73 |
73 | 74 |
74 #ifdef VERIFY_HEAP | 75 #ifdef VERIFY_HEAP |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 if (!FLAG_collect_maps) ReattachInitialMaps(); | 398 if (!FLAG_collect_maps) ReattachInitialMaps(); |
398 | 399 |
399 #ifdef DEBUG | 400 #ifdef DEBUG |
400 if (FLAG_verify_native_context_separation) { | 401 if (FLAG_verify_native_context_separation) { |
401 VerifyNativeContextSeparation(heap_); | 402 VerifyNativeContextSeparation(heap_); |
402 } | 403 } |
403 #endif | 404 #endif |
404 | 405 |
405 Finish(); | 406 Finish(); |
406 | 407 |
| 408 if (marking_parity_ == EVEN_MARKING_PARITY) { |
| 409 marking_parity_ = ODD_MARKING_PARITY; |
| 410 } else { |
| 411 ASSERT(marking_parity_ == ODD_MARKING_PARITY); |
| 412 marking_parity_ = EVEN_MARKING_PARITY; |
| 413 } |
| 414 |
407 tracer_ = NULL; | 415 tracer_ = NULL; |
408 } | 416 } |
409 | 417 |
410 | 418 |
411 #ifdef VERIFY_HEAP | 419 #ifdef VERIFY_HEAP |
412 void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { | 420 void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { |
413 PageIterator it(space); | 421 PageIterator it(space); |
414 | 422 |
415 while (it.has_next()) { | 423 while (it.has_next()) { |
416 Page* p = it.next(); | 424 Page* p = it.next(); |
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2390 void VisitCodeTarget(RelocInfo* rinfo) { | 2398 void VisitCodeTarget(RelocInfo* rinfo) { |
2391 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 2399 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
2392 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 2400 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
2393 Object* old_target = target; | 2401 Object* old_target = target; |
2394 VisitPointer(&target); | 2402 VisitPointer(&target); |
2395 if (target != old_target) { | 2403 if (target != old_target) { |
2396 rinfo->set_target_address(Code::cast(target)->instruction_start()); | 2404 rinfo->set_target_address(Code::cast(target)->instruction_start()); |
2397 } | 2405 } |
2398 } | 2406 } |
2399 | 2407 |
| 2408 void VisitCodeAgeSequence(RelocInfo* rinfo) { |
| 2409 ASSERT(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); |
| 2410 Object* stub = rinfo->code_age_stub(); |
| 2411 ASSERT(stub != NULL); |
| 2412 VisitPointer(&stub); |
| 2413 if (stub != rinfo->code_age_stub()) { |
| 2414 rinfo->set_code_age_stub(Code::cast(stub)); |
| 2415 } |
| 2416 } |
| 2417 |
2400 void VisitDebugTarget(RelocInfo* rinfo) { | 2418 void VisitDebugTarget(RelocInfo* rinfo) { |
2401 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 2419 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
2402 rinfo->IsPatchedReturnSequence()) || | 2420 rinfo->IsPatchedReturnSequence()) || |
2403 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 2421 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
2404 rinfo->IsPatchedDebugBreakSlotSequence())); | 2422 rinfo->IsPatchedDebugBreakSlotSequence())); |
2405 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 2423 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
2406 VisitPointer(&target); | 2424 VisitPointer(&target); |
2407 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2425 rinfo->set_call_address(Code::cast(target)->instruction_start()); |
2408 } | 2426 } |
2409 | 2427 |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3834 while (buffer != NULL) { | 3852 while (buffer != NULL) { |
3835 SlotsBuffer* next_buffer = buffer->next(); | 3853 SlotsBuffer* next_buffer = buffer->next(); |
3836 DeallocateBuffer(buffer); | 3854 DeallocateBuffer(buffer); |
3837 buffer = next_buffer; | 3855 buffer = next_buffer; |
3838 } | 3856 } |
3839 *buffer_address = NULL; | 3857 *buffer_address = NULL; |
3840 } | 3858 } |
3841 | 3859 |
3842 | 3860 |
3843 } } // namespace v8::internal | 3861 } } // namespace v8::internal |
OLD | NEW |