| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 kOnePageOnly, | 80 kOnePageOnly, |
| 81 size_func); | 81 size_func); |
| 82 ASSERT(!page->IsFlagSet(Page::WAS_SWEPT_CONSERVATIVELY)); | 82 ASSERT(!page->IsFlagSet(Page::WAS_SWEPT_CONSERVATIVELY)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 void HeapObjectIterator::Initialize(PagedSpace* space, | 86 void HeapObjectIterator::Initialize(PagedSpace* space, |
| 87 Address cur, Address end, | 87 Address cur, Address end, |
| 88 HeapObjectIterator::PageMode mode, | 88 HeapObjectIterator::PageMode mode, |
| 89 HeapObjectCallback size_f) { | 89 HeapObjectCallback size_f) { |
| 90 // Check that we actually can iterate this space. |
| 91 ASSERT(!space->was_swept_conservatively()); |
| 92 |
| 90 space_ = space; | 93 space_ = space; |
| 91 cur_addr_ = cur; | 94 cur_addr_ = cur; |
| 92 cur_end_ = end; | 95 cur_end_ = end; |
| 93 page_mode_ = mode; | 96 page_mode_ = mode; |
| 94 size_func_ = size_f; | 97 size_func_ = size_f; |
| 95 | 98 |
| 96 #ifdef DEBUG | 99 #ifdef DEBUG |
| 97 Verify(); | 100 Verify(); |
| 98 #endif | 101 #endif |
| 99 } | 102 } |
| 100 | 103 |
| 101 | 104 |
| 102 // We have hit the end of the page and should advance to the next block of | 105 // We have hit the end of the page and should advance to the next block of |
| 103 // objects. This happens at the end of the page. | 106 // objects. This happens at the end of the page. |
| 104 bool HeapObjectIterator::AdvanceToNextPage() { | 107 bool HeapObjectIterator::AdvanceToNextPage() { |
| 105 ASSERT(cur_addr_ == cur_end_); | 108 ASSERT(cur_addr_ == cur_end_); |
| 106 if (page_mode_ == kOnePageOnly) return false; | 109 if (page_mode_ == kOnePageOnly) return false; |
| 107 Page* cur_page; | 110 Page* cur_page; |
| 108 if (cur_addr_ == NULL) { | 111 if (cur_addr_ == NULL) { |
| 109 cur_page = space_->anchor(); | 112 cur_page = space_->anchor(); |
| 110 } else { | 113 } else { |
| 111 cur_page = Page::FromAddress(cur_addr_ - 1); | 114 cur_page = Page::FromAddress(cur_addr_ - 1); |
| 112 ASSERT(cur_addr_ == cur_page->ObjectAreaEnd()); | 115 ASSERT(cur_addr_ == cur_page->ObjectAreaEnd()); |
| 113 } | 116 } |
| 114 cur_page = cur_page->next_page(); | 117 cur_page = cur_page->next_page(); |
| 115 if (cur_page == space_->anchor()) return false; | 118 if (cur_page == space_->anchor()) return false; |
| 116 cur_addr_ = cur_page->ObjectAreaStart(); | 119 cur_addr_ = cur_page->ObjectAreaStart(); |
| 117 cur_end_ = cur_page->ObjectAreaEnd(); | 120 cur_end_ = cur_page->ObjectAreaEnd(); |
| 118 ASSERT(!cur_page->IsFlagSet(Page::WAS_SWEPT_CONSERVATIVELY)); | 121 ASSERT(!cur_page->IsFlagSet(Page::WAS_SWEPT_CONSERVATIVELY)); |
| 119 ASSERT(IncrementalMarking::state() == IncrementalMarking::STOPPED); | |
| 120 return true; | 122 return true; |
| 121 } | 123 } |
| 122 | 124 |
| 123 | 125 |
| 124 #ifdef DEBUG | 126 #ifdef DEBUG |
| 125 void HeapObjectIterator::Verify() { | 127 void HeapObjectIterator::Verify() { |
| 126 // TODO(gc): We should do something here. | 128 // TODO(gc): We should do something here. |
| 127 } | 129 } |
| 128 #endif | 130 #endif |
| 129 | 131 |
| (...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2115 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { | 2117 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { |
| 2116 if (obj->IsCode()) { | 2118 if (obj->IsCode()) { |
| 2117 Code* code = Code::cast(obj); | 2119 Code* code = Code::cast(obj); |
| 2118 code_kind_statistics[code->kind()] += code->Size(); | 2120 code_kind_statistics[code->kind()] += code->Size(); |
| 2119 } | 2121 } |
| 2120 } | 2122 } |
| 2121 } | 2123 } |
| 2122 #endif // DEBUG | 2124 #endif // DEBUG |
| 2123 | 2125 |
| 2124 } } // namespace v8::internal | 2126 } } // namespace v8::internal |
| OLD | NEW |