| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/base/platform/platform.h" | 7 #include "src/base/platform/platform.h" |
| 8 #include "src/full-codegen.h" | 8 #include "src/full-codegen.h" |
| 9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
| 10 #include "src/mark-compact.h" | 10 #include "src/mark-compact.h" |
| 11 #include "src/msan.h" | 11 #include "src/msan.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 | 16 |
| 17 // ---------------------------------------------------------------------------- | 17 // ---------------------------------------------------------------------------- |
| 18 // HeapObjectIterator | 18 // HeapObjectIterator |
| 19 | 19 |
| 20 HeapObjectIterator::HeapObjectIterator(PagedSpace* space) { | 20 HeapObjectIterator::HeapObjectIterator(PagedSpace* space) { |
| 21 // Check that we actually can iterate this space. |
| 22 ASSERT(space->is_iterable()); |
| 23 |
| 21 // You can't actually iterate over the anchor page. It is not a real page, | 24 // You can't actually iterate over the anchor page. It is not a real page, |
| 22 // just an anchor for the double linked page list. Initialize as if we have | 25 // just an anchor for the double linked page list. Initialize as if we have |
| 23 // reached the end of the anchor page, then the first iteration will move on | 26 // reached the end of the anchor page, then the first iteration will move on |
| 24 // to the first page. | 27 // to the first page. |
| 25 Initialize(space, | 28 Initialize(space, |
| 26 NULL, | 29 NULL, |
| 27 NULL, | 30 NULL, |
| 28 kAllPagesInSpace, | 31 kAllPagesInSpace, |
| 29 NULL); | 32 NULL); |
| 30 } | 33 } |
| 31 | 34 |
| 32 | 35 |
| 33 HeapObjectIterator::HeapObjectIterator(PagedSpace* space, | 36 HeapObjectIterator::HeapObjectIterator(PagedSpace* space, |
| 34 HeapObjectCallback size_func) { | 37 HeapObjectCallback size_func) { |
| 38 // Check that we actually can iterate this space. |
| 39 ASSERT(space->is_iterable()); |
| 40 |
| 35 // You can't actually iterate over the anchor page. It is not a real page, | 41 // You can't actually iterate over the anchor page. It is not a real page, |
| 36 // just an anchor for the double linked page list. Initialize the current | 42 // just an anchor for the double linked page list. Initialize the current |
| 37 // address and end as NULL, then the first iteration will move on | 43 // address and end as NULL, then the first iteration will move on |
| 38 // to the first page. | 44 // to the first page. |
| 39 Initialize(space, | 45 Initialize(space, |
| 40 NULL, | 46 NULL, |
| 41 NULL, | 47 NULL, |
| 42 kAllPagesInSpace, | 48 kAllPagesInSpace, |
| 43 size_func); | 49 size_func); |
| 44 } | 50 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 kOnePageOnly, | 65 kOnePageOnly, |
| 60 size_func); | 66 size_func); |
| 61 ASSERT(page->WasSweptPrecisely()); | 67 ASSERT(page->WasSweptPrecisely()); |
| 62 } | 68 } |
| 63 | 69 |
| 64 | 70 |
| 65 void HeapObjectIterator::Initialize(PagedSpace* space, | 71 void HeapObjectIterator::Initialize(PagedSpace* space, |
| 66 Address cur, Address end, | 72 Address cur, Address end, |
| 67 HeapObjectIterator::PageMode mode, | 73 HeapObjectIterator::PageMode mode, |
| 68 HeapObjectCallback size_f) { | 74 HeapObjectCallback size_f) { |
| 69 // Check that we actually can iterate this space. | |
| 70 ASSERT(space->is_iterable()); | |
| 71 | |
| 72 space_ = space; | 75 space_ = space; |
| 73 cur_addr_ = cur; | 76 cur_addr_ = cur; |
| 74 cur_end_ = end; | 77 cur_end_ = end; |
| 75 page_mode_ = mode; | 78 page_mode_ = mode; |
| 76 size_func_ = size_f; | 79 size_func_ = size_f; |
| 77 } | 80 } |
| 78 | 81 |
| 79 | 82 |
| 80 // We have hit the end of the page and should advance to the next block of | 83 // We have hit the end of the page and should advance to the next block of |
| 81 // objects. This happens at the end of the page. | 84 // objects. This happens at the end of the page. |
| (...skipping 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3138 object->ShortPrint(); | 3141 object->ShortPrint(); |
| 3139 PrintF("\n"); | 3142 PrintF("\n"); |
| 3140 } | 3143 } |
| 3141 printf(" --------------------------------------\n"); | 3144 printf(" --------------------------------------\n"); |
| 3142 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3145 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3143 } | 3146 } |
| 3144 | 3147 |
| 3145 #endif // DEBUG | 3148 #endif // DEBUG |
| 3146 | 3149 |
| 3147 } } // namespace v8::internal | 3150 } } // namespace v8::internal |
| OLD | NEW |