| 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 | |
| 24 // You can't actually iterate over the anchor page. It is not a real page, | 21 // You can't actually iterate over the anchor page. It is not a real page, |
| 25 // just an anchor for the double linked page list. Initialize as if we have | 22 // just an anchor for the double linked page list. Initialize as if we have |
| 26 // reached the end of the anchor page, then the first iteration will move on | 23 // reached the end of the anchor page, then the first iteration will move on |
| 27 // to the first page. | 24 // to the first page. |
| 28 Initialize(space, | 25 Initialize(space, |
| 29 NULL, | 26 NULL, |
| 30 NULL, | 27 NULL, |
| 31 kAllPagesInSpace, | 28 kAllPagesInSpace, |
| 32 NULL); | 29 NULL); |
| 33 } | 30 } |
| 34 | 31 |
| 35 | 32 |
| 36 HeapObjectIterator::HeapObjectIterator(PagedSpace* space, | 33 HeapObjectIterator::HeapObjectIterator(PagedSpace* space, |
| 37 HeapObjectCallback size_func) { | 34 HeapObjectCallback size_func) { |
| 38 // Check that we actually can iterate this space. | |
| 39 ASSERT(space->is_iterable()); | |
| 40 | |
| 41 // You can't actually iterate over the anchor page. It is not a real page, | 35 // You can't actually iterate over the anchor page. It is not a real page, |
| 42 // just an anchor for the double linked page list. Initialize the current | 36 // just an anchor for the double linked page list. Initialize the current |
| 43 // address and end as NULL, then the first iteration will move on | 37 // address and end as NULL, then the first iteration will move on |
| 44 // to the first page. | 38 // to the first page. |
| 45 Initialize(space, | 39 Initialize(space, |
| 46 NULL, | 40 NULL, |
| 47 NULL, | 41 NULL, |
| 48 kAllPagesInSpace, | 42 kAllPagesInSpace, |
| 49 size_func); | 43 size_func); |
| 50 } | 44 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 65 kOnePageOnly, | 59 kOnePageOnly, |
| 66 size_func); | 60 size_func); |
| 67 ASSERT(page->WasSweptPrecisely()); | 61 ASSERT(page->WasSweptPrecisely()); |
| 68 } | 62 } |
| 69 | 63 |
| 70 | 64 |
| 71 void HeapObjectIterator::Initialize(PagedSpace* space, | 65 void HeapObjectIterator::Initialize(PagedSpace* space, |
| 72 Address cur, Address end, | 66 Address cur, Address end, |
| 73 HeapObjectIterator::PageMode mode, | 67 HeapObjectIterator::PageMode mode, |
| 74 HeapObjectCallback size_f) { | 68 HeapObjectCallback size_f) { |
| 69 // Check that we actually can iterate this space. |
| 70 ASSERT(space->is_iterable()); |
| 71 |
| 75 space_ = space; | 72 space_ = space; |
| 76 cur_addr_ = cur; | 73 cur_addr_ = cur; |
| 77 cur_end_ = end; | 74 cur_end_ = end; |
| 78 page_mode_ = mode; | 75 page_mode_ = mode; |
| 79 size_func_ = size_f; | 76 size_func_ = size_f; |
| 80 } | 77 } |
| 81 | 78 |
| 82 | 79 |
| 83 // We have hit the end of the page and should advance to the next block of | 80 // We have hit the end of the page and should advance to the next block of |
| 84 // objects. This happens at the end of the page. | 81 // objects. This happens at the end of the page. |
| (...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 object->ShortPrint(); | 3149 object->ShortPrint(); |
| 3153 PrintF("\n"); | 3150 PrintF("\n"); |
| 3154 } | 3151 } |
| 3155 printf(" --------------------------------------\n"); | 3152 printf(" --------------------------------------\n"); |
| 3156 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3153 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3157 } | 3154 } |
| 3158 | 3155 |
| 3159 #endif // DEBUG | 3156 #endif // DEBUG |
| 3160 | 3157 |
| 3161 } } // namespace v8::internal | 3158 } } // namespace v8::internal |
| OLD | NEW |