Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: src/spaces-inl.h

Issue 7149016: Multi-page growing and shrinking new-space (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Address review comments Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 prev_page_ = next_page_; 56 prev_page_ = next_page_;
57 next_page_ = next_page_->next_page(); 57 next_page_ = next_page_->next_page();
58 return prev_page_; 58 return prev_page_;
59 } 59 }
60 60
61 61
62 // ----------------------------------------------------------------------------- 62 // -----------------------------------------------------------------------------
63 // NewSpacePageIterator 63 // NewSpacePageIterator
64 64
65 65
66 NewSpacePageIterator::NewSpacePageIterator(NewSpace* space)
67 : prev_page_(NewSpacePage::FromAddress(space->ToSpaceLow())->prev_page()),
68 next_page_(NewSpacePage::FromAddress(space->ToSpaceLow())),
69 last_page_(NewSpacePage::FromLimit(space->ToSpaceHigh())) { }
70
66 NewSpacePageIterator::NewSpacePageIterator(SemiSpace* space) 71 NewSpacePageIterator::NewSpacePageIterator(SemiSpace* space)
67 : prev_page_(&space->anchor_), 72 : prev_page_(space->anchor()),
68 next_page_(prev_page_->next_page()), 73 next_page_(prev_page_->next_page()),
69 last_page_(prev_page_->prev_page()) { } 74 last_page_(prev_page_->prev_page()) { }
70 75
71 NewSpacePageIterator::NewSpacePageIterator(Address start, Address limit) 76 NewSpacePageIterator::NewSpacePageIterator(Address start, Address limit)
72 : prev_page_(NewSpacePage::FromAddress(start)->prev_page()), 77 : prev_page_(NewSpacePage::FromAddress(start)->prev_page()),
73 next_page_(NewSpacePage::FromAddress(start)), 78 next_page_(NewSpacePage::FromAddress(start)),
74 last_page_(NewSpacePage::FromLimit(limit)) { 79 last_page_(NewSpacePage::FromLimit(limit)) {
75 #ifdef DEBUG 80 SemiSpace::AssertValidRange(start, limit);
76 SemiSpace::ValidateRange(start, limit);
77 #endif
78 } 81 }
79 82
80 83
81 bool NewSpacePageIterator::has_next() { 84 bool NewSpacePageIterator::has_next() {
82 return prev_page_ != last_page_; 85 return prev_page_ != last_page_;
83 } 86 }
84 87
85 88
86 NewSpacePage* NewSpacePageIterator::next() { 89 NewSpacePage* NewSpacePageIterator::next() {
87 ASSERT(has_next()); 90 ASSERT(has_next());
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 282
280 // ----------------------------------------------------------------------------- 283 // -----------------------------------------------------------------------------
281 // NewSpace 284 // NewSpace
282 285
283 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes) { 286 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes) {
284 Address old_top = allocation_info_.top; 287 Address old_top = allocation_info_.top;
285 Address new_top = old_top + size_in_bytes; 288 Address new_top = old_top + size_in_bytes;
286 if (new_top > allocation_info_.limit) { 289 if (new_top > allocation_info_.limit) {
287 Address high = to_space_.page_high(); 290 Address high = to_space_.page_high();
288 if (allocation_info_.limit < high) { 291 if (allocation_info_.limit < high) {
292 // Incremental marking has lowered the limit to get a
293 // chance to do a step.
289 allocation_info_.limit = Min( 294 allocation_info_.limit = Min(
290 allocation_info_.limit + inline_alloction_limit_step_, 295 allocation_info_.limit + inline_allocation_limit_step_,
291 high); 296 high);
292 int bytes_allocated = new_top - top_on_previous_step_; 297 int bytes_allocated = new_top - top_on_previous_step_;
293 heap()->incremental_marking()->Step(bytes_allocated); 298 heap()->incremental_marking()->Step(bytes_allocated);
294 top_on_previous_step_ = new_top; 299 top_on_previous_step_ = new_top;
295 return AllocateRawInternal(size_in_bytes); 300 return AllocateRawInternal(size_in_bytes);
296 } else if (AddFreshPage()) { 301 } else if (AddFreshPage()) {
297 // Switched to new page. Try allocating again. 302 // Switched to new page. Try allocating again.
298 int bytes_allocated = old_top - top_on_previous_step_; 303 int bytes_allocated = old_top - top_on_previous_step_;
299 heap()->incremental_marking()->Step(bytes_allocated); 304 heap()->incremental_marking()->Step(bytes_allocated);
300 top_on_previous_step_ = to_space_.page_low(); 305 top_on_previous_step_ = to_space_.page_low();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 bool FreeListNode::IsFreeListNode(HeapObject* object) { 343 bool FreeListNode::IsFreeListNode(HeapObject* object) {
339 // TODO(gc) ISOLATES MERGE 344 // TODO(gc) ISOLATES MERGE
340 return object->map() == HEAP->raw_unchecked_free_space_map() 345 return object->map() == HEAP->raw_unchecked_free_space_map()
341 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() 346 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map()
342 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); 347 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map();
343 } 348 }
344 349
345 } } // namespace v8::internal 350 } } // namespace v8::internal
346 351
347 #endif // V8_SPACES_INL_H_ 352 #endif // V8_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698