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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2337 void VisitCodeTarget(RelocInfo* rinfo) { | 2345 void VisitCodeTarget(RelocInfo* rinfo) { |
2338 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 2346 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
2339 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 2347 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
2340 Object* old_target = target; | 2348 Object* old_target = target; |
2341 VisitPointer(&target); | 2349 VisitPointer(&target); |
2342 if (target != old_target) { | 2350 if (target != old_target) { |
2343 rinfo->set_target_address(Code::cast(target)->instruction_start()); | 2351 rinfo->set_target_address(Code::cast(target)->instruction_start()); |
2344 } | 2352 } |
2345 } | 2353 } |
2346 | 2354 |
2355 void VisitCodeAgeSequence(RelocInfo* rinfo) { | |
2356 ASSERT(RelocInfo::IsCodeAgeSequence(rinfo->rmode())); | |
2357 Object* stub = rinfo->code_age_stub(); | |
2358 ASSERT(stub != NULL); | |
2359 VisitPointer(&stub); | |
2360 rinfo->set_code_age_stub(Code::cast(stub)); | |
Michael Starzinger
2012/11/02 15:29:34
Can we use the "if (target != old_target)" pattern
danno
2012/11/09 13:05:30
Done.
| |
2361 } | |
2362 | |
2347 void VisitDebugTarget(RelocInfo* rinfo) { | 2363 void VisitDebugTarget(RelocInfo* rinfo) { |
2348 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 2364 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
2349 rinfo->IsPatchedReturnSequence()) || | 2365 rinfo->IsPatchedReturnSequence()) || |
2350 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 2366 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
2351 rinfo->IsPatchedDebugBreakSlotSequence())); | 2367 rinfo->IsPatchedDebugBreakSlotSequence())); |
2352 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 2368 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
2353 VisitPointer(&target); | 2369 VisitPointer(&target); |
2354 rinfo->set_call_address(Code::cast(target)->instruction_start()); | 2370 rinfo->set_call_address(Code::cast(target)->instruction_start()); |
2355 } | 2371 } |
2356 | 2372 |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3773 while (buffer != NULL) { | 3789 while (buffer != NULL) { |
3774 SlotsBuffer* next_buffer = buffer->next(); | 3790 SlotsBuffer* next_buffer = buffer->next(); |
3775 DeallocateBuffer(buffer); | 3791 DeallocateBuffer(buffer); |
3776 buffer = next_buffer; | 3792 buffer = next_buffer; |
3777 } | 3793 } |
3778 *buffer_address = NULL; | 3794 *buffer_address = NULL; |
3779 } | 3795 } |
3780 | 3796 |
3781 | 3797 |
3782 } } // namespace v8::internal | 3798 } } // namespace v8::internal |
OLD | NEW |