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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 90 // Check that we actually can iterate this space. |
91 ASSERT(!space->was_swept_conservatively()); | 91 ASSERT(!space->was_swept_conservatively()); |
92 | 92 |
93 space_ = space; | 93 space_ = space; |
94 cur_addr_ = cur; | 94 cur_addr_ = cur; |
95 cur_end_ = end; | 95 cur_end_ = end; |
96 page_mode_ = mode; | 96 page_mode_ = mode; |
97 size_func_ = size_f; | 97 size_func_ = size_f; |
98 | |
99 #ifdef DEBUG | |
100 Verify(); | |
101 #endif | |
102 } | 98 } |
103 | 99 |
104 | 100 |
105 // We have hit the end of the page and should advance to the next block of | 101 // We have hit the end of the page and should advance to the next block of |
106 // objects. This happens at the end of the page. | 102 // objects. This happens at the end of the page. |
107 bool HeapObjectIterator::AdvanceToNextPage() { | 103 bool HeapObjectIterator::AdvanceToNextPage() { |
108 ASSERT(cur_addr_ == cur_end_); | 104 ASSERT(cur_addr_ == cur_end_); |
109 if (page_mode_ == kOnePageOnly) return false; | 105 if (page_mode_ == kOnePageOnly) return false; |
110 Page* cur_page; | 106 Page* cur_page; |
111 if (cur_addr_ == NULL) { | 107 if (cur_addr_ == NULL) { |
112 cur_page = space_->anchor(); | 108 cur_page = space_->anchor(); |
113 } else { | 109 } else { |
114 cur_page = Page::FromAddress(cur_addr_ - 1); | 110 cur_page = Page::FromAddress(cur_addr_ - 1); |
115 ASSERT(cur_addr_ == cur_page->ObjectAreaEnd()); | 111 ASSERT(cur_addr_ == cur_page->ObjectAreaEnd()); |
116 } | 112 } |
117 cur_page = cur_page->next_page(); | 113 cur_page = cur_page->next_page(); |
118 if (cur_page == space_->anchor()) return false; | 114 if (cur_page == space_->anchor()) return false; |
119 cur_addr_ = cur_page->ObjectAreaStart(); | 115 cur_addr_ = cur_page->ObjectAreaStart(); |
120 cur_end_ = cur_page->ObjectAreaEnd(); | 116 cur_end_ = cur_page->ObjectAreaEnd(); |
121 ASSERT(cur_page->WasSweptPrecisely()); | 117 ASSERT(cur_page->WasSweptPrecisely()); |
122 return true; | 118 return true; |
123 } | 119 } |
124 | 120 |
125 | 121 |
126 #ifdef DEBUG | |
127 void HeapObjectIterator::Verify() { | |
128 // TODO(gc): We should do something here. | |
129 } | |
130 #endif | |
131 | |
132 | |
133 // ----------------------------------------------------------------------------- | 122 // ----------------------------------------------------------------------------- |
134 // CodeRange | 123 // CodeRange |
135 | 124 |
136 | 125 |
137 CodeRange::CodeRange(Isolate* isolate) | 126 CodeRange::CodeRange(Isolate* isolate) |
138 : isolate_(isolate), | 127 : isolate_(isolate), |
139 code_range_(NULL), | 128 code_range_(NULL), |
140 free_list_(0), | 129 free_list_(0), |
141 allocation_list_(0), | 130 allocation_list_(0), |
142 current_allocation_block_index_(0) { | 131 current_allocation_block_index_(0) { |
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 object->ShortPrint(); | 2532 object->ShortPrint(); |
2544 PrintF("\n"); | 2533 PrintF("\n"); |
2545 } | 2534 } |
2546 printf(" --------------------------------------\n"); | 2535 printf(" --------------------------------------\n"); |
2547 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2536 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
2548 } | 2537 } |
2549 | 2538 |
2550 #endif // DEBUG | 2539 #endif // DEBUG |
2551 | 2540 |
2552 } } // namespace v8::internal | 2541 } } // namespace v8::internal |
OLD | NEW |