| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // PagedSpace | 161 // PagedSpace |
| 162 Page* Page::Initialize(Heap* heap, | 162 Page* Page::Initialize(Heap* heap, |
| 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 page->ObjectAreaEnd() - page->ObjectAreaStart()); | 171 static_cast<int>(page->ObjectAreaEnd() - |
| 172 page->ObjectAreaStart())); |
| 172 | 173 |
| 173 heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 174 heap->incremental_marking()->SetOldSpacePageFlags(chunk); |
| 174 | 175 |
| 175 return page; | 176 return page; |
| 176 } | 177 } |
| 177 | 178 |
| 178 | 179 |
| 179 bool PagedSpace::Contains(Address addr) { | 180 bool PagedSpace::Contains(Address addr) { |
| 180 Page* p = Page::FromAddress(addr); | 181 Page* p = Page::FromAddress(addr); |
| 181 if (!p->is_valid()) return false; | 182 if (!p->is_valid()) return false; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 Address old_top = allocation_info_.top; | 295 Address old_top = allocation_info_.top; |
| 295 if (allocation_info_.limit - old_top < size_in_bytes) { | 296 if (allocation_info_.limit - old_top < size_in_bytes) { |
| 296 Address new_top = old_top + size_in_bytes; | 297 Address new_top = old_top + size_in_bytes; |
| 297 Address high = to_space_.page_high(); | 298 Address high = to_space_.page_high(); |
| 298 if (allocation_info_.limit < high) { | 299 if (allocation_info_.limit < high) { |
| 299 // Incremental marking has lowered the limit to get a | 300 // Incremental marking has lowered the limit to get a |
| 300 // chance to do a step. | 301 // chance to do a step. |
| 301 allocation_info_.limit = Min( | 302 allocation_info_.limit = Min( |
| 302 allocation_info_.limit + inline_allocation_limit_step_, | 303 allocation_info_.limit + inline_allocation_limit_step_, |
| 303 high); | 304 high); |
| 304 int bytes_allocated = new_top - top_on_previous_step_; | 305 int bytes_allocated = static_cast<int>(new_top - top_on_previous_step_); |
| 305 heap()->incremental_marking()->Step(bytes_allocated); | 306 heap()->incremental_marking()->Step(bytes_allocated); |
| 306 top_on_previous_step_ = new_top; | 307 top_on_previous_step_ = new_top; |
| 307 return AllocateRawInternal(size_in_bytes); | 308 return AllocateRawInternal(size_in_bytes); |
| 308 } else if (AddFreshPage()) { | 309 } else if (AddFreshPage()) { |
| 309 // Switched to new page. Try allocating again. | 310 // Switched to new page. Try allocating again. |
| 310 int bytes_allocated = old_top - top_on_previous_step_; | 311 int bytes_allocated = static_cast<int>(old_top - top_on_previous_step_); |
| 311 heap()->incremental_marking()->Step(bytes_allocated); | 312 heap()->incremental_marking()->Step(bytes_allocated); |
| 312 top_on_previous_step_ = to_space_.page_low(); | 313 top_on_previous_step_ = to_space_.page_low(); |
| 313 return AllocateRawInternal(size_in_bytes); | 314 return AllocateRawInternal(size_in_bytes); |
| 314 } else { | 315 } else { |
| 315 return Failure::RetryAfterGC(); | 316 return Failure::RetryAfterGC(); |
| 316 } | 317 } |
| 317 } | 318 } |
| 318 | 319 |
| 319 Object* obj = HeapObject::FromAddress(allocation_info_.top); | 320 Object* obj = HeapObject::FromAddress(allocation_info_.top); |
| 320 allocation_info_.top += size_in_bytes; | 321 allocation_info_.top += size_in_bytes; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 356 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
| 356 // TODO(gc) ISOLATES MERGE | 357 // TODO(gc) ISOLATES MERGE |
| 357 return object->map() == HEAP->raw_unchecked_free_space_map() | 358 return object->map() == HEAP->raw_unchecked_free_space_map() |
| 358 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() | 359 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() |
| 359 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); | 360 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); |
| 360 } | 361 } |
| 361 | 362 |
| 362 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| 363 | 364 |
| 364 #endif // V8_SPACES_INL_H_ | 365 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |