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

Side by Side Diff: src/heap.cc

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/heap.h ('k') | src/heap-inl.h » ('j') | 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 LiveObjectList::UpdateReferencesForScavengeGC(); 1086 LiveObjectList::UpdateReferencesForScavengeGC();
1087 isolate()->runtime_profiler()->UpdateSamplesAfterScavenge(); 1087 isolate()->runtime_profiler()->UpdateSamplesAfterScavenge();
1088 incremental_marking()->UpdateMarkingDequeAfterScavenge(); 1088 incremental_marking()->UpdateMarkingDequeAfterScavenge();
1089 1089
1090 ASSERT(new_space_front == new_space_.top()); 1090 ASSERT(new_space_front == new_space_.top());
1091 1091
1092 // Set age mark. 1092 // Set age mark.
1093 new_space_.set_age_mark(new_space_.top()); 1093 new_space_.set_age_mark(new_space_.top());
1094 1094
1095 new_space_.LowerInlineAllocationLimit( 1095 new_space_.LowerInlineAllocationLimit(
1096 new_space_.inline_alloction_limit_step()); 1096 new_space_.inline_allocation_limit_step());
1097 1097
1098 // Update how much has survived scavenge. 1098 // Update how much has survived scavenge.
1099 IncrementYoungSurvivorsCounter(static_cast<int>( 1099 IncrementYoungSurvivorsCounter(static_cast<int>(
1100 (PromotedSpaceSize() - survived_watermark) + new_space_.Size())); 1100 (PromotedSpaceSize() - survived_watermark) + new_space_.Size()));
1101 1101
1102 LOG(isolate_, ResourceEvent("scavenge", "end")); 1102 LOG(isolate_, ResourceEvent("scavenge", "end"));
1103 1103
1104 gc_state_ = NOT_IN_GC; 1104 gc_state_ = NOT_IN_GC;
1105 } 1105 }
1106 1106
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 if (!heap->InNewSpace(object)) return; 1246 if (!heap->InNewSpace(object)) return;
1247 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), 1247 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p),
1248 reinterpret_cast<HeapObject*>(object)); 1248 reinterpret_cast<HeapObject*>(object));
1249 } 1249 }
1250 }; 1250 };
1251 1251
1252 1252
1253 Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor, 1253 Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor,
1254 Address new_space_front) { 1254 Address new_space_front) {
1255 do { 1255 do {
1256 ASSERT(new_space_front <= new_space_.top()); 1256 SemiSpace::AssertValidRange(new_space_front, new_space_.top());
1257
1258 // The addresses new_space_front and new_space_.top() define a 1257 // The addresses new_space_front and new_space_.top() define a
1259 // queue of unprocessed copied objects. Process them until the 1258 // queue of unprocessed copied objects. Process them until the
1260 // queue is empty. 1259 // queue is empty.
1261 while (new_space_front < new_space_.top()) { 1260 while (new_space_front != new_space_.top()) {
1262 HeapObject* object = HeapObject::FromAddress(new_space_front); 1261 if (!NewSpacePage::IsAtEnd(new_space_front)) {
1263 new_space_front += NewSpaceScavenger::IterateBody(object->map(), object); 1262 HeapObject* object = HeapObject::FromAddress(new_space_front);
1263 new_space_front +=
1264 NewSpaceScavenger::IterateBody(object->map(), object);
1265 } else {
1266 new_space_front =
1267 NewSpacePage::FromLimit(new_space_front)->next_page()->body();
1268 }
1264 } 1269 }
1265 1270
1266 // Promote and process all the to-be-promoted objects. 1271 // Promote and process all the to-be-promoted objects.
1267 { 1272 {
1268 StoreBufferRebuildScope scope(this, 1273 StoreBufferRebuildScope scope(this,
1269 store_buffer(), 1274 store_buffer(),
1270 &ScavengeStoreBufferCallback); 1275 &ScavengeStoreBufferCallback);
1271 while (!promotion_queue()->is_empty()) { 1276 while (!promotion_queue()->is_empty()) {
1272 HeapObject* target; 1277 HeapObject* target;
1273 int size; 1278 int size;
1274 promotion_queue()->remove(&target, &size); 1279 promotion_queue()->remove(&target, &size);
1275 1280
1276 // Promoted object might be already partially visited 1281 // Promoted object might be already partially visited
1277 // during old space pointer iteration. Thus we search specificly 1282 // during old space pointer iteration. Thus we search specificly
1278 // for pointers to from semispace instead of looking for pointers 1283 // for pointers to from semispace instead of looking for pointers
1279 // to new space. 1284 // to new space.
1280 ASSERT(!target->IsMap()); 1285 ASSERT(!target->IsMap());
1281 IterateAndMarkPointersToFromSpace(target->address(), 1286 IterateAndMarkPointersToFromSpace(target->address(),
1282 target->address() + size, 1287 target->address() + size,
1283 &ScavengeObject); 1288 &ScavengeObject);
1284 } 1289 }
1285 } 1290 }
1286 1291
1287 // Take another spin if there are now unswept objects in new space 1292 // Take another spin if there are now unswept objects in new space
1288 // (there are currently no more unswept promoted objects). 1293 // (there are currently no more unswept promoted objects).
1289 } while (new_space_front < new_space_.top()); 1294 } while (new_space_front != new_space_.top());
1290 1295
1291 return new_space_front; 1296 return new_space_front;
1292 } 1297 }
1293 1298
1294 1299
1295 enum LoggingAndProfiling { 1300 enum LoggingAndProfiling {
1296 LOGGING_AND_PROFILING_ENABLED, 1301 LOGGING_AND_PROFILING_ENABLED,
1297 LOGGING_AND_PROFILING_DISABLED 1302 LOGGING_AND_PROFILING_DISABLED
1298 }; 1303 };
1299 1304
(...skipping 4484 matching lines...) Expand 10 before | Expand all | Expand 10 after
5784 } 5789 }
5785 5790
5786 5791
5787 void ExternalStringTable::TearDown() { 5792 void ExternalStringTable::TearDown() {
5788 new_space_strings_.Free(); 5793 new_space_strings_.Free();
5789 old_space_strings_.Free(); 5794 old_space_strings_.Free();
5790 } 5795 }
5791 5796
5792 5797
5793 } } // namespace v8::internal 5798 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698