OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/heap/scavenge-job.h" | 5 #include "src/heap/scavenge-job.h" |
6 | 6 |
7 #include "src/base/platform/time.h" | 7 #include "src/base/platform/time.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 #include "src/v8.h" | 11 #include "src/v8.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 | 16 |
17 const double ScavengeJob::kMaxAllocationLimitAsFractionOfNewSpace = 0.8; | 17 const double ScavengeJob::kMaxAllocationLimitAsFractionOfNewSpace = 0.8; |
18 | 18 |
19 void ScavengeJob::IdleTask::RunInternal(double deadline_in_seconds) { | 19 void ScavengeJob::IdleTask::RunInternal(double deadline_in_seconds) { |
20 Heap* heap = isolate_->heap(); | 20 Heap* heap = isolate()->heap(); |
21 double deadline_in_ms = | 21 double deadline_in_ms = |
22 deadline_in_seconds * | 22 deadline_in_seconds * |
23 static_cast<double>(base::Time::kMillisecondsPerSecond); | 23 static_cast<double>(base::Time::kMillisecondsPerSecond); |
24 double start_ms = heap->MonotonicallyIncreasingTimeInMs(); | 24 double start_ms = heap->MonotonicallyIncreasingTimeInMs(); |
25 double idle_time_in_ms = deadline_in_ms - start_ms; | 25 double idle_time_in_ms = deadline_in_ms - start_ms; |
26 size_t scavenge_speed_in_bytes_per_ms = | 26 size_t scavenge_speed_in_bytes_per_ms = |
27 static_cast<size_t>(heap->tracer()->ScavengeSpeedInBytesPerMillisecond()); | 27 static_cast<size_t>(heap->tracer()->ScavengeSpeedInBytesPerMillisecond()); |
28 size_t new_space_size = heap->new_space()->Size(); | 28 size_t new_space_size = heap->new_space()->Size(); |
29 size_t new_space_capacity = heap->new_space()->Capacity(); | 29 size_t new_space_capacity = heap->new_space()->Capacity(); |
30 | 30 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate()); | 107 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap->isolate()); |
108 if (V8::GetCurrentPlatform()->IdleTasksEnabled(isolate)) { | 108 if (V8::GetCurrentPlatform()->IdleTasksEnabled(isolate)) { |
109 idle_task_pending_ = true; | 109 idle_task_pending_ = true; |
110 auto task = new IdleTask(heap->isolate(), this); | 110 auto task = new IdleTask(heap->isolate(), this); |
111 V8::GetCurrentPlatform()->CallIdleOnForegroundThread(isolate, task); | 111 V8::GetCurrentPlatform()->CallIdleOnForegroundThread(isolate, task); |
112 } | 112 } |
113 } | 113 } |
114 } | 114 } |
115 } // namespace internal | 115 } // namespace internal |
116 } // namespace v8 | 116 } // namespace v8 |
OLD | NEW |