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