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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 int pos = code->SourcePosition(pc); | 740 int pos = code->SourcePosition(pc); |
741 elements->set(j + 2, Smi::FromInt(pos)); | 741 elements->set(j + 2, Smi::FromInt(pos)); |
742 } | 742 } |
743 } | 743 } |
744 // We must not compact the weak fixed list here, as we may be in the middle | 744 // We must not compact the weak fixed list here, as we may be in the middle |
745 // of writing to it, when the GC triggered. Instead, we reset the root value. | 745 // of writing to it, when the GC triggered. Instead, we reset the root value. |
746 set_weak_stack_trace_list(Smi::FromInt(0)); | 746 set_weak_stack_trace_list(Smi::FromInt(0)); |
747 } | 747 } |
748 | 748 |
749 | 749 |
| 750 class GCCallbacksScope { |
| 751 public: |
| 752 explicit GCCallbacksScope(Heap* heap) : heap_(heap) { |
| 753 heap_->gc_callbacks_depth_++; |
| 754 } |
| 755 ~GCCallbacksScope() { heap_->gc_callbacks_depth_--; } |
| 756 |
| 757 bool CheckReenter() { return heap_->gc_callbacks_depth_ == 1; } |
| 758 |
| 759 private: |
| 760 Heap* heap_; |
| 761 }; |
| 762 |
| 763 |
750 void Heap::HandleGCRequest() { | 764 void Heap::HandleGCRequest() { |
751 if (incremental_marking()->request_type() == | 765 if (incremental_marking()->request_type() == |
752 IncrementalMarking::COMPLETE_MARKING) { | 766 IncrementalMarking::COMPLETE_MARKING) { |
753 CollectAllGarbage(current_gc_flags_, "GC interrupt", | 767 CollectAllGarbage(current_gc_flags_, "GC interrupt", |
754 current_gc_callback_flags_); | 768 current_gc_callback_flags_); |
755 return; | 769 return; |
756 } | 770 } |
757 DCHECK(FLAG_overapproximate_weak_closure); | 771 DCHECK(FLAG_overapproximate_weak_closure); |
758 if (!incremental_marking()->weak_closure_was_overapproximated()) { | 772 if (!incremental_marking()->weak_closure_was_overapproximated()) { |
759 OverApproximateWeakClosure("GC interrupt"); | 773 OverApproximateWeakClosure("GC interrupt"); |
(...skipping 5911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6671 *object_sub_type = "CODE_AGE/" #name; \ | 6685 *object_sub_type = "CODE_AGE/" #name; \ |
6672 return true; | 6686 return true; |
6673 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6687 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6674 #undef COMPARE_AND_RETURN_NAME | 6688 #undef COMPARE_AND_RETURN_NAME |
6675 } | 6689 } |
6676 return false; | 6690 return false; |
6677 } | 6691 } |
6678 | 6692 |
6679 } // namespace internal | 6693 } // namespace internal |
6680 } // namespace v8 | 6694 } // namespace v8 |
OLD | NEW |