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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 | 489 |
490 // Helper function that simulates a full old-space in the heap. | 490 // Helper function that simulates a full old-space in the heap. |
491 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { | 491 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { |
492 space->EmptyAllocationInfo(); | 492 space->EmptyAllocationInfo(); |
493 space->ResetFreeList(); | 493 space->ResetFreeList(); |
494 space->ClearStats(); | 494 space->ClearStats(); |
495 } | 495 } |
496 | 496 |
497 | 497 |
| 498 // Helper function that simulates many incremental marking steps until |
| 499 // marking is completed. |
| 500 static inline void SimulateIncrementalMarking(i::Heap* heap) { |
| 501 i::MarkCompactCollector* collector = heap->mark_compact_collector(); |
| 502 i::IncrementalMarking* marking = heap->incremental_marking(); |
| 503 if (collector->sweeping_in_progress()) { |
| 504 collector->EnsureSweepingCompleted(); |
| 505 } |
| 506 CHECK(marking->IsMarking() || marking->IsStopped()); |
| 507 if (marking->IsStopped()) { |
| 508 marking->Start(); |
| 509 } |
| 510 CHECK(marking->IsMarking()); |
| 511 while (!marking->IsComplete()) { |
| 512 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
| 513 } |
| 514 CHECK(marking->IsComplete()); |
| 515 } |
| 516 |
| 517 |
498 // Helper class for new allocations tracking and checking. | 518 // Helper class for new allocations tracking and checking. |
499 // To use checking of JS allocations tracking in a test, | 519 // To use checking of JS allocations tracking in a test, |
500 // just create an instance of this class. | 520 // just create an instance of this class. |
501 class HeapObjectsTracker { | 521 class HeapObjectsTracker { |
502 public: | 522 public: |
503 HeapObjectsTracker() { | 523 HeapObjectsTracker() { |
504 heap_profiler_ = i::Isolate::Current()->heap_profiler(); | 524 heap_profiler_ = i::Isolate::Current()->heap_profiler(); |
505 CHECK_NE(NULL, heap_profiler_); | 525 CHECK_NE(NULL, heap_profiler_); |
506 heap_profiler_->StartHeapObjectsTracking(true); | 526 heap_profiler_->StartHeapObjectsTracking(true); |
507 } | 527 } |
(...skipping 29 matching lines...) Expand all Loading... |
537 HandleAndZoneScope() : main_zone_(main_isolate()) {} | 557 HandleAndZoneScope() : main_zone_(main_isolate()) {} |
538 | 558 |
539 // Prefixing the below with main_ reduces a lot of naming clashes. | 559 // Prefixing the below with main_ reduces a lot of naming clashes. |
540 i::Zone* main_zone() { return &main_zone_; } | 560 i::Zone* main_zone() { return &main_zone_; } |
541 | 561 |
542 private: | 562 private: |
543 i::Zone main_zone_; | 563 i::Zone main_zone_; |
544 }; | 564 }; |
545 | 565 |
546 #endif // ifndef CCTEST_H_ | 566 #endif // ifndef CCTEST_H_ |
OLD | NEW |