| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 MemoryChunk* chunk, | 163 MemoryChunk* chunk, |
| 164 Executability executable, | 164 Executability executable, |
| 165 PagedSpace* owner) { | 165 PagedSpace* owner) { |
| 166 Page* page = reinterpret_cast<Page*>(chunk); | 166 Page* page = reinterpret_cast<Page*>(chunk); |
| 167 ASSERT(chunk->size() == static_cast<size_t>(kPageSize)); | 167 ASSERT(chunk->size() == static_cast<size_t>(kPageSize)); |
| 168 ASSERT(chunk->owner() == owner); | 168 ASSERT(chunk->owner() == owner); |
| 169 owner->IncreaseCapacity(Page::kObjectAreaSize); | 169 owner->IncreaseCapacity(Page::kObjectAreaSize); |
| 170 owner->Free(page->ObjectAreaStart(), | 170 owner->Free(page->ObjectAreaStart(), |
| 171 static_cast<int>(page->ObjectAreaEnd() - | 171 static_cast<int>(page->ObjectAreaEnd() - |
| 172 page->ObjectAreaStart())); | 172 page->ObjectAreaStart())); |
| 173 for (HeapVisualizer* vis = heap->visualizer(); |
| 174 vis != NULL; |
| 175 vis = vis->next()) { |
| 176 vis->Name(v8::HeapVisualizer::kHeapOverheadPseudoSpaceIdentity, |
| 177 reinterpret_cast<uintptr_t>(page->address()), |
| 178 page->ObjectAreaStart() - page->address()); |
| 179 vis->ConstantAllocation(reinterpret_cast<uintptr_t>(page->address()), |
| 180 page->ObjectAreaStart() - page->address(), |
| 181 0); |
| 182 } |
| 173 | 183 |
| 174 heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 184 heap->incremental_marking()->SetOldSpacePageFlags(chunk); |
| 175 | 185 |
| 176 return page; | 186 return page; |
| 177 } | 187 } |
| 178 | 188 |
| 179 | 189 |
| 180 bool PagedSpace::Contains(Address addr) { | 190 bool PagedSpace::Contains(Address addr) { |
| 181 Page* p = Page::FromAddress(addr); | 191 Page* p = Page::FromAddress(addr); |
| 182 if (!p->is_valid()) return false; | 192 if (!p->is_valid()) return false; |
| 183 return p->owner() == this; | 193 return p->owner() == this; |
| 184 } | 194 } |
| 185 | 195 |
| 186 | 196 |
| 197 void PagedSpace::SetTop(Address top, Address limit) { |
| 198 if (heap()->has_visualizer()) { |
| 199 VisualizeTopChange(top); |
| 200 } |
| 201 ASSERT(top == limit || |
| 202 Page::FromAddress(top) == Page::FromAddress(limit - 1)); |
| 203 allocation_info_.top = top; |
| 204 allocation_info_.limit = limit; |
| 205 } |
| 206 |
| 207 |
| 187 void MemoryChunk::set_scan_on_scavenge(bool scan) { | 208 void MemoryChunk::set_scan_on_scavenge(bool scan) { |
| 188 if (scan) { | 209 if (scan) { |
| 189 if (!scan_on_scavenge()) heap_->increment_scan_on_scavenge_pages(); | 210 if (!scan_on_scavenge()) heap_->increment_scan_on_scavenge_pages(); |
| 190 SetFlag(SCAN_ON_SCAVENGE); | 211 SetFlag(SCAN_ON_SCAVENGE); |
| 191 } else { | 212 } else { |
| 192 if (scan_on_scavenge()) heap_->decrement_scan_on_scavenge_pages(); | 213 if (scan_on_scavenge()) heap_->decrement_scan_on_scavenge_pages(); |
| 193 ClearFlag(SCAN_ON_SCAVENGE); | 214 ClearFlag(SCAN_ON_SCAVENGE); |
| 194 } | 215 } |
| 195 heap_->incremental_marking()->SetOldSpacePageFlags(this); | 216 heap_->incremental_marking()->SetOldSpacePageFlags(this); |
| 196 } | 217 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 Map* map = object->map(); | 384 Map* map = object->map(); |
| 364 Heap* heap = object->GetHeap(); | 385 Heap* heap = object->GetHeap(); |
| 365 return map == heap->raw_unchecked_free_space_map() | 386 return map == heap->raw_unchecked_free_space_map() |
| 366 || map == heap->raw_unchecked_one_pointer_filler_map() | 387 || map == heap->raw_unchecked_one_pointer_filler_map() |
| 367 || map == heap->raw_unchecked_two_pointer_filler_map(); | 388 || map == heap->raw_unchecked_two_pointer_filler_map(); |
| 368 } | 389 } |
| 369 | 390 |
| 370 } } // namespace v8::internal | 391 } } // namespace v8::internal |
| 371 | 392 |
| 372 #endif // V8_SPACES_INL_H_ | 393 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |