OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 // Helper function that simulates a full old-space in the heap. | 548 // Helper function that simulates a full old-space in the heap. |
549 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { | 549 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { |
550 space->EmptyAllocationInfo(); | 550 space->EmptyAllocationInfo(); |
551 space->ResetFreeList(); | 551 space->ResetFreeList(); |
552 space->ClearStats(); | 552 space->ClearStats(); |
553 } | 553 } |
554 | 554 |
555 | 555 |
556 // Helper function that simulates many incremental marking steps until | 556 // Helper function that simulates many incremental marking steps until |
557 // marking is completed. | 557 // marking is completed. |
558 static inline void SimulateIncrementalMarking(i::Heap* heap) { | 558 static inline void SimulateIncrementalMarking(i::Heap* heap, |
| 559 bool force_completion = true) { |
559 i::MarkCompactCollector* collector = heap->mark_compact_collector(); | 560 i::MarkCompactCollector* collector = heap->mark_compact_collector(); |
560 i::IncrementalMarking* marking = heap->incremental_marking(); | 561 i::IncrementalMarking* marking = heap->incremental_marking(); |
561 if (collector->sweeping_in_progress()) { | 562 if (collector->sweeping_in_progress()) { |
562 collector->EnsureSweepingCompleted(); | 563 collector->EnsureSweepingCompleted(); |
563 } | 564 } |
564 CHECK(marking->IsMarking() || marking->IsStopped()); | 565 CHECK(marking->IsMarking() || marking->IsStopped()); |
565 if (marking->IsStopped()) { | 566 if (marking->IsStopped()) { |
566 marking->Start(i::Heap::kNoGCFlags); | 567 marking->Start(i::Heap::kNoGCFlags); |
567 } | 568 } |
568 CHECK(marking->IsMarking()); | 569 CHECK(marking->IsMarking()); |
| 570 if (!force_completion) return; |
| 571 |
569 while (!marking->IsComplete()) { | 572 while (!marking->IsComplete()) { |
570 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 573 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
571 if (marking->IsReadyToOverApproximateWeakClosure()) { | 574 if (marking->IsReadyToOverApproximateWeakClosure()) { |
572 marking->MarkObjectGroups(); | 575 marking->MarkObjectGroups(); |
573 } | 576 } |
574 } | 577 } |
575 CHECK(marking->IsComplete()); | 578 CHECK(marking->IsComplete()); |
576 } | 579 } |
577 | 580 |
578 | 581 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 HandleAndZoneScope() {} | 618 HandleAndZoneScope() {} |
616 | 619 |
617 // Prefixing the below with main_ reduces a lot of naming clashes. | 620 // Prefixing the below with main_ reduces a lot of naming clashes. |
618 i::Zone* main_zone() { return &main_zone_; } | 621 i::Zone* main_zone() { return &main_zone_; } |
619 | 622 |
620 private: | 623 private: |
621 i::Zone main_zone_; | 624 i::Zone main_zone_; |
622 }; | 625 }; |
623 | 626 |
624 #endif // ifndef CCTEST_H_ | 627 #endif // ifndef CCTEST_H_ |
OLD | NEW |