Chromium Code Reviews| 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 4294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4305 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); | 4305 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); |
| 4306 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4306 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
| 4307 // TODO(ulan): Start incremental marking only for large heaps. | 4307 // TODO(ulan): Start incremental marking only for large heaps. |
| 4308 heap_state.can_start_incremental_marking = true; | 4308 heap_state.can_start_incremental_marking = true; |
| 4309 heap_state.sweeping_in_progress = | 4309 heap_state.sweeping_in_progress = |
| 4310 mark_compact_collector()->sweeping_in_progress(); | 4310 mark_compact_collector()->sweeping_in_progress(); |
| 4311 heap_state.mark_compact_speed_in_bytes_per_ms = | 4311 heap_state.mark_compact_speed_in_bytes_per_ms = |
| 4312 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); | 4312 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); |
| 4313 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( | 4313 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( |
| 4314 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 4314 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
| 4315 heap_state.scavenge_speed_in_bytes_per_ms = | |
| 4316 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); | |
| 4317 heap_state.available_new_space_memory = new_space_.Available(); | |
| 4318 heap_state.new_space_capacity = new_space_.Capacity(); | |
| 4315 | 4319 |
| 4316 GCIdleTimeAction action = | 4320 GCIdleTimeAction action = |
| 4317 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); | 4321 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); |
| 4318 | 4322 |
| 4319 contexts_disposed_ = 0; | 4323 contexts_disposed_ = 0; |
| 4320 bool result = false; | 4324 bool result = false; |
| 4321 switch (action.type) { | 4325 switch (action.type) { |
| 4322 case DO_INCREMENTAL_MARKING: | 4326 case DO_INCREMENTAL_MARKING: |
| 4323 if (incremental_marking()->IsStopped()) { | 4327 if (incremental_marking()->IsStopped()) { |
| 4324 incremental_marking()->Start(); | 4328 incremental_marking()->Start(); |
| 4325 } | 4329 } |
| 4326 AdvanceIdleIncrementalMarking(action.parameter); | 4330 AdvanceIdleIncrementalMarking(action.parameter); |
| 4327 break; | 4331 break; |
| 4328 case DO_FULL_GC: { | 4332 case DO_FULL_GC: { |
| 4329 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4333 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| 4330 const char* message = contexts_disposed_ | 4334 const char* message = contexts_disposed_ |
| 4331 ? "idle notification: contexts disposed" | 4335 ? "idle notification: contexts disposed" |
| 4332 : "idle notification: finalize idle round"; | 4336 : "idle notification: finalize idle round"; |
| 4333 CollectAllGarbage(kReduceMemoryFootprintMask, message); | 4337 CollectAllGarbage(kReduceMemoryFootprintMask, message); |
| 4334 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4338 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
| 4335 break; | 4339 break; |
| 4336 } | 4340 } |
| 4337 case DO_SCAVENGE: | 4341 case DO_SCAVENGE: |
| 4338 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); | 4342 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
|
ulan
2014/09/10 14:25:00
It just occurred to me that this will trigger scav
| |
| 4339 break; | 4343 break; |
| 4340 case DO_FINALIZE_SWEEPING: | 4344 case DO_FINALIZE_SWEEPING: |
| 4341 mark_compact_collector()->EnsureSweepingCompleted(); | 4345 mark_compact_collector()->EnsureSweepingCompleted(); |
| 4342 break; | 4346 break; |
| 4343 case DO_NOTHING: | 4347 case DO_NOTHING: |
| 4344 result = true; | 4348 result = true; |
| 4345 break; | 4349 break; |
| 4346 } | 4350 } |
| 4347 if (FLAG_trace_idle_notification) { | 4351 if (FLAG_trace_idle_notification) { |
| 4348 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); | 4352 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); |
| (...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6126 static_cast<int>(object_sizes_last_time_[index])); | 6130 static_cast<int>(object_sizes_last_time_[index])); |
| 6127 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6131 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6128 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6132 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6129 | 6133 |
| 6130 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6134 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6131 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6135 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6132 ClearObjectStats(); | 6136 ClearObjectStats(); |
| 6133 } | 6137 } |
| 6134 } | 6138 } |
| 6135 } // namespace v8::internal | 6139 } // namespace v8::internal |
| OLD | NEW |