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/v8.h" | 5 #include "src/v8.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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4557 DCHECK(AllowHeapAllocation::IsAllowed()); | 4557 DCHECK(AllowHeapAllocation::IsAllowed()); |
4558 if (!IsHeapIterable()) { | 4558 if (!IsHeapIterable()) { |
4559 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); | 4559 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); |
4560 } | 4560 } |
4561 if (mark_compact_collector()->sweeping_in_progress()) { | 4561 if (mark_compact_collector()->sweeping_in_progress()) { |
4562 mark_compact_collector()->EnsureSweepingCompleted(); | 4562 mark_compact_collector()->EnsureSweepingCompleted(); |
4563 } | 4563 } |
4564 DCHECK(IsHeapIterable()); | 4564 DCHECK(IsHeapIterable()); |
4565 } | 4565 } |
4566 | 4566 |
4567 | |
4568 void Heap::ReduceNewSpaceSize(GCIdleTimeAction action) { | |
4569 if (action.reduce_memory && | |
4570 (action.type == DO_SCAVENGE || action.type == DO_FULL_GC || | |
ulan
2015/05/21 12:29:31
what about DO_NOTHING and DONE?
Hannes Payer (out of office)
2015/05/21 12:31:08
I think it just makes sense after an actual GC, be
| |
4571 (action.type == DO_INCREMENTAL_MARKING && | |
4572 incremental_marking()->IsStopped()))) { | |
4573 new_space_.Shrink(); | |
4574 UncommitFromSpace(); | |
4575 } | |
4576 } | |
4577 | |
4578 | |
4567 bool Heap::TryFinalizeIdleIncrementalMarking( | 4579 bool Heap::TryFinalizeIdleIncrementalMarking( |
4568 double idle_time_in_ms, size_t size_of_objects, | 4580 double idle_time_in_ms, size_t size_of_objects, |
4569 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { | 4581 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
4570 if (FLAG_overapproximate_weak_closure && | 4582 if (FLAG_overapproximate_weak_closure && |
4571 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || | 4583 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
4572 (!incremental_marking()->weak_closure_was_overapproximated() && | 4584 (!incremental_marking()->weak_closure_was_overapproximated() && |
4573 mark_compact_collector_.marking_deque()->IsEmpty() && | 4585 mark_compact_collector_.marking_deque()->IsEmpty() && |
4574 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( | 4586 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( |
4575 static_cast<size_t>(idle_time_in_ms))))) { | 4587 static_cast<size_t>(idle_time_in_ms))))) { |
4576 OverApproximateWeakClosure( | 4588 OverApproximateWeakClosure( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4678 case DO_SCAVENGE: | 4690 case DO_SCAVENGE: |
4679 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); | 4691 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
4680 break; | 4692 break; |
4681 case DO_FINALIZE_SWEEPING: | 4693 case DO_FINALIZE_SWEEPING: |
4682 mark_compact_collector()->EnsureSweepingCompleted(); | 4694 mark_compact_collector()->EnsureSweepingCompleted(); |
4683 break; | 4695 break; |
4684 case DO_NOTHING: | 4696 case DO_NOTHING: |
4685 break; | 4697 break; |
4686 } | 4698 } |
4687 | 4699 |
4688 if (action.reduce_memory) { | 4700 ReduceNewSpaceSize(action); |
4689 new_space_.Shrink(); | |
4690 UncommitFromSpace(); | |
4691 } | |
4692 return result; | 4701 return result; |
4693 } | 4702 } |
4694 | 4703 |
4695 | 4704 |
4696 void Heap::IdleNotificationEpilogue(GCIdleTimeAction action, | 4705 void Heap::IdleNotificationEpilogue(GCIdleTimeAction action, |
4697 GCIdleTimeHandler::HeapState heap_state, | 4706 GCIdleTimeHandler::HeapState heap_state, |
4698 double start_ms, double deadline_in_ms, | 4707 double start_ms, double deadline_in_ms, |
4699 bool is_long_idle_notification) { | 4708 bool is_long_idle_notification) { |
4700 double idle_time_in_ms = deadline_in_ms - start_ms; | 4709 double idle_time_in_ms = deadline_in_ms - start_ms; |
4701 double current_time = MonotonicallyIncreasingTimeInMs(); | 4710 double current_time = MonotonicallyIncreasingTimeInMs(); |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6578 *object_type = "CODE_TYPE"; \ | 6587 *object_type = "CODE_TYPE"; \ |
6579 *object_sub_type = "CODE_AGE/" #name; \ | 6588 *object_sub_type = "CODE_AGE/" #name; \ |
6580 return true; | 6589 return true; |
6581 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6590 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6582 #undef COMPARE_AND_RETURN_NAME | 6591 #undef COMPARE_AND_RETURN_NAME |
6583 } | 6592 } |
6584 return false; | 6593 return false; |
6585 } | 6594 } |
6586 } | 6595 } |
6587 } // namespace v8::internal | 6596 } // namespace v8::internal |
OLD | NEW |