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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 kGCCallbackFlagSynchronousPhantomCallbackProcessing | | 946 kGCCallbackFlagSynchronousPhantomCallbackProcessing | |
947 kGCCallbackFlagCollectAllExternalMemory)); | 947 kGCCallbackFlagCollectAllExternalMemory)); |
948 } else { | 948 } else { |
949 CollectAllGarbage(i::Heap::kNoGCFlags, | 949 CollectAllGarbage(i::Heap::kNoGCFlags, |
950 GarbageCollectionReason::kExternalMemoryPressure, | 950 GarbageCollectionReason::kExternalMemoryPressure, |
951 kGCCallbackFlagSynchronousPhantomCallbackProcessing); | 951 kGCCallbackFlagSynchronousPhantomCallbackProcessing); |
952 } | 952 } |
953 } else { | 953 } else { |
954 // Incremental marking is turned on an has already been started. | 954 // Incremental marking is turned on an has already been started. |
955 const double pressure = | 955 const double pressure = |
956 static_cast<double>(external_memory_) / external_memory_limit_; | 956 static_cast<double>(external_memory_ - |
957 DCHECK_LE(1.0, pressure); | 957 external_memory_at_last_mark_compact_ - |
958 const double kMinStepSize = 5; | 958 kExternalAllocationSoftLimit) / |
959 const double kMaxStepSize = 10; | 959 external_memory_hard_limit(); |
| 960 DCHECK_GE(1, pressure); |
| 961 const double kMaxStepSizeOnExternalLimit = 25; |
960 const double deadline = MonotonicallyIncreasingTimeInMs() + | 962 const double deadline = MonotonicallyIncreasingTimeInMs() + |
961 Min(pressure * kMinStepSize, kMaxStepSize); | 963 pressure * kMaxStepSizeOnExternalLimit; |
962 incremental_marking()->AdvanceIncrementalMarking( | 964 incremental_marking()->AdvanceIncrementalMarking( |
963 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, | 965 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, |
964 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); | 966 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
965 } | 967 } |
966 } | 968 } |
967 | 969 |
968 void Heap::EnsureFillerObjectAtTop() { | 970 void Heap::EnsureFillerObjectAtTop() { |
969 // There may be an allocation memento behind objects in new space. Upon | 971 // There may be an allocation memento behind objects in new space. Upon |
970 // evacuation of a non-full new space (or if we are on the last page) there | 972 // evacuation of a non-full new space (or if we are on the last page) there |
971 // may be uninitialized memory behind top. We fill the remainder of the page | 973 // may be uninitialized memory behind top. We fill the remainder of the page |
(...skipping 5639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6611 case LO_SPACE: | 6613 case LO_SPACE: |
6612 return "LO_SPACE"; | 6614 return "LO_SPACE"; |
6613 default: | 6615 default: |
6614 UNREACHABLE(); | 6616 UNREACHABLE(); |
6615 } | 6617 } |
6616 return NULL; | 6618 return NULL; |
6617 } | 6619 } |
6618 | 6620 |
6619 } // namespace internal | 6621 } // namespace internal |
6620 } // namespace v8 | 6622 } // namespace v8 |
OLD | NEW |