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 "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4365 | 4365 |
4366 private: | 4366 private: |
4367 // v8::internal::CancelableTask overrides. | 4367 // v8::internal::CancelableTask overrides. |
4368 void RunInternal() override { heap_->CheckMemoryPressure(); } | 4368 void RunInternal() override { heap_->CheckMemoryPressure(); } |
4369 | 4369 |
4370 Heap* heap_; | 4370 Heap* heap_; |
4371 DISALLOW_COPY_AND_ASSIGN(MemoryPressureInterruptTask); | 4371 DISALLOW_COPY_AND_ASSIGN(MemoryPressureInterruptTask); |
4372 }; | 4372 }; |
4373 | 4373 |
4374 void Heap::CheckMemoryPressure() { | 4374 void Heap::CheckMemoryPressure() { |
| 4375 if (HighMemoryPressure()) { |
| 4376 if (isolate()->concurrent_recompilation_enabled()) { |
| 4377 // The optimizing compiler may be unnecessarily holding on to memory. |
| 4378 DisallowHeapAllocation no_recursive_gc; |
| 4379 isolate()->optimizing_compile_dispatcher()->Flush(); |
| 4380 } |
| 4381 } |
4375 if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) { | 4382 if (memory_pressure_level_.Value() == MemoryPressureLevel::kCritical) { |
4376 CollectGarbageOnMemoryPressure("memory pressure"); | 4383 CollectGarbageOnMemoryPressure("memory pressure"); |
4377 } else if (memory_pressure_level_.Value() == MemoryPressureLevel::kModerate) { | 4384 } else if (memory_pressure_level_.Value() == MemoryPressureLevel::kModerate) { |
4378 if (FLAG_incremental_marking && incremental_marking()->IsStopped()) { | 4385 if (FLAG_incremental_marking && incremental_marking()->IsStopped()) { |
4379 StartIdleIncrementalMarking(); | 4386 StartIdleIncrementalMarking(); |
4380 } | 4387 } |
4381 } | 4388 } |
4382 MemoryReducer::Event event; | 4389 MemoryReducer::Event event; |
4383 event.type = MemoryReducer::kPossibleGarbage; | 4390 event.type = MemoryReducer::kPossibleGarbage; |
4384 event.time_ms = MonotonicallyIncreasingTimeInMs(); | 4391 event.time_ms = MonotonicallyIncreasingTimeInMs(); |
(...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6428 } | 6435 } |
6429 | 6436 |
6430 | 6437 |
6431 // static | 6438 // static |
6432 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6439 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6433 return StaticVisitorBase::GetVisitorId(map); | 6440 return StaticVisitorBase::GetVisitorId(map); |
6434 } | 6441 } |
6435 | 6442 |
6436 } // namespace internal | 6443 } // namespace internal |
6437 } // namespace v8 | 6444 } // namespace v8 |
OLD | NEW |