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/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 nodes_died_in_new_space_(0), | 113 nodes_died_in_new_space_(0), |
114 nodes_copied_in_new_space_(0), | 114 nodes_copied_in_new_space_(0), |
115 nodes_promoted_(0), | 115 nodes_promoted_(0), |
116 maximum_size_scavenges_(0), | 116 maximum_size_scavenges_(0), |
117 max_gc_pause_(0.0), | 117 max_gc_pause_(0.0), |
118 total_gc_time_ms_(0.0), | 118 total_gc_time_ms_(0.0), |
119 max_alive_after_gc_(0), | 119 max_alive_after_gc_(0), |
120 min_in_mutator_(kMaxInt), | 120 min_in_mutator_(kMaxInt), |
121 marking_time_(0.0), | 121 marking_time_(0.0), |
122 sweeping_time_(0.0), | 122 sweeping_time_(0.0), |
| 123 last_idle_notification_time_(0.0), |
123 mark_compact_collector_(this), | 124 mark_compact_collector_(this), |
124 store_buffer_(this), | 125 store_buffer_(this), |
125 marking_(this), | 126 marking_(this), |
126 incremental_marking_(this), | 127 incremental_marking_(this), |
127 gc_count_at_last_idle_gc_(0), | 128 gc_count_at_last_idle_gc_(0), |
128 full_codegen_bytes_generated_(0), | 129 full_codegen_bytes_generated_(0), |
129 crankshaft_codegen_bytes_generated_(0), | 130 crankshaft_codegen_bytes_generated_(0), |
130 gcs_since_last_deopt_(0), | 131 gcs_since_last_deopt_(0), |
131 #ifdef VERIFY_HEAP | 132 #ifdef VERIFY_HEAP |
132 no_weak_object_verification_scope_depth_(0), | 133 no_weak_object_verification_scope_depth_(0), |
(...skipping 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4523 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); | 4524 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
4524 break; | 4525 break; |
4525 case DO_FINALIZE_SWEEPING: | 4526 case DO_FINALIZE_SWEEPING: |
4526 mark_compact_collector()->EnsureSweepingCompleted(); | 4527 mark_compact_collector()->EnsureSweepingCompleted(); |
4527 break; | 4528 break; |
4528 case DO_NOTHING: | 4529 case DO_NOTHING: |
4529 break; | 4530 break; |
4530 } | 4531 } |
4531 | 4532 |
4532 double current_time = MonotonicallyIncreasingTimeInMs(); | 4533 double current_time = MonotonicallyIncreasingTimeInMs(); |
| 4534 last_idle_notification_time_ = current_time; |
4533 double deadline_difference = deadline_in_ms - current_time; | 4535 double deadline_difference = deadline_in_ms - current_time; |
4534 | 4536 |
4535 if (deadline_difference >= 0) { | 4537 if (deadline_difference >= 0) { |
4536 if (action.type != DONE && action.type != DO_NOTHING) { | 4538 if (action.type != DONE && action.type != DO_NOTHING) { |
4537 isolate()->counters()->gc_idle_time_limit_undershot()->AddSample( | 4539 isolate()->counters()->gc_idle_time_limit_undershot()->AddSample( |
4538 static_cast<int>(deadline_difference)); | 4540 static_cast<int>(deadline_difference)); |
4539 } | 4541 } |
4540 } else { | 4542 } else { |
4541 isolate()->counters()->gc_idle_time_limit_overshot()->AddSample( | 4543 isolate()->counters()->gc_idle_time_limit_overshot()->AddSample( |
4542 static_cast<int>(-deadline_difference)); | 4544 static_cast<int>(-deadline_difference)); |
(...skipping 14 matching lines...) Expand all Loading... |
4557 PrintF("]"); | 4559 PrintF("]"); |
4558 } | 4560 } |
4559 PrintF("\n"); | 4561 PrintF("\n"); |
4560 } | 4562 } |
4561 | 4563 |
4562 contexts_disposed_ = 0; | 4564 contexts_disposed_ = 0; |
4563 return result; | 4565 return result; |
4564 } | 4566 } |
4565 | 4567 |
4566 | 4568 |
| 4569 bool Heap::RecentIdleNotifcationHappened() { |
| 4570 return (last_idle_notification_time_ + |
| 4571 GCIdleTimeHandler::kMaxFrameRenderingIdleTime) > |
| 4572 MonotonicallyIncreasingTimeInMs(); |
| 4573 } |
| 4574 |
| 4575 |
4567 #ifdef DEBUG | 4576 #ifdef DEBUG |
4568 | 4577 |
4569 void Heap::Print() { | 4578 void Heap::Print() { |
4570 if (!HasBeenSetUp()) return; | 4579 if (!HasBeenSetUp()) return; |
4571 isolate()->PrintStack(stdout); | 4580 isolate()->PrintStack(stdout); |
4572 AllSpaces spaces(this); | 4581 AllSpaces spaces(this); |
4573 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { | 4582 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { |
4574 space->Print(); | 4583 space->Print(); |
4575 } | 4584 } |
4576 } | 4585 } |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6376 static_cast<int>(object_sizes_last_time_[index])); | 6385 static_cast<int>(object_sizes_last_time_[index])); |
6377 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6386 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6378 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6387 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6379 | 6388 |
6380 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6389 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6381 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6390 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6382 ClearObjectStats(); | 6391 ClearObjectStats(); |
6383 } | 6392 } |
6384 } | 6393 } |
6385 } // namespace v8::internal | 6394 } // namespace v8::internal |
OLD | NEW |