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/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 4498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4509 } | 4509 } |
4510 } | 4510 } |
4511 if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) { | 4511 if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) { |
4512 CollectGarbageOnMemoryPressure(); | 4512 CollectGarbageOnMemoryPressure(); |
4513 } else if (memory_pressure_level_.Value() == MemoryPressureLevel::kModerate) { | 4513 } else if (memory_pressure_level_.Value() == MemoryPressureLevel::kModerate) { |
4514 if (FLAG_incremental_marking && incremental_marking()->IsStopped()) { | 4514 if (FLAG_incremental_marking && incremental_marking()->IsStopped()) { |
4515 StartIncrementalMarking(kReduceMemoryFootprintMask, | 4515 StartIncrementalMarking(kReduceMemoryFootprintMask, |
4516 GarbageCollectionReason::kMemoryPressure); | 4516 GarbageCollectionReason::kMemoryPressure); |
4517 } | 4517 } |
4518 } | 4518 } |
4519 MemoryReducer::Event event; | 4519 if (memory_reducer_) { |
4520 event.type = MemoryReducer::kPossibleGarbage; | 4520 MemoryReducer::Event event; |
4521 event.time_ms = MonotonicallyIncreasingTimeInMs(); | 4521 event.type = MemoryReducer::kPossibleGarbage; |
4522 memory_reducer_->NotifyPossibleGarbage(event); | 4522 event.time_ms = MonotonicallyIncreasingTimeInMs(); |
| 4523 memory_reducer_->NotifyPossibleGarbage(event); |
| 4524 } |
4523 } | 4525 } |
4524 | 4526 |
4525 void Heap::CollectGarbageOnMemoryPressure() { | 4527 void Heap::CollectGarbageOnMemoryPressure() { |
4526 const int kGarbageThresholdInBytes = 8 * MB; | 4528 const int kGarbageThresholdInBytes = 8 * MB; |
4527 const double kGarbageThresholdAsFractionOfTotalMemory = 0.1; | 4529 const double kGarbageThresholdAsFractionOfTotalMemory = 0.1; |
4528 // This constant is the maximum response time in RAIL performance model. | 4530 // This constant is the maximum response time in RAIL performance model. |
4529 const double kMaxMemoryPressurePauseMs = 100; | 4531 const double kMaxMemoryPressurePauseMs = 100; |
4530 | 4532 |
4531 double start = MonotonicallyIncreasingTimeInMs(); | 4533 double start = MonotonicallyIncreasingTimeInMs(); |
4532 CollectAllGarbage(kReduceMemoryFootprintMask | kAbortIncrementalMarkingMask, | 4534 CollectAllGarbage(kReduceMemoryFootprintMask | kAbortIncrementalMarkingMask, |
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6607 case LO_SPACE: | 6609 case LO_SPACE: |
6608 return "LO_SPACE"; | 6610 return "LO_SPACE"; |
6609 default: | 6611 default: |
6610 UNREACHABLE(); | 6612 UNREACHABLE(); |
6611 } | 6613 } |
6612 return NULL; | 6614 return NULL; |
6613 } | 6615 } |
6614 | 6616 |
6615 } // namespace internal | 6617 } // namespace internal |
6616 } // namespace v8 | 6618 } // namespace v8 |
OLD | NEW |