| 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/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 4028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4039 return new_space_top_after_last_gc_ == new_space()->top(); | 4039 return new_space_top_after_last_gc_ == new_space()->top(); |
| 4040 } | 4040 } |
| 4041 | 4041 |
| 4042 | 4042 |
| 4043 void Heap::MakeHeapIterable() { | 4043 void Heap::MakeHeapIterable() { |
| 4044 DCHECK(AllowHeapAllocation::IsAllowed()); | 4044 DCHECK(AllowHeapAllocation::IsAllowed()); |
| 4045 if (!IsHeapIterable()) { | 4045 if (!IsHeapIterable()) { |
| 4046 CollectAllGarbage(kMakeHeapIterableMask, | 4046 CollectAllGarbage(kMakeHeapIterableMask, |
| 4047 GarbageCollectionReason::kMakeHeapIterable); | 4047 GarbageCollectionReason::kMakeHeapIterable); |
| 4048 } | 4048 } |
| 4049 if (mark_compact_collector()->sweeping_in_progress()) { | 4049 mark_compact_collector()->EnsureSweepingCompleted(); |
| 4050 mark_compact_collector()->EnsureSweepingCompleted(); | |
| 4051 } | |
| 4052 DCHECK(IsHeapIterable()); | 4050 DCHECK(IsHeapIterable()); |
| 4053 } | 4051 } |
| 4054 | 4052 |
| 4055 | 4053 |
| 4056 static double ComputeMutatorUtilization(double mutator_speed, double gc_speed) { | 4054 static double ComputeMutatorUtilization(double mutator_speed, double gc_speed) { |
| 4057 const double kMinMutatorUtilization = 0.0; | 4055 const double kMinMutatorUtilization = 0.0; |
| 4058 const double kConservativeGcSpeedInBytesPerMillisecond = 200000; | 4056 const double kConservativeGcSpeedInBytesPerMillisecond = 200000; |
| 4059 if (mutator_speed == 0) return kMinMutatorUtilization; | 4057 if (mutator_speed == 0) return kMinMutatorUtilization; |
| 4060 if (gc_speed == 0) gc_speed = kConservativeGcSpeedInBytesPerMillisecond; | 4058 if (gc_speed == 0) gc_speed = kConservativeGcSpeedInBytesPerMillisecond; |
| 4061 // Derivation: | 4059 // Derivation: |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4691 return false; | 4689 return false; |
| 4692 } | 4690 } |
| 4693 } | 4691 } |
| 4694 | 4692 |
| 4695 | 4693 |
| 4696 #ifdef VERIFY_HEAP | 4694 #ifdef VERIFY_HEAP |
| 4697 void Heap::Verify() { | 4695 void Heap::Verify() { |
| 4698 CHECK(HasBeenSetUp()); | 4696 CHECK(HasBeenSetUp()); |
| 4699 HandleScope scope(isolate()); | 4697 HandleScope scope(isolate()); |
| 4700 | 4698 |
| 4701 if (mark_compact_collector()->sweeping_in_progress()) { | 4699 // We have to wait here for the sweeper threads to have an iterable heap. |
| 4702 // We have to wait here for the sweeper threads to have an iterable heap. | 4700 mark_compact_collector()->EnsureSweepingCompleted(); |
| 4703 mark_compact_collector()->EnsureSweepingCompleted(); | |
| 4704 } | |
| 4705 | 4701 |
| 4706 VerifyPointersVisitor visitor; | 4702 VerifyPointersVisitor visitor; |
| 4707 IterateRoots(&visitor, VISIT_ONLY_STRONG); | 4703 IterateRoots(&visitor, VISIT_ONLY_STRONG); |
| 4708 | 4704 |
| 4709 VerifySmisVisitor smis_visitor; | 4705 VerifySmisVisitor smis_visitor; |
| 4710 IterateSmiRoots(&smis_visitor); | 4706 IterateSmiRoots(&smis_visitor); |
| 4711 | 4707 |
| 4712 new_space_->Verify(); | 4708 new_space_->Verify(); |
| 4713 | 4709 |
| 4714 old_space_->Verify(&visitor); | 4710 old_space_->Verify(&visitor); |
| (...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6494 } | 6490 } |
| 6495 | 6491 |
| 6496 | 6492 |
| 6497 // static | 6493 // static |
| 6498 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6494 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6499 return StaticVisitorBase::GetVisitorId(map); | 6495 return StaticVisitorBase::GetVisitorId(map); |
| 6500 } | 6496 } |
| 6501 | 6497 |
| 6502 } // namespace internal | 6498 } // namespace internal |
| 6503 } // namespace v8 | 6499 } // namespace v8 |
| OLD | NEW |