Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 #define __STDC_LIMIT_MACROS | |
| 5 #include <stdint.h> | |
| 6 | |
| 7 #include "src/v8.h" | |
| 8 | |
| 9 #include "src/heap/gc-idle-time-handler.h" | |
| 10 | |
| 11 namespace v8 { | |
| 12 namespace internal { | |
| 13 | |
| 14 | |
| 15 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; | |
| 16 | |
| 17 | |
| 18 intptr_t GCIdleTimeHandler::EstimateMarkingStepSize( | |
| 19 int idle_time_in_ms, intptr_t marking_speed_in_bytes_per_millisecond) { | |
|
ulan
2014/08/20 08:21:16
Nit: marking_speed_in_bytes_per_ms would be consis
Hannes Payer (out of office)
2014/08/20 10:20:15
Done.
| |
| 20 DCHECK(idle_time_in_ms > 0); | |
| 21 | |
| 22 if (marking_speed_in_bytes_per_millisecond == 0) { | |
| 23 marking_speed_in_bytes_per_millisecond = | |
| 24 GCIdleTimeHandler::kInitialConservativeMarkingSpeed; | |
| 25 } | |
| 26 | |
| 27 intptr_t marking_step_size = | |
| 28 marking_speed_in_bytes_per_millisecond * idle_time_in_ms; | |
| 29 if (static_cast<intptr_t>(marking_step_size / idle_time_in_ms) != | |
| 30 marking_speed_in_bytes_per_millisecond) { | |
| 31 // In the case of an overflow we return maximum marking step size. | |
| 32 return INTPTR_MAX; | |
| 33 } | |
| 34 | |
| 35 return static_cast<intptr_t>(marking_step_size * | |
| 36 GCIdleTimeHandler::kConservativeTimeRatio); | |
| 37 } | |
| 38 } | |
| 39 } | |
| OLD | NEW |