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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 // Remember the last top pointer so that we can later find out | 708 // Remember the last top pointer so that we can later find out |
709 // whether we allocated in new space since the last GC. | 709 // whether we allocated in new space since the last GC. |
710 new_space_top_after_last_gc_ = new_space()->top(); | 710 new_space_top_after_last_gc_ = new_space()->top(); |
711 last_gc_time_ = MonotonicallyIncreasingTimeInMs(); | 711 last_gc_time_ = MonotonicallyIncreasingTimeInMs(); |
712 | 712 |
713 ReduceNewSpaceSize(); | 713 ReduceNewSpaceSize(); |
714 } | 714 } |
715 | 715 |
716 | 716 |
717 void Heap::PreprocessStackTraces() { | 717 void Heap::PreprocessStackTraces() { |
718 if (!weak_stack_trace_list()->IsWeakFixedArray()) return; | 718 WeakFixedArray::Iterator iterator(weak_stack_trace_list()); |
719 WeakFixedArray* array = WeakFixedArray::cast(weak_stack_trace_list()); | 719 FixedArray* elements; |
720 int length = array->Length(); | 720 while ((elements = iterator.Next<FixedArray>())) { |
721 for (int i = 0; i < length; i++) { | |
722 if (array->IsEmptySlot(i)) continue; | |
723 FixedArray* elements = FixedArray::cast(array->Get(i)); | |
724 for (int j = 1; j < elements->length(); j += 4) { | 721 for (int j = 1; j < elements->length(); j += 4) { |
725 Object* maybe_code = elements->get(j + 2); | 722 Object* maybe_code = elements->get(j + 2); |
726 // If GC happens while adding a stack trace to the weak fixed array, | 723 // If GC happens while adding a stack trace to the weak fixed array, |
727 // which has been copied into a larger backing store, we may run into | 724 // which has been copied into a larger backing store, we may run into |
728 // a stack trace that has already been preprocessed. Guard against this. | 725 // a stack trace that has already been preprocessed. Guard against this. |
729 if (!maybe_code->IsCode()) break; | 726 if (!maybe_code->IsCode()) break; |
730 Code* code = Code::cast(maybe_code); | 727 Code* code = Code::cast(maybe_code); |
731 int offset = Smi::cast(elements->get(j + 3))->value(); | 728 int offset = Smi::cast(elements->get(j + 3))->value(); |
732 Address pc = code->address() + offset; | 729 Address pc = code->address() + offset; |
733 int pos = code->SourcePosition(pc); | 730 int pos = code->SourcePosition(pc); |
(...skipping 6141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6875 *object_type = "CODE_TYPE"; \ | 6872 *object_type = "CODE_TYPE"; \ |
6876 *object_sub_type = "CODE_AGE/" #name; \ | 6873 *object_sub_type = "CODE_AGE/" #name; \ |
6877 return true; | 6874 return true; |
6878 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6875 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6879 #undef COMPARE_AND_RETURN_NAME | 6876 #undef COMPARE_AND_RETURN_NAME |
6880 } | 6877 } |
6881 return false; | 6878 return false; |
6882 } | 6879 } |
6883 } // namespace internal | 6880 } // namespace internal |
6884 } // namespace v8 | 6881 } // namespace v8 |
OLD | NEW |