OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 | 1352 |
1353 | 1353 |
1354 void Heap::UpdateNewSpaceReferencesInExternalStringTable( | 1354 void Heap::UpdateNewSpaceReferencesInExternalStringTable( |
1355 ExternalStringTableUpdaterCallback updater_func) { | 1355 ExternalStringTableUpdaterCallback updater_func) { |
1356 if (FLAG_verify_heap) { | 1356 if (FLAG_verify_heap) { |
1357 external_string_table_.Verify(); | 1357 external_string_table_.Verify(); |
1358 } | 1358 } |
1359 | 1359 |
1360 if (external_string_table_.new_space_strings_.is_empty()) return; | 1360 if (external_string_table_.new_space_strings_.is_empty()) return; |
1361 | 1361 |
1362 Object** start = &external_string_table_.new_space_strings_[0]; | 1362 Object** start_slot = &external_string_table_.new_space_strings_[0]; |
1363 Object** end = start + external_string_table_.new_space_strings_.length(); | 1363 Object** end_slot = |
1364 Object** last = start; | 1364 start_slot + external_string_table_.new_space_strings_.length(); |
| 1365 Object** last = start_slot; |
1365 | 1366 |
1366 for (Object** p = start; p < end; ++p) { | 1367 for (Object** p = start_slot; p < end_slot; ++p) { |
1367 ASSERT(InFromSpace(*p)); | 1368 ASSERT(InFromSpace(*p)); |
1368 String* target = updater_func(this, p); | 1369 String* target = updater_func(this, p); |
1369 | 1370 |
1370 if (target == NULL) continue; | 1371 if (target == NULL) continue; |
1371 | 1372 |
1372 ASSERT(target->IsExternalString()); | 1373 ASSERT(target->IsExternalString()); |
1373 | 1374 |
1374 if (InNewSpace(target)) { | 1375 if (InNewSpace(target)) { |
1375 // String is still in new space. Update the table entry. | 1376 // String is still in new space. Update the table entry. |
1376 *last = target; | 1377 *last = target; |
1377 ++last; | 1378 ++last; |
1378 } else { | 1379 } else { |
1379 // String got promoted. Move it to the old string list. | 1380 // String got promoted. Move it to the old string list. |
1380 external_string_table_.AddOldString(target); | 1381 external_string_table_.AddOldString(target); |
1381 } | 1382 } |
1382 } | 1383 } |
1383 | 1384 |
1384 ASSERT(last <= end); | 1385 ASSERT(last <= end_slot); |
1385 external_string_table_.ShrinkNewStrings(static_cast<int>(last - start)); | 1386 external_string_table_.ShrinkNewStrings(static_cast<int>(last - start_slot)); |
1386 } | 1387 } |
1387 | 1388 |
1388 | 1389 |
1389 void Heap::UpdateReferencesInExternalStringTable( | 1390 void Heap::UpdateReferencesInExternalStringTable( |
1390 ExternalStringTableUpdaterCallback updater_func) { | 1391 ExternalStringTableUpdaterCallback updater_func) { |
1391 | 1392 |
1392 // Update old space string references. | 1393 // Update old space string references. |
1393 if (external_string_table_.old_space_strings_.length() > 0) { | 1394 if (external_string_table_.old_space_strings_.length() > 0) { |
1394 Object** start = &external_string_table_.old_space_strings_[0]; | 1395 Object** start_slot = &external_string_table_.old_space_strings_[0]; |
1395 Object** end = start + external_string_table_.old_space_strings_.length(); | 1396 Object** end_slot = |
1396 for (Object** p = start; p < end; ++p) *p = updater_func(this, p); | 1397 start_slot + external_string_table_.old_space_strings_.length(); |
| 1398 for (Object** p = start_slot; p < end_slot; ++p) *p = updater_func(this, p); |
1397 } | 1399 } |
1398 | 1400 |
1399 UpdateNewSpaceReferencesInExternalStringTable(updater_func); | 1401 UpdateNewSpaceReferencesInExternalStringTable(updater_func); |
1400 } | 1402 } |
1401 | 1403 |
1402 | 1404 |
1403 static Object* ProcessFunctionWeakReferences(Heap* heap, | 1405 static Object* ProcessFunctionWeakReferences(Heap* heap, |
1404 Object* function, | 1406 Object* function, |
1405 WeakObjectRetainer* retainer, | 1407 WeakObjectRetainer* retainer, |
1406 bool record_slots) { | 1408 bool record_slots) { |
(...skipping 5375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6782 // not visited yet | 6784 // not visited yet |
6783 Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map)); | 6785 Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map)); |
6784 | 6786 |
6785 Address map_addr = map_p->address(); | 6787 Address map_addr = map_p->address(); |
6786 | 6788 |
6787 obj->set_map_no_write_barrier(reinterpret_cast<Map*>(map_addr + kMarkTag)); | 6789 obj->set_map_no_write_barrier(reinterpret_cast<Map*>(map_addr + kMarkTag)); |
6788 | 6790 |
6789 // Scan the object body. | 6791 // Scan the object body. |
6790 if (is_native_context && (visit_mode_ == VISIT_ONLY_STRONG)) { | 6792 if (is_native_context && (visit_mode_ == VISIT_ONLY_STRONG)) { |
6791 // This is specialized to scan Context's properly. | 6793 // This is specialized to scan Context's properly. |
6792 Object** start = reinterpret_cast<Object**>(obj->address() + | 6794 Object** start_slot = reinterpret_cast<Object**>(obj->address() + |
6793 Context::kHeaderSize); | 6795 Context::kHeaderSize); |
6794 Object** end = reinterpret_cast<Object**>(obj->address() + | 6796 Object** end_slot = reinterpret_cast<Object**>(obj->address() + |
6795 Context::kHeaderSize + Context::FIRST_WEAK_SLOT * kPointerSize); | 6797 Context::kHeaderSize + Context::FIRST_WEAK_SLOT * kPointerSize); |
6796 mark_visitor->VisitPointers(start, end); | 6798 mark_visitor->VisitPointers(start_slot, end_slot); |
6797 } else { | 6799 } else { |
6798 obj->IterateBody(map_p->instance_type(), | 6800 obj->IterateBody(map_p->instance_type(), |
6799 obj->SizeFromMap(map_p), | 6801 obj->SizeFromMap(map_p), |
6800 mark_visitor); | 6802 mark_visitor); |
6801 } | 6803 } |
6802 | 6804 |
6803 // Scan the map after the body because the body is a lot more interesting | 6805 // Scan the map after the body because the body is a lot more interesting |
6804 // when doing leak detection. | 6806 // when doing leak detection. |
6805 MarkRecursively(&map, mark_visitor); | 6807 MarkRecursively(&map, mark_visitor); |
6806 | 6808 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7326 static_cast<int>(object_sizes_last_time_[index])); | 7328 static_cast<int>(object_sizes_last_time_[index])); |
7327 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7329 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7328 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7330 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7329 | 7331 |
7330 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7332 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7331 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7333 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7332 ClearObjectStats(); | 7334 ClearObjectStats(); |
7333 } | 7335 } |
7334 | 7336 |
7335 } } // namespace v8::internal | 7337 } } // namespace v8::internal |
OLD | NEW |