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

Side by Side Diff: src/spaces.cc

Issue 7281006: Fix bug in semispace shrink-to. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: And a little cleanup. Created 9 years, 5 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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 last_page = new_page; 1215 last_page = new_page;
1216 } 1216 }
1217 return true; 1217 return true;
1218 } 1218 }
1219 1219
1220 1220
1221 bool SemiSpace::ShrinkTo(int new_capacity) { 1221 bool SemiSpace::ShrinkTo(int new_capacity) {
1222 ASSERT((new_capacity & Page::kPageAlignmentMask) == 0); 1222 ASSERT((new_capacity & Page::kPageAlignmentMask) == 0);
1223 ASSERT(new_capacity >= initial_capacity_); 1223 ASSERT(new_capacity >= initial_capacity_);
1224 ASSERT(new_capacity < capacity_); 1224 ASSERT(new_capacity < capacity_);
1225 Address end = start_ + maximum_capacity_; 1225 Address space_end = start_ + maximum_capacity_;
1226 Address start = end - new_capacity; 1226 Address old_start = space_end - capacity_;
Vyacheslav Egorov (Chromium) 2011/06/29 11:16:59 please add a comment about new space growing backw
Lasse Reichstein 2011/06/29 11:31:13 Done.
1227 size_t delta = capacity_ - new_capacity; 1227 size_t delta = capacity_ - new_capacity;
1228 ASSERT(IsAligned(delta, OS::AllocateAlignment())); 1228 ASSERT(IsAligned(delta, OS::AllocateAlignment()));
1229 if (!heap()->isolate()->memory_allocator()->UncommitBlock(start, delta)) { 1229 if (!heap()->isolate()->memory_allocator()->UncommitBlock(old_start, delta)) {
Vyacheslav Egorov (Chromium) 2011/06/29 11:16:59 I am a bit concerned about uncommiting piece of th
Lasse Reichstein 2011/06/29 11:31:13 And you are correct to be worried. It won't happen
1230 return false; 1230 return false;
1231 } 1231 }
1232 capacity_ = new_capacity; 1232 capacity_ = new_capacity;
1233 1233
1234 int pages_after = capacity_ / Page::kPageSize; 1234 int pages_after = capacity_ / Page::kPageSize;
1235 NewSpacePage* new_last_page = 1235 NewSpacePage* new_last_page =
1236 NewSpacePage::FromAddress(end - pages_after * Page::kPageSize); 1236 NewSpacePage::FromAddress(space_end - pages_after * Page::kPageSize);
1237 new_last_page->set_next_page(anchor()); 1237 new_last_page->set_next_page(anchor());
1238 anchor()->set_prev_page(new_last_page); 1238 anchor()->set_prev_page(new_last_page);
1239 ASSERT(current_page_ == first_page()); 1239 ASSERT(current_page_ == first_page());
1240 1240
1241 return true; 1241 return true;
1242 } 1242 }
1243 1243
1244 1244
1245 void SemiSpace::FlipPages(intptr_t flags, intptr_t mask) { 1245 void SemiSpace::FlipPages(intptr_t flags, intptr_t mask) {
1246 anchor_.set_owner(this); 1246 anchor_.set_owner(this);
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { 2506 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
2507 if (obj->IsCode()) { 2507 if (obj->IsCode()) {
2508 Code* code = Code::cast(obj); 2508 Code* code = Code::cast(obj);
2509 isolate->code_kind_statistics()[code->kind()] += code->Size(); 2509 isolate->code_kind_statistics()[code->kind()] += code->Size();
2510 } 2510 }
2511 } 2511 }
2512 } 2512 }
2513 #endif // DEBUG 2513 #endif // DEBUG
2514 2514
2515 } } // namespace v8::internal 2515 } } // 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