OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "accessors.h" | 30 #include "accessors.h" |
31 #include "api.h" | 31 #include "api.h" |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "codegen-inl.h" | 33 #include "codegen-inl.h" |
34 #include "compilation-cache.h" | 34 #include "compilation-cache.h" |
35 #include "debug.h" | 35 #include "debug.h" |
36 #include "heap-profiler.h" | 36 #include "heap-profiler.h" |
37 #include "incremental-marking.h" | |
37 #include "global-handles.h" | 38 #include "global-handles.h" |
38 #include "liveobjectlist-inl.h" | 39 #include "liveobjectlist-inl.h" |
39 #include "mark-compact.h" | 40 #include "mark-compact.h" |
40 #include "natives.h" | 41 #include "natives.h" |
41 #include "objects-visiting.h" | 42 #include "objects-visiting.h" |
42 #include "runtime-profiler.h" | 43 #include "runtime-profiler.h" |
43 #include "scanner-base.h" | 44 #include "scanner-base.h" |
44 #include "scopeinfo.h" | 45 #include "scopeinfo.h" |
45 #include "snapshot.h" | 46 #include "snapshot.h" |
46 #include "store-buffer.h" | 47 #include "store-buffer.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 | 463 |
463 #ifdef DEBUG | 464 #ifdef DEBUG |
464 // Reset the allocation timeout to the GC interval, but make sure to | 465 // Reset the allocation timeout to the GC interval, but make sure to |
465 // allow at least a few allocations after a collection. The reason | 466 // allow at least a few allocations after a collection. The reason |
466 // for this is that we have a lot of allocation sequences and we | 467 // for this is that we have a lot of allocation sequences and we |
467 // assume that a garbage collection will allow the subsequent | 468 // assume that a garbage collection will allow the subsequent |
468 // allocation attempts to go through. | 469 // allocation attempts to go through. |
469 allocation_timeout_ = Max(6, FLAG_gc_interval); | 470 allocation_timeout_ = Max(6, FLAG_gc_interval); |
470 #endif | 471 #endif |
471 | 472 |
473 if (collector == SCAVENGER && | |
474 IncrementalMarking::state() != IncrementalMarking::STOPPED) { | |
475 if (FLAG_trace_incremental_marking) { | |
476 PrintF("[IncremenalMarker] SCAVENGE -> MARK-SWEEEP\n"); | |
Erik Corry
2011/02/22 12:27:19
menal -> mental
SWEEEP -> SWEEP
Vyacheslav Egorov (Chromium)
2011/02/23 14:31:46
Done.
| |
477 } | |
478 collector = MARK_COMPACTOR; | |
479 } | |
480 | |
472 bool next_gc_likely_to_collect_more = false; | 481 bool next_gc_likely_to_collect_more = false; |
473 | 482 |
474 { GCTracer tracer; | 483 { GCTracer tracer; |
475 GarbageCollectionPrologue(); | 484 GarbageCollectionPrologue(); |
476 // The GC count was incremented in the prologue. Tell the tracer about | 485 // The GC count was incremented in the prologue. Tell the tracer about |
477 // it. | 486 // it. |
478 tracer.set_gc_count(gc_count_); | 487 tracer.set_gc_count(gc_count_); |
479 | 488 |
480 // Tell the tracer which collector we've selected. | 489 // Tell the tracer which collector we've selected. |
481 tracer.set_collector(collector); | 490 tracer.set_collector(collector); |
482 | 491 |
483 HistogramTimer* rate = (collector == SCAVENGER) | 492 HistogramTimer* rate = (collector == SCAVENGER) |
484 ? &Counters::gc_scavenger | 493 ? &Counters::gc_scavenger |
485 : &Counters::gc_compactor; | 494 : &Counters::gc_compactor; |
486 rate->Start(); | 495 rate->Start(); |
487 next_gc_likely_to_collect_more = | 496 next_gc_likely_to_collect_more = |
488 PerformGarbageCollection(collector, &tracer); | 497 PerformGarbageCollection(collector, &tracer); |
489 rate->Stop(); | 498 rate->Stop(); |
490 | 499 |
491 GarbageCollectionEpilogue(); | 500 GarbageCollectionEpilogue(); |
492 } | 501 } |
493 | 502 |
503 ASSERT(IncrementalMarking::state() == IncrementalMarking::STOPPED); | |
504 if (NextGCIsLikelyToBeFull() && FLAG_incremental_marking) { | |
505 IncrementalMarking::Start(); | |
506 } | |
494 | 507 |
495 #ifdef ENABLE_LOGGING_AND_PROFILING | 508 #ifdef ENABLE_LOGGING_AND_PROFILING |
496 if (FLAG_log_gc) HeapProfiler::WriteSample(); | 509 if (FLAG_log_gc) HeapProfiler::WriteSample(); |
497 if (CpuProfiler::is_profiling()) CpuProfiler::ProcessMovedFunctions(); | 510 if (CpuProfiler::is_profiling()) CpuProfiler::ProcessMovedFunctions(); |
498 #endif | 511 #endif |
499 | 512 |
500 return next_gc_likely_to_collect_more; | 513 return next_gc_likely_to_collect_more; |
501 } | 514 } |
502 | 515 |
503 | 516 |
504 void Heap::PerformScavenge() { | 517 void Heap::PerformScavenge() { |
505 GCTracer tracer; | 518 GCTracer tracer; |
506 PerformGarbageCollection(SCAVENGER, &tracer); | 519 if (IncrementalMarking::state() == IncrementalMarking::STOPPED) { |
520 PerformGarbageCollection(SCAVENGER, &tracer); | |
521 } else { | |
522 PerformGarbageCollection(MARK_COMPACTOR, &tracer); | |
523 } | |
507 } | 524 } |
508 | 525 |
509 | 526 |
510 #ifdef DEBUG | 527 #ifdef DEBUG |
511 // Helper class for verifying the symbol table. | 528 // Helper class for verifying the symbol table. |
512 class SymbolTableVerifier : public ObjectVisitor { | 529 class SymbolTableVerifier : public ObjectVisitor { |
513 public: | 530 public: |
514 SymbolTableVerifier() { } | 531 SymbolTableVerifier() { } |
515 void VisitPointers(Object** start, Object** end) { | 532 void VisitPointers(Object** start, Object** end) { |
516 // Visit all HeapObject pointers in [start, end). | 533 // Visit all HeapObject pointers in [start, end). |
(...skipping 5050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5567 void ExternalStringTable::TearDown() { | 5584 void ExternalStringTable::TearDown() { |
5568 new_space_strings_.Free(); | 5585 new_space_strings_.Free(); |
5569 old_space_strings_.Free(); | 5586 old_space_strings_.Free(); |
5570 } | 5587 } |
5571 | 5588 |
5572 | 5589 |
5573 List<Object*> ExternalStringTable::new_space_strings_; | 5590 List<Object*> ExternalStringTable::new_space_strings_; |
5574 List<Object*> ExternalStringTable::old_space_strings_; | 5591 List<Object*> ExternalStringTable::old_space_strings_; |
5575 | 5592 |
5576 } } // namespace v8::internal | 5593 } } // namespace v8::internal |
OLD | NEW |