Chromium Code Reviews| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 | 390 |
| 391 RecordWriteStub::Mode mode = is_compacting_ ? | 391 RecordWriteStub::Mode mode = is_compacting_ ? |
| 392 RecordWriteStub::INCREMENTAL_COMPACTION : RecordWriteStub::INCREMENTAL; | 392 RecordWriteStub::INCREMENTAL_COMPACTION : RecordWriteStub::INCREMENTAL; |
| 393 | 393 |
| 394 PatchIncrementalMarkingRecordWriteStubs(heap_, mode); | 394 PatchIncrementalMarkingRecordWriteStubs(heap_, mode); |
| 395 | 395 |
| 396 EnsureMarkingDequeIsCommitted(); | 396 EnsureMarkingDequeIsCommitted(); |
| 397 | 397 |
| 398 // Initialize marking stack. | 398 // Initialize marking stack. |
| 399 Address addr = static_cast<Address>(marking_deque_memory_->address()); | 399 Address addr = static_cast<Address>(marking_deque_memory_->address()); |
| 400 int size = marking_deque_memory_->size(); | 400 size_t size = marking_deque_memory_->size(); |
| 401 if (FLAG_force_marking_deque_overflows) size = 64 * kPointerSize; | 401 if (FLAG_force_marking_deque_overflows) size = 64 * kPointerSize; |
| 402 marking_deque_.Initialize(addr, addr + size); | 402 marking_deque_.Initialize(addr, addr + size); |
| 403 | 403 |
| 404 // Clear markbits. | 404 // Clear markbits. |
| 405 ClearMarkbits(); | 405 ClearMarkbits(); |
| 406 | 406 |
| 407 #ifdef DEBUG | 407 #ifdef DEBUG |
| 408 VerifyMarkbitsAreClean(); | 408 VerifyMarkbitsAreClean(); |
| 409 #endif | 409 #endif |
| 410 | 410 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 425 heap_->new_space()->FromSpaceEnd()); | 425 heap_->new_space()->FromSpaceEnd()); |
| 426 while (it.has_next()) { | 426 while (it.has_next()) { |
| 427 Bitmap::Clear(it.next()); | 427 Bitmap::Clear(it.next()); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { | 432 void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { |
| 433 if (!IsMarking()) return; | 433 if (!IsMarking()) return; |
| 434 | 434 |
| 435 intptr_t current = marking_deque_.bottom(); | 435 intptr_t current = marking_deque_.bottom(); |
|
Erik Corry
2011/07/15 21:37:33
I think making all these int instead of intptr_t s
Lasse Reichstein
2011/08/01 12:40:33
True, there is no need for intptr_t-ness here.
| |
| 436 intptr_t mask = marking_deque_.mask(); | 436 intptr_t mask = marking_deque_.mask(); |
| 437 intptr_t limit = marking_deque_.top(); | 437 intptr_t limit = marking_deque_.top(); |
| 438 HeapObject** array = marking_deque_.array(); | 438 HeapObject** array = marking_deque_.array(); |
| 439 intptr_t new_top = current; | 439 intptr_t new_top = current; |
| 440 | 440 |
| 441 Map* filler_map = heap_->one_pointer_filler_map(); | 441 Map* filler_map = heap_->one_pointer_filler_map(); |
| 442 | 442 |
| 443 while (current != limit) { | 443 while (current != limit) { |
| 444 HeapObject* obj = array[current]; | 444 HeapObject* obj = array[current]; |
| 445 ASSERT(obj->IsHeapObject()); | 445 ASSERT(obj->IsHeapObject()); |
| 446 current = ((current + 1) & mask); | 446 current = ((current + 1) & mask); |
| 447 if (heap_->InNewSpace(obj)) { | 447 if (heap_->InNewSpace(obj)) { |
| 448 MapWord map_word = obj->map_word(); | 448 MapWord map_word = obj->map_word(); |
| 449 if (map_word.IsForwardingAddress()) { | 449 if (map_word.IsForwardingAddress()) { |
| 450 HeapObject* dest = map_word.ToForwardingAddress(); | 450 HeapObject* dest = map_word.ToForwardingAddress(); |
| 451 array[new_top] = dest; | 451 array[new_top] = dest; |
| 452 new_top = ((new_top + 1) & mask); | 452 new_top = ((new_top + 1) & mask); |
| 453 ASSERT(new_top != marking_deque_.bottom()); | 453 ASSERT(new_top != marking_deque_.bottom()); |
| 454 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); | 454 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); |
| 455 } | 455 } |
| 456 } else if (obj->map() != filler_map) { | 456 } else if (obj->map() != filler_map) { |
| 457 // Skip one word filler objects that appear on the | 457 // Skip one word filler objects that appear on the |
| 458 // stack when we perform in place array shift. | 458 // stack when we perform in place array shift. |
| 459 array[new_top] = obj; | 459 array[new_top] = obj; |
| 460 new_top = ((new_top + 1) & mask); | 460 new_top = ((new_top + 1) & mask); |
| 461 ASSERT(new_top != marking_deque_.bottom()); | 461 ASSERT(new_top != marking_deque_.bottom()); |
| 462 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); | 462 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 marking_deque_.set_top(new_top); | 465 marking_deque_.set_top(static_cast<int>(new_top)); |
| 466 | 466 |
| 467 steps_took_since_last_gc_ = 0; | 467 steps_took_since_last_gc_ = 0; |
| 468 steps_count_since_last_gc_ = 0; | 468 steps_count_since_last_gc_ = 0; |
| 469 } | 469 } |
| 470 | 470 |
| 471 | 471 |
| 472 void IncrementalMarking::Hurry() { | 472 void IncrementalMarking::Hurry() { |
| 473 if (state() == MARKING) { | 473 if (state() == MARKING) { |
| 474 double start = 0.0; | 474 double start = 0.0; |
| 475 if (FLAG_trace_incremental_marking) { | 475 if (FLAG_trace_incremental_marking) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { | 622 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { |
| 623 double end = OS::TimeCurrentMillis(); | 623 double end = OS::TimeCurrentMillis(); |
| 624 double delta = (end - start); | 624 double delta = (end - start); |
| 625 steps_took_ += delta; | 625 steps_took_ += delta; |
| 626 steps_took_since_last_gc_ += delta; | 626 steps_took_since_last_gc_ += delta; |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 | 630 |
| 631 } } // namespace v8::internal | 631 } } // namespace v8::internal |
| OLD | NEW |