| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 ReportHeapStatistics("After GC"); | 397 ReportHeapStatistics("After GC"); |
| 398 } else if (FLAG_log_gc) { | 398 } else if (FLAG_log_gc) { |
| 399 new_space_.ReportStatistics(); | 399 new_space_.ReportStatistics(); |
| 400 } | 400 } |
| 401 #else | 401 #else |
| 402 if (FLAG_log_gc) new_space_.ReportStatistics(); | 402 if (FLAG_log_gc) new_space_.ReportStatistics(); |
| 403 #endif // DEBUG | 403 #endif // DEBUG |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 void Heap::GarbageCollectionPrologue() { | 407 void Heap::GarbageCollectionPrologue(GarbageCollector collector) { |
| 408 { AllowHeapAllocation for_the_first_part_of_prologue; | 408 { AllowHeapAllocation for_the_first_part_of_prologue; |
| 409 ClearJSFunctionResultCaches(); | 409 ClearJSFunctionResultCaches(); |
| 410 gc_count_++; | 410 gc_count_++; |
| 411 unflattened_strings_length_ = 0; | 411 unflattened_strings_length_ = 0; |
| 412 | 412 |
| 413 if (FLAG_flush_code && FLAG_flush_code_incrementally) { | 413 if (FLAG_flush_code && FLAG_flush_code_incrementally) { |
| 414 mark_compact_collector()->EnableCodeFlushing(true); | 414 mark_compact_collector()->EnableCodeFlushing(true); |
| 415 } | 415 } |
| 416 | 416 |
| 417 #ifdef VERIFY_HEAP | 417 #ifdef VERIFY_HEAP |
| (...skipping 10 matching lines...) Expand all Loading... |
| 428 UpdateMaximumCommitted(); | 428 UpdateMaximumCommitted(); |
| 429 | 429 |
| 430 #ifdef DEBUG | 430 #ifdef DEBUG |
| 431 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); | 431 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); |
| 432 | 432 |
| 433 if (FLAG_gc_verbose) Print(); | 433 if (FLAG_gc_verbose) Print(); |
| 434 | 434 |
| 435 ReportStatisticsBeforeGC(); | 435 ReportStatisticsBeforeGC(); |
| 436 #endif // DEBUG | 436 #endif // DEBUG |
| 437 | 437 |
| 438 store_buffer()->GCPrologue(); | 438 store_buffer()->GCPrologue(collector == MARK_COMPACTOR); |
| 439 | 439 |
| 440 if (isolate()->concurrent_osr_enabled()) { | 440 if (isolate()->concurrent_osr_enabled()) { |
| 441 isolate()->optimizing_compiler_thread()->AgeBufferedOsrJobs(); | 441 isolate()->optimizing_compiler_thread()->AgeBufferedOsrJobs(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 if (new_space_.IsAtMaximumCapacity()) { | 444 if (new_space_.IsAtMaximumCapacity()) { |
| 445 maximum_size_scavenges_++; | 445 maximum_size_scavenges_++; |
| 446 } else { | 446 } else { |
| 447 maximum_size_scavenges_ = 0; | 447 maximum_size_scavenges_ = 0; |
| 448 } | 448 } |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 collector = SCAVENGER; | 826 collector = SCAVENGER; |
| 827 collector_reason = "incremental marking delaying mark-sweep"; | 827 collector_reason = "incremental marking delaying mark-sweep"; |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 | 830 |
| 831 bool next_gc_likely_to_collect_more = false; | 831 bool next_gc_likely_to_collect_more = false; |
| 832 | 832 |
| 833 { GCTracer tracer(this, gc_reason, collector_reason); | 833 { GCTracer tracer(this, gc_reason, collector_reason); |
| 834 ASSERT(AllowHeapAllocation::IsAllowed()); | 834 ASSERT(AllowHeapAllocation::IsAllowed()); |
| 835 DisallowHeapAllocation no_allocation_during_gc; | 835 DisallowHeapAllocation no_allocation_during_gc; |
| 836 GarbageCollectionPrologue(); | 836 GarbageCollectionPrologue(collector); |
| 837 // The GC count was incremented in the prologue. Tell the tracer about | 837 // The GC count was incremented in the prologue. Tell the tracer about |
| 838 // it. | 838 // it. |
| 839 tracer.set_gc_count(gc_count_); | 839 tracer.set_gc_count(gc_count_); |
| 840 | 840 |
| 841 // Tell the tracer which collector we've selected. | 841 // Tell the tracer which collector we've selected. |
| 842 tracer.set_collector(collector); | 842 tracer.set_collector(collector); |
| 843 | 843 |
| 844 { | 844 { |
| 845 HistogramTimerScope histogram_timer_scope( | 845 HistogramTimerScope histogram_timer_scope( |
| 846 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() | 846 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() |
| (...skipping 5564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6411 static_cast<int>(object_sizes_last_time_[index])); | 6411 static_cast<int>(object_sizes_last_time_[index])); |
| 6412 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6412 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6413 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6413 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6414 | 6414 |
| 6415 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6415 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6416 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6416 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6417 ClearObjectStats(); | 6417 ClearObjectStats(); |
| 6418 } | 6418 } |
| 6419 | 6419 |
| 6420 } } // namespace v8::internal | 6420 } } // namespace v8::internal |
| OLD | NEW |