| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // ----------------------------------------------------------------------------- | 62 // ----------------------------------------------------------------------------- |
| 63 // NewSpacePageIterator | 63 // NewSpacePageIterator |
| 64 | 64 |
| 65 | 65 |
| 66 NewSpacePageIterator::NewSpacePageIterator(SemiSpace* space) | 66 NewSpacePageIterator::NewSpacePageIterator(SemiSpace* space) |
| 67 : prev_page_(&space->anchor_), | 67 : prev_page_(&space->anchor_), |
| 68 next_page_(prev_page_->next_page()), | 68 next_page_(prev_page_->next_page()), |
| 69 last_page_(prev_page_->prev_page()) { } | 69 last_page_(prev_page_->prev_page()) { } |
| 70 | 70 |
| 71 NewSpacePageIterator::NewSpacePageIterator(Address start, Address limit) | 71 NewSpacePageIterator::NewSpacePageIterator(Address start, Address limit) |
| 72 : prev_page_(NewSpacePage::FromAddress(start)->prev_page()), | 72 : prev_page_(NewSpacePage::FromAddress(start)->prev_page()), |
| 73 next_page_(NewSpacePage::FromAddress(start)), | 73 next_page_(NewSpacePage::FromAddress(start)), |
| 74 last_page_(NewSpacePage::FromLimit(limit)) { | 74 last_page_(NewSpacePage::FromLimit(limit)) { |
| 75 #ifdef DEBUG | 75 SemiSpace::AssertValidRange(start, limit); |
| 76 SemiSpace::ValidateRange(start, limit); | |
| 77 #endif | |
| 78 } | 76 } |
| 79 | 77 |
| 80 | 78 |
| 81 bool NewSpacePageIterator::has_next() { | 79 bool NewSpacePageIterator::has_next() { |
| 82 return prev_page_ != last_page_; | 80 return prev_page_ != last_page_; |
| 83 } | 81 } |
| 84 | 82 |
| 85 | 83 |
| 86 NewSpacePage* NewSpacePageIterator::next() { | 84 NewSpacePage* NewSpacePageIterator::next() { |
| 87 ASSERT(has_next()); | 85 ASSERT(has_next()); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 277 |
| 280 // ----------------------------------------------------------------------------- | 278 // ----------------------------------------------------------------------------- |
| 281 // NewSpace | 279 // NewSpace |
| 282 | 280 |
| 283 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes) { | 281 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes) { |
| 284 Address old_top = allocation_info_.top; | 282 Address old_top = allocation_info_.top; |
| 285 Address new_top = old_top + size_in_bytes; | 283 Address new_top = old_top + size_in_bytes; |
| 286 if (new_top > allocation_info_.limit) { | 284 if (new_top > allocation_info_.limit) { |
| 287 Address high = to_space_.page_high(); | 285 Address high = to_space_.page_high(); |
| 288 if (allocation_info_.limit < high) { | 286 if (allocation_info_.limit < high) { |
| 287 // Incremental marking has lowered the limit to get a |
| 288 // chance to do a step. |
| 289 allocation_info_.limit = Min( | 289 allocation_info_.limit = Min( |
| 290 allocation_info_.limit + inline_alloction_limit_step_, | 290 allocation_info_.limit + inline_allocation_limit_step_, |
| 291 high); | 291 high); |
| 292 int bytes_allocated = new_top - top_on_previous_step_; | 292 int bytes_allocated = new_top - top_on_previous_step_; |
| 293 heap()->incremental_marking()->Step(bytes_allocated); | 293 heap()->incremental_marking()->Step(bytes_allocated); |
| 294 top_on_previous_step_ = new_top; | 294 top_on_previous_step_ = new_top; |
| 295 return AllocateRawInternal(size_in_bytes); | 295 return AllocateRawInternal(size_in_bytes); |
| 296 } else if (AddFreshPage()) { | 296 } else if (AddFreshPage()) { |
| 297 // Switched to new page. Try allocating again. | 297 // Switched to new page. Try allocating again. |
| 298 int bytes_allocated = old_top - top_on_previous_step_; | 298 int bytes_allocated = old_top - top_on_previous_step_; |
| 299 heap()->incremental_marking()->Step(bytes_allocated); | 299 heap()->incremental_marking()->Step(bytes_allocated); |
| 300 top_on_previous_step_ = to_space_.page_low(); | 300 top_on_previous_step_ = to_space_.page_low(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 338 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
| 339 // TODO(gc) ISOLATES MERGE | 339 // TODO(gc) ISOLATES MERGE |
| 340 return object->map() == HEAP->raw_unchecked_free_space_map() | 340 return object->map() == HEAP->raw_unchecked_free_space_map() |
| 341 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() | 341 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() |
| 342 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); | 342 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } } // namespace v8::internal | 345 } } // namespace v8::internal |
| 346 | 346 |
| 347 #endif // V8_SPACES_INL_H_ | 347 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |