| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { | 218 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { |
| 219 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects. | 219 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects. |
| 220 ASSERT(!MarkCompactCollector::are_map_pointers_encoded()); | 220 ASSERT(!MarkCompactCollector::are_map_pointers_encoded()); |
| 221 MapWord map_word = object->map_word(); | 221 MapWord map_word = object->map_word(); |
| 222 map_word.ClearMark(); | 222 map_word.ClearMark(); |
| 223 map_word.ClearOverflow(); | 223 map_word.ClearOverflow(); |
| 224 return object->SizeFromMap(map_word.ToMap()); | 224 return object->SizeFromMap(map_word.ToMap()); |
| 225 } | 225 } |
| 226 | 226 |
| 227 | 227 |
| 228 int Heap::GcSafeSizeOfOldObjectWithEncodedMap(HeapObject* object) { | |
| 229 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects. | |
| 230 ASSERT(MarkCompactCollector::are_map_pointers_encoded()); | |
| 231 uint32_t marker = Memory::uint32_at(object->address()); | |
| 232 if (marker == MarkCompactCollector::kSingleFreeEncoding) { | |
| 233 return kIntSize; | |
| 234 } else if (marker == MarkCompactCollector::kMultiFreeEncoding) { | |
| 235 return Memory::int_at(object->address() + kIntSize); | |
| 236 } else { | |
| 237 MapWord map_word = object->map_word(); | |
| 238 Address map_address = map_word.DecodeMapAddress(Heap::map_space()); | |
| 239 Map* map = reinterpret_cast<Map*>(HeapObject::FromAddress(map_address)); | |
| 240 return object->SizeFromMap(map); | |
| 241 } | |
| 242 } | |
| 243 | |
| 244 | |
| 245 GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space) { | 228 GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space) { |
| 246 // Is global GC requested? | 229 // Is global GC requested? |
| 247 if (space != NEW_SPACE || FLAG_gc_global) { | 230 if (space != NEW_SPACE || FLAG_gc_global) { |
| 248 Counters::gc_compactor_caused_by_request.Increment(); | 231 Counters::gc_compactor_caused_by_request.Increment(); |
| 249 return MARK_COMPACTOR; | 232 return MARK_COMPACTOR; |
| 250 } | 233 } |
| 251 | 234 |
| 252 // Is enough data promoted to justify a global GC? | 235 // Is enough data promoted to justify a global GC? |
| 253 if (OldGenerationPromotionLimitReached()) { | 236 if (OldGenerationPromotionLimitReached()) { |
| 254 Counters::gc_compactor_caused_by_promoted_data.Increment(); | 237 Counters::gc_compactor_caused_by_promoted_data.Increment(); |
| (...skipping 3732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 | 3970 |
| 3988 | 3971 |
| 3989 void Heap::Verify() { | 3972 void Heap::Verify() { |
| 3990 ASSERT(HasBeenSetup()); | 3973 ASSERT(HasBeenSetup()); |
| 3991 | 3974 |
| 3992 VerifyPointersVisitor visitor; | 3975 VerifyPointersVisitor visitor; |
| 3993 IterateRoots(&visitor, VISIT_ONLY_STRONG); | 3976 IterateRoots(&visitor, VISIT_ONLY_STRONG); |
| 3994 | 3977 |
| 3995 new_space_.Verify(); | 3978 new_space_.Verify(); |
| 3996 | 3979 |
| 3997 VerifyPointersAndDirtyRegionsVisitor dirty_regions_visitor; | 3980 old_pointer_space_->Verify(&visitor); |
| 3998 old_pointer_space_->Verify(&dirty_regions_visitor); | 3981 map_space_->Verify(&visitor); |
| 3999 map_space_->Verify(&dirty_regions_visitor); | |
| 4000 | 3982 |
| 4001 VerifyPointersUnderWatermark(old_pointer_space_, | 3983 VerifyPointersUnderWatermark(old_pointer_space_, |
| 4002 &IteratePointersInDirtyRegion); | 3984 &IteratePointersInDirtyRegion); |
| 4003 VerifyPointersUnderWatermark(map_space_, | 3985 VerifyPointersUnderWatermark(map_space_, |
| 4004 &IteratePointersInDirtyMapsRegion); | 3986 &IteratePointersInDirtyMapsRegion); |
| 4005 VerifyPointersUnderWatermark(lo_space_); | 3987 VerifyPointersUnderWatermark(lo_space_); |
| 4006 | 3988 |
| 4007 VerifyPageWatermarkValidity(old_pointer_space_, ALL_INVALID); | 3989 VerifyPageWatermarkValidity(old_pointer_space_, ALL_INVALID); |
| 4008 VerifyPageWatermarkValidity(map_space_, ALL_INVALID); | 3990 VerifyPageWatermarkValidity(map_space_, ALL_INVALID); |
| 4009 | 3991 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4210 page->SetRegionMarks(marks); | 4192 page->SetRegionMarks(marks); |
| 4211 } | 4193 } |
| 4212 | 4194 |
| 4213 | 4195 |
| 4214 uint32_t Heap::IterateDirtyRegions( | 4196 uint32_t Heap::IterateDirtyRegions( |
| 4215 uint32_t marks, | 4197 uint32_t marks, |
| 4216 Address area_start, | 4198 Address area_start, |
| 4217 Address area_end, | 4199 Address area_end, |
| 4218 DirtyRegionCallback visit_dirty_region, | 4200 DirtyRegionCallback visit_dirty_region, |
| 4219 ObjectSlotCallback copy_object_func) { | 4201 ObjectSlotCallback copy_object_func) { |
| 4202 #ifndef ENABLE_CARDMARKING_WRITE_BARRIER |
| 4203 ASSERT(marks == Page::kAllRegionsDirtyMarks); |
| 4204 visit_dirty_region(area_start, area_end, copy_object_func); |
| 4205 return Page::kAllRegionsDirtyMarks; |
| 4206 #else |
| 4220 uint32_t newmarks = 0; | 4207 uint32_t newmarks = 0; |
| 4221 uint32_t mask = 1; | 4208 uint32_t mask = 1; |
| 4222 | 4209 |
| 4223 if (area_start >= area_end) { | 4210 if (area_start >= area_end) { |
| 4224 return newmarks; | 4211 return newmarks; |
| 4225 } | 4212 } |
| 4226 | 4213 |
| 4227 Address region_start = area_start; | 4214 Address region_start = area_start; |
| 4228 | 4215 |
| 4229 // area_start does not necessarily coincide with start of the first region. | 4216 // area_start does not necessarily coincide with start of the first region. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4266 // with region end. Check whether region covering last part of area is | 4253 // with region end. Check whether region covering last part of area is |
| 4267 // dirty. | 4254 // dirty. |
| 4268 if (marks & mask) { | 4255 if (marks & mask) { |
| 4269 if (visit_dirty_region(region_start, area_end, copy_object_func)) { | 4256 if (visit_dirty_region(region_start, area_end, copy_object_func)) { |
| 4270 newmarks |= mask; | 4257 newmarks |= mask; |
| 4271 } | 4258 } |
| 4272 } | 4259 } |
| 4273 } | 4260 } |
| 4274 | 4261 |
| 4275 return newmarks; | 4262 return newmarks; |
| 4263 #endif |
| 4276 } | 4264 } |
| 4277 | 4265 |
| 4278 | 4266 |
| 4279 | 4267 |
| 4280 void Heap::IterateDirtyRegions( | 4268 void Heap::IterateDirtyRegions( |
| 4281 PagedSpace* space, | 4269 PagedSpace* space, |
| 4282 DirtyRegionCallback visit_dirty_region, | 4270 DirtyRegionCallback visit_dirty_region, |
| 4283 ObjectSlotCallback copy_object_func, | 4271 ObjectSlotCallback copy_object_func, |
| 4284 ExpectedPageWatermarkState expected_page_watermark_state) { | 4272 ExpectedPageWatermarkState expected_page_watermark_state) { |
| 4285 | 4273 |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5448 void ExternalStringTable::TearDown() { | 5436 void ExternalStringTable::TearDown() { |
| 5449 new_space_strings_.Free(); | 5437 new_space_strings_.Free(); |
| 5450 old_space_strings_.Free(); | 5438 old_space_strings_.Free(); |
| 5451 } | 5439 } |
| 5452 | 5440 |
| 5453 | 5441 |
| 5454 List<Object*> ExternalStringTable::new_space_strings_; | 5442 List<Object*> ExternalStringTable::new_space_strings_; |
| 5455 List<Object*> ExternalStringTable::old_space_strings_; | 5443 List<Object*> ExternalStringTable::old_space_strings_; |
| 5456 | 5444 |
| 5457 } } // namespace v8::internal | 5445 } } // namespace v8::internal |
| OLD | NEW |