OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/once.h" | 9 #include "src/base/once.h" |
10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 ReportHeapStatistics("After GC"); | 401 ReportHeapStatistics("After GC"); |
402 } else if (FLAG_log_gc) { | 402 } else if (FLAG_log_gc) { |
403 new_space_.ReportStatistics(); | 403 new_space_.ReportStatistics(); |
404 } | 404 } |
405 #else | 405 #else |
406 if (FLAG_log_gc) new_space_.ReportStatistics(); | 406 if (FLAG_log_gc) new_space_.ReportStatistics(); |
407 #endif // DEBUG | 407 #endif // DEBUG |
408 } | 408 } |
409 | 409 |
410 | 410 |
411 void Heap::GarbageCollectionPrologue(GarbageCollector collector) { | 411 void Heap::GarbageCollectionPrologue() { |
412 { AllowHeapAllocation for_the_first_part_of_prologue; | 412 { AllowHeapAllocation for_the_first_part_of_prologue; |
413 ClearJSFunctionResultCaches(); | 413 ClearJSFunctionResultCaches(); |
414 gc_count_++; | 414 gc_count_++; |
415 unflattened_strings_length_ = 0; | 415 unflattened_strings_length_ = 0; |
416 | 416 |
417 if (FLAG_flush_code && FLAG_flush_code_incrementally) { | 417 if (FLAG_flush_code && FLAG_flush_code_incrementally) { |
418 mark_compact_collector()->EnableCodeFlushing(true); | 418 mark_compact_collector()->EnableCodeFlushing(true); |
419 } | 419 } |
420 | 420 |
421 #ifdef VERIFY_HEAP | 421 #ifdef VERIFY_HEAP |
(...skipping 10 matching lines...) Expand all Loading... |
432 UpdateMaximumCommitted(); | 432 UpdateMaximumCommitted(); |
433 | 433 |
434 #ifdef DEBUG | 434 #ifdef DEBUG |
435 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); | 435 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); |
436 | 436 |
437 if (FLAG_gc_verbose) Print(); | 437 if (FLAG_gc_verbose) Print(); |
438 | 438 |
439 ReportStatisticsBeforeGC(); | 439 ReportStatisticsBeforeGC(); |
440 #endif // DEBUG | 440 #endif // DEBUG |
441 | 441 |
442 store_buffer()->GCPrologue(collector == MARK_COMPACTOR); | 442 store_buffer()->GCPrologue(); |
443 | 443 |
444 if (isolate()->concurrent_osr_enabled()) { | 444 if (isolate()->concurrent_osr_enabled()) { |
445 isolate()->optimizing_compiler_thread()->AgeBufferedOsrJobs(); | 445 isolate()->optimizing_compiler_thread()->AgeBufferedOsrJobs(); |
446 } | 446 } |
447 | 447 |
448 if (new_space_.IsAtMaximumCapacity()) { | 448 if (new_space_.IsAtMaximumCapacity()) { |
449 maximum_size_scavenges_++; | 449 maximum_size_scavenges_++; |
450 } else { | 450 } else { |
451 maximum_size_scavenges_ = 0; | 451 maximum_size_scavenges_ = 0; |
452 } | 452 } |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 collector = SCAVENGER; | 830 collector = SCAVENGER; |
831 collector_reason = "incremental marking delaying mark-sweep"; | 831 collector_reason = "incremental marking delaying mark-sweep"; |
832 } | 832 } |
833 } | 833 } |
834 | 834 |
835 bool next_gc_likely_to_collect_more = false; | 835 bool next_gc_likely_to_collect_more = false; |
836 | 836 |
837 { GCTracer tracer(this, gc_reason, collector_reason); | 837 { GCTracer tracer(this, gc_reason, collector_reason); |
838 ASSERT(AllowHeapAllocation::IsAllowed()); | 838 ASSERT(AllowHeapAllocation::IsAllowed()); |
839 DisallowHeapAllocation no_allocation_during_gc; | 839 DisallowHeapAllocation no_allocation_during_gc; |
840 GarbageCollectionPrologue(collector); | 840 GarbageCollectionPrologue(); |
841 // The GC count was incremented in the prologue. Tell the tracer about | 841 // The GC count was incremented in the prologue. Tell the tracer about |
842 // it. | 842 // it. |
843 tracer.set_gc_count(gc_count_); | 843 tracer.set_gc_count(gc_count_); |
844 | 844 |
845 // Tell the tracer which collector we've selected. | 845 // Tell the tracer which collector we've selected. |
846 tracer.set_collector(collector); | 846 tracer.set_collector(collector); |
847 | 847 |
848 { | 848 { |
849 HistogramTimerScope histogram_timer_scope( | 849 HistogramTimerScope histogram_timer_scope( |
850 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() | 850 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() |
(...skipping 5564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6415 static_cast<int>(object_sizes_last_time_[index])); | 6415 static_cast<int>(object_sizes_last_time_[index])); |
6416 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6416 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6417 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6417 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6418 | 6418 |
6419 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6419 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6420 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6420 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6421 ClearObjectStats(); | 6421 ClearObjectStats(); |
6422 } | 6422 } |
6423 | 6423 |
6424 } } // namespace v8::internal | 6424 } } // namespace v8::internal |
OLD | NEW |