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/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 4386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4397 double end = MonotonicallyIncreasingTimeInMs(); | 4397 double end = MonotonicallyIncreasingTimeInMs(); |
| 4398 | 4398 |
| 4399 // Estimate how much memory we can free. | 4399 // Estimate how much memory we can free. |
| 4400 int64_t potential_garbage = | 4400 int64_t potential_garbage = |
| 4401 (CommittedMemory() - SizeOfObjects()) + external_memory_; | 4401 (CommittedMemory() - SizeOfObjects()) + external_memory_; |
| 4402 // If we can potentially free large amount of memory, then start GC right | 4402 // If we can potentially free large amount of memory, then start GC right |
| 4403 // away instead of waiting for memory reducer. | 4403 // away instead of waiting for memory reducer. |
| 4404 if (potential_garbage >= kGarbageThresholdInBytes && | 4404 if (potential_garbage >= kGarbageThresholdInBytes && |
| 4405 potential_garbage >= | 4405 potential_garbage >= |
| 4406 CommittedMemory() * kGarbageThresholdAsFractionOfTotalMemory) { | 4406 CommittedMemory() * kGarbageThresholdAsFractionOfTotalMemory) { |
| 4407 if (isolate()->concurrent_recompilation_enabled()) { | |
|
Hannes Payer (out of office)
2016/07/13 14:53:41
Why is the flushing guarded by the potential garba
| |
| 4408 // The optimizing compiler may be unnecessarily holding on to memory. | |
| 4409 DisallowHeapAllocation no_recursive_gc; | |
| 4410 isolate()->optimizing_compile_dispatcher()->Flush(); | |
| 4411 } | |
| 4407 // If we spent less than half of the time budget, then perform full GC | 4412 // If we spent less than half of the time budget, then perform full GC |
| 4408 // Otherwise, start incremental marking. | 4413 // Otherwise, start incremental marking. |
| 4409 if (end - start < kMaxMemoryPressurePauseMs / 2) { | 4414 if (end - start < kMaxMemoryPressurePauseMs / 2) { |
| 4410 CollectAllGarbage( | 4415 CollectAllGarbage( |
| 4411 kReduceMemoryFootprintMask | kAbortIncrementalMarkingMask, source, | 4416 kReduceMemoryFootprintMask | kAbortIncrementalMarkingMask, source, |
| 4412 kGCCallbackFlagCollectAllAvailableGarbage); | 4417 kGCCallbackFlagCollectAllAvailableGarbage); |
| 4413 } else { | 4418 } else { |
| 4414 if (FLAG_incremental_marking && incremental_marking()->IsStopped()) { | 4419 if (FLAG_incremental_marking && incremental_marking()->IsStopped()) { |
| 4415 StartIdleIncrementalMarking(); | 4420 StartIdleIncrementalMarking(); |
| 4416 } | 4421 } |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6428 } | 6433 } |
| 6429 | 6434 |
| 6430 | 6435 |
| 6431 // static | 6436 // static |
| 6432 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6437 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6433 return StaticVisitorBase::GetVisitorId(map); | 6438 return StaticVisitorBase::GetVisitorId(map); |
| 6434 } | 6439 } |
| 6435 | 6440 |
| 6436 } // namespace internal | 6441 } // namespace internal |
| 6437 } // namespace v8 | 6442 } // namespace v8 |
| OLD | NEW |