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

Side by Side Diff: src/spaces.cc

Issue 9086005: When shrinking semispace don't relink pages if semispace is not committed (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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 | « no previous file | 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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 ASSERT((new_capacity & Page::kPageAlignmentMask) == 0); 1256 ASSERT((new_capacity & Page::kPageAlignmentMask) == 0);
1257 ASSERT(new_capacity >= initial_capacity_); 1257 ASSERT(new_capacity >= initial_capacity_);
1258 ASSERT(new_capacity < capacity_); 1258 ASSERT(new_capacity < capacity_);
1259 // Semispaces grow backwards from the end of their allocated capacity, 1259 // Semispaces grow backwards from the end of their allocated capacity,
1260 // so we find the before and after start addresses relative to the 1260 // so we find the before and after start addresses relative to the
1261 // end of the space. 1261 // end of the space.
1262 Address space_end = start_ + maximum_capacity_; 1262 Address space_end = start_ + maximum_capacity_;
1263 Address old_start = space_end - capacity_; 1263 Address old_start = space_end - capacity_;
1264 size_t delta = capacity_ - new_capacity; 1264 size_t delta = capacity_ - new_capacity;
1265 ASSERT(IsAligned(delta, OS::AllocateAlignment())); 1265 ASSERT(IsAligned(delta, OS::AllocateAlignment()));
1266 if (!heap()->isolate()->memory_allocator()->UncommitBlock(old_start, delta)) { 1266 if (is_committed() &&
1267 !heap()->isolate()->memory_allocator()->UncommitBlock(old_start, delta)) {
1267 return false; 1268 return false;
1268 } 1269 }
1269 capacity_ = new_capacity; 1270 capacity_ = new_capacity;
1270 1271
1272 if (!is_committed()) {
Michael Starzinger 2012/01/04 14:38:28 Can we invert the condition and place the block be
Sven Panne 2012/01/04 14:46:54 Drive-by comment: I *do* like guard clauses, they
1273 return true;
1274 }
1275
1271 int pages_after = capacity_ / Page::kPageSize; 1276 int pages_after = capacity_ / Page::kPageSize;
1272 NewSpacePage* new_last_page = 1277 NewSpacePage* new_last_page =
1273 NewSpacePage::FromAddress(space_end - pages_after * Page::kPageSize); 1278 NewSpacePage::FromAddress(space_end - pages_after * Page::kPageSize);
1274 new_last_page->set_next_page(anchor()); 1279 new_last_page->set_next_page(anchor());
1275 anchor()->set_prev_page(new_last_page); 1280 anchor()->set_prev_page(new_last_page);
1276 ASSERT((current_page_ <= first_page()) && (current_page_ >= new_last_page)); 1281 ASSERT((current_page_ <= first_page()) && (current_page_ >= new_last_page));
1277 1282
1278 return true; 1283 return true;
1279 } 1284 }
1280 1285
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 object->ShortPrint(); 2658 object->ShortPrint();
2654 PrintF("\n"); 2659 PrintF("\n");
2655 } 2660 }
2656 printf(" --------------------------------------\n"); 2661 printf(" --------------------------------------\n");
2657 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 2662 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
2658 } 2663 }
2659 2664
2660 #endif // DEBUG 2665 #endif // DEBUG
2661 2666
2662 } } // namespace v8::internal 2667 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698