| 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 LiveObjectList::UpdateReferencesForScavengeGC(); | 1098 LiveObjectList::UpdateReferencesForScavengeGC(); |
| 1099 isolate()->runtime_profiler()->UpdateSamplesAfterScavenge(); | 1099 isolate()->runtime_profiler()->UpdateSamplesAfterScavenge(); |
| 1100 incremental_marking()->UpdateMarkingDequeAfterScavenge(); | 1100 incremental_marking()->UpdateMarkingDequeAfterScavenge(); |
| 1101 | 1101 |
| 1102 ASSERT(new_space_front == new_space_.top()); | 1102 ASSERT(new_space_front == new_space_.top()); |
| 1103 | 1103 |
| 1104 // Set age mark. | 1104 // Set age mark. |
| 1105 new_space_.set_age_mark(new_space_.top()); | 1105 new_space_.set_age_mark(new_space_.top()); |
| 1106 | 1106 |
| 1107 new_space_.LowerInlineAllocationLimit( | 1107 new_space_.LowerInlineAllocationLimit( |
| 1108 new_space_.inline_alloction_limit_step()); | 1108 new_space_.inline_allocation_limit_step()); |
| 1109 | 1109 |
| 1110 // Update how much has survived scavenge. | 1110 // Update how much has survived scavenge. |
| 1111 IncrementYoungSurvivorsCounter(static_cast<int>( | 1111 IncrementYoungSurvivorsCounter(static_cast<int>( |
| 1112 (PromotedSpaceSize() - survived_watermark) + new_space_.Size())); | 1112 (PromotedSpaceSize() - survived_watermark) + new_space_.Size())); |
| 1113 | 1113 |
| 1114 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1114 LOG(isolate_, ResourceEvent("scavenge", "end")); |
| 1115 | 1115 |
| 1116 gc_state_ = NOT_IN_GC; | 1116 gc_state_ = NOT_IN_GC; |
| 1117 } | 1117 } |
| 1118 | 1118 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 if (!heap->InNewSpace(object)) return; | 1258 if (!heap->InNewSpace(object)) return; |
| 1259 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 1259 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
| 1260 reinterpret_cast<HeapObject*>(object)); | 1260 reinterpret_cast<HeapObject*>(object)); |
| 1261 } | 1261 } |
| 1262 }; | 1262 }; |
| 1263 | 1263 |
| 1264 | 1264 |
| 1265 Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor, | 1265 Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor, |
| 1266 Address new_space_front) { | 1266 Address new_space_front) { |
| 1267 do { | 1267 do { |
| 1268 ASSERT(new_space_front <= new_space_.top()); | 1268 SemiSpace::AssertValidRange(new_space_front, new_space_.top()); |
| 1269 | |
| 1270 // The addresses new_space_front and new_space_.top() define a | 1269 // The addresses new_space_front and new_space_.top() define a |
| 1271 // queue of unprocessed copied objects. Process them until the | 1270 // queue of unprocessed copied objects. Process them until the |
| 1272 // queue is empty. | 1271 // queue is empty. |
| 1273 while (new_space_front < new_space_.top()) { | 1272 while (new_space_front != new_space_.top()) { |
| 1274 HeapObject* object = HeapObject::FromAddress(new_space_front); | 1273 if (!NewSpacePage::at_end(new_space_front)) { |
| 1275 new_space_front += NewSpaceScavenger::IterateBody(object->map(), object); | 1274 HeapObject* object = HeapObject::FromAddress(new_space_front); |
| 1275 new_space_front += |
| 1276 NewSpaceScavenger::IterateBody(object->map(), object); |
| 1277 } else { |
| 1278 new_space_front = |
| 1279 NewSpacePage::FromLimit(new_space_front)->next_page()->body(); |
| 1280 } |
| 1276 } | 1281 } |
| 1277 | 1282 |
| 1278 // Promote and process all the to-be-promoted objects. | 1283 // Promote and process all the to-be-promoted objects. |
| 1279 { | 1284 { |
| 1280 StoreBufferRebuildScope scope(this, | 1285 StoreBufferRebuildScope scope(this, |
| 1281 store_buffer(), | 1286 store_buffer(), |
| 1282 &ScavengeStoreBufferCallback); | 1287 &ScavengeStoreBufferCallback); |
| 1283 while (!promotion_queue()->is_empty()) { | 1288 while (!promotion_queue()->is_empty()) { |
| 1284 HeapObject* target; | 1289 HeapObject* target; |
| 1285 int size; | 1290 int size; |
| 1286 promotion_queue()->remove(&target, &size); | 1291 promotion_queue()->remove(&target, &size); |
| 1287 | 1292 |
| 1288 // Promoted object might be already partially visited | 1293 // Promoted object might be already partially visited |
| 1289 // during old space pointer iteration. Thus we search specificly | 1294 // during old space pointer iteration. Thus we search specificly |
| 1290 // for pointers to from semispace instead of looking for pointers | 1295 // for pointers to from semispace instead of looking for pointers |
| 1291 // to new space. | 1296 // to new space. |
| 1292 ASSERT(!target->IsMap()); | 1297 ASSERT(!target->IsMap()); |
| 1293 IterateAndMarkPointersToFromSpace(target->address(), | 1298 IterateAndMarkPointersToFromSpace(target->address(), |
| 1294 target->address() + size, | 1299 target->address() + size, |
| 1295 &ScavengeObject); | 1300 &ScavengeObject); |
| 1296 } | 1301 } |
| 1297 } | 1302 } |
| 1298 | 1303 |
| 1299 // Take another spin if there are now unswept objects in new space | 1304 // Take another spin if there are now unswept objects in new space |
| 1300 // (there are currently no more unswept promoted objects). | 1305 // (there are currently no more unswept promoted objects). |
| 1301 } while (new_space_front < new_space_.top()); | 1306 } while (new_space_front != new_space_.top()); |
| 1302 | 1307 |
| 1303 return new_space_front; | 1308 return new_space_front; |
| 1304 } | 1309 } |
| 1305 | 1310 |
| 1306 | 1311 |
| 1307 enum LoggingAndProfiling { | 1312 enum LoggingAndProfiling { |
| 1308 LOGGING_AND_PROFILING_ENABLED, | 1313 LOGGING_AND_PROFILING_ENABLED, |
| 1309 LOGGING_AND_PROFILING_DISABLED | 1314 LOGGING_AND_PROFILING_DISABLED |
| 1310 }; | 1315 }; |
| 1311 | 1316 |
| (...skipping 4703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6015 } | 6020 } |
| 6016 | 6021 |
| 6017 | 6022 |
| 6018 void ExternalStringTable::TearDown() { | 6023 void ExternalStringTable::TearDown() { |
| 6019 new_space_strings_.Free(); | 6024 new_space_strings_.Free(); |
| 6020 old_space_strings_.Free(); | 6025 old_space_strings_.Free(); |
| 6021 } | 6026 } |
| 6022 | 6027 |
| 6023 | 6028 |
| 6024 } } // namespace v8::internal | 6029 } } // namespace v8::internal |
| OLD | NEW |