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_ - | 956 static_cast<double>(external_memory_) / external_memory_limit_; |
957 external_memory_at_last_mark_compact_ - | 957 DCHECK_LE(1.0, pressure); |
958 kExternalAllocationSoftLimit) / | 958 const double kMinStepSize = 5; |
959 external_memory_hard_limit(); | 959 const double kMaxStepSize = 10; |
960 DCHECK_GE(1, pressure); | |
961 const double kMaxStepSizeOnExternalLimit = 25; | |
962 const double deadline = MonotonicallyIncreasingTimeInMs() + | 960 const double deadline = MonotonicallyIncreasingTimeInMs() + |
963 pressure * kMaxStepSizeOnExternalLimit; | 961 Min(pressure * kMinStepSize, kMaxStepSize); |
964 incremental_marking()->AdvanceIncrementalMarking( | 962 incremental_marking()->AdvanceIncrementalMarking( |
965 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, | 963 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, |
966 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); | 964 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
967 } | 965 } |
968 } | 966 } |
969 | 967 |
970 void Heap::EnsureFillerObjectAtTop() { | 968 void Heap::EnsureFillerObjectAtTop() { |
971 // There may be an allocation memento behind objects in new space. Upon | 969 // There may be an allocation memento behind objects in new space. Upon |
972 // evacuation of a non-full new space (or if we are on the last page) there | 970 // evacuation of a non-full new space (or if we are on the last page) there |
973 // may be uninitialized memory behind top. We fill the remainder of the page | 971 // 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... |
6613 case LO_SPACE: | 6611 case LO_SPACE: |
6614 return "LO_SPACE"; | 6612 return "LO_SPACE"; |
6615 default: | 6613 default: |
6616 UNREACHABLE(); | 6614 UNREACHABLE(); |
6617 } | 6615 } |
6618 return NULL; | 6616 return NULL; |
6619 } | 6617 } |
6620 | 6618 |
6621 } // namespace internal | 6619 } // namespace internal |
6622 } // namespace v8 | 6620 } // namespace v8 |
OLD | NEW |