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 4790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4801 case Heap::k##name##RootIndex: \ | 4801 case Heap::k##name##RootIndex: \ |
4802 return true; | 4802 return true; |
4803 IMMORTAL_IMMOVABLE_ROOT_LIST(CASE); | 4803 IMMORTAL_IMMOVABLE_ROOT_LIST(CASE); |
4804 #undef CASE | 4804 #undef CASE |
4805 default: | 4805 default: |
4806 return false; | 4806 return false; |
4807 } | 4807 } |
4808 } | 4808 } |
4809 | 4809 |
4810 | 4810 |
| 4811 bool Heap::GetRootListIndex(Handle<HeapObject> object, |
| 4812 Heap::RootListIndex* index_return) { |
| 4813 Object* ptr = *object; |
| 4814 #define IMMORTAL_IMMOVABLE_ROOT(Name) \ |
| 4815 if (ptr == roots_[Heap::k##Name##RootIndex]) { \ |
| 4816 *index_return = k##Name##RootIndex; \ |
| 4817 return true; \ |
| 4818 } |
| 4819 IMMORTAL_IMMOVABLE_ROOT_LIST(IMMORTAL_IMMOVABLE_ROOT) |
| 4820 #undef IMMORTAL_IMMOVABLE_ROOT |
| 4821 return false; |
| 4822 } |
| 4823 |
| 4824 |
4811 #ifdef VERIFY_HEAP | 4825 #ifdef VERIFY_HEAP |
4812 void Heap::Verify() { | 4826 void Heap::Verify() { |
4813 CHECK(HasBeenSetUp()); | 4827 CHECK(HasBeenSetUp()); |
4814 HandleScope scope(isolate()); | 4828 HandleScope scope(isolate()); |
4815 | 4829 |
4816 store_buffer()->Verify(); | 4830 store_buffer()->Verify(); |
4817 | 4831 |
4818 if (mark_compact_collector()->sweeping_in_progress()) { | 4832 if (mark_compact_collector()->sweeping_in_progress()) { |
4819 // We have to wait here for the sweeper threads to have an iterable heap. | 4833 // We have to wait here for the sweeper threads to have an iterable heap. |
4820 mark_compact_collector()->EnsureSweepingCompleted(); | 4834 mark_compact_collector()->EnsureSweepingCompleted(); |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6309 static_cast<int>(object_sizes_last_time_[index])); | 6323 static_cast<int>(object_sizes_last_time_[index])); |
6310 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6324 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6311 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6325 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6312 | 6326 |
6313 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6327 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6314 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6328 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6315 ClearObjectStats(); | 6329 ClearObjectStats(); |
6316 } | 6330 } |
6317 } | 6331 } |
6318 } // namespace v8::internal | 6332 } // namespace v8::internal |
OLD | NEW |