| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 steps_count_(0), | 47 steps_count_(0), |
| 48 steps_took_(0), | 48 steps_took_(0), |
| 49 longest_step_(0.0), | 49 longest_step_(0.0), |
| 50 old_generation_space_available_at_start_of_incremental_(0), | 50 old_generation_space_available_at_start_of_incremental_(0), |
| 51 old_generation_space_used_at_start_of_incremental_(0), | 51 old_generation_space_used_at_start_of_incremental_(0), |
| 52 steps_count_since_last_gc_(0), | 52 steps_count_since_last_gc_(0), |
| 53 steps_took_since_last_gc_(0), | 53 steps_took_since_last_gc_(0), |
| 54 should_hurry_(false), | 54 should_hurry_(false), |
| 55 marking_speed_(0), | 55 marking_speed_(0), |
| 56 allocated_(0), | 56 allocated_(0), |
| 57 no_marking_scope_depth_(0) { | 57 no_marking_scope_depth_(0), |
| 58 unscanned_bytes_of_large_object_(0) { |
| 58 } | 59 } |
| 59 | 60 |
| 60 | 61 |
| 61 void IncrementalMarking::TearDown() { | 62 void IncrementalMarking::TearDown() { |
| 62 delete marking_deque_memory_; | 63 delete marking_deque_memory_; |
| 63 } | 64 } |
| 64 | 65 |
| 65 | 66 |
| 66 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, | 67 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, |
| 67 Object** slot, | 68 Object** slot, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 Heap* heap = map->GetHeap(); | 235 Heap* heap = map->GetHeap(); |
| 235 // When using a progress bar for large fixed arrays, scan only a chunk of | 236 // When using a progress bar for large fixed arrays, scan only a chunk of |
| 236 // the array and try to push it onto the marking deque again until it is | 237 // the array and try to push it onto the marking deque again until it is |
| 237 // fully scanned. Fall back to scanning it through to the end in case this | 238 // fully scanned. Fall back to scanning it through to the end in case this |
| 238 // fails because of a full deque. | 239 // fails because of a full deque. |
| 239 int object_size = FixedArray::BodyDescriptor::SizeOf(map, object); | 240 int object_size = FixedArray::BodyDescriptor::SizeOf(map, object); |
| 240 int start_offset = Max(FixedArray::BodyDescriptor::kStartOffset, | 241 int start_offset = Max(FixedArray::BodyDescriptor::kStartOffset, |
| 241 chunk->progress_bar()); | 242 chunk->progress_bar()); |
| 242 int end_offset = Min(object_size, | 243 int end_offset = Min(object_size, |
| 243 start_offset + kProgressBarScanningChunk); | 244 start_offset + kProgressBarScanningChunk); |
| 245 int already_scanned_offset = start_offset; |
| 244 bool scan_until_end = false; | 246 bool scan_until_end = false; |
| 245 do { | 247 do { |
| 246 VisitPointersWithAnchor(heap, | 248 VisitPointersWithAnchor(heap, |
| 247 HeapObject::RawField(object, 0), | 249 HeapObject::RawField(object, 0), |
| 248 HeapObject::RawField(object, start_offset), | 250 HeapObject::RawField(object, start_offset), |
| 249 HeapObject::RawField(object, end_offset)); | 251 HeapObject::RawField(object, end_offset)); |
| 250 start_offset = end_offset; | 252 start_offset = end_offset; |
| 251 end_offset = Min(object_size, end_offset + kProgressBarScanningChunk); | 253 end_offset = Min(object_size, end_offset + kProgressBarScanningChunk); |
| 252 scan_until_end = heap->incremental_marking()->marking_deque()->IsFull(); | 254 scan_until_end = heap->incremental_marking()->marking_deque()->IsFull(); |
| 253 } while (scan_until_end && start_offset < object_size); | 255 } while (scan_until_end && start_offset < object_size); |
| 254 chunk->set_progress_bar(start_offset); | 256 chunk->set_progress_bar(start_offset); |
| 255 if (start_offset < object_size) { | 257 if (start_offset < object_size) { |
| 256 heap->incremental_marking()->marking_deque()->UnshiftGrey(object); | 258 heap->incremental_marking()->marking_deque()->UnshiftGrey(object); |
| 259 heap->incremental_marking()->NotifyIncompleteScanOfObject( |
| 260 object_size - (start_offset - already_scanned_offset)); |
| 257 } | 261 } |
| 258 } else { | 262 } else { |
| 259 FixedArrayVisitor::Visit(map, object); | 263 FixedArrayVisitor::Visit(map, object); |
| 260 } | 264 } |
| 261 } | 265 } |
| 262 | 266 |
| 263 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { | 267 static void VisitNativeContextIncremental(Map* map, HeapObject* object) { |
| 264 Context* context = Context::cast(object); | 268 Context* context = Context::cast(object); |
| 265 | 269 |
| 266 // We will mark cache black with a separate pass | 270 // We will mark cache black with a separate pass |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 Map* filler_map = heap_->one_pointer_filler_map(); | 736 Map* filler_map = heap_->one_pointer_filler_map(); |
| 733 while (!marking_deque_.IsEmpty() && bytes_to_process > 0) { | 737 while (!marking_deque_.IsEmpty() && bytes_to_process > 0) { |
| 734 HeapObject* obj = marking_deque_.Pop(); | 738 HeapObject* obj = marking_deque_.Pop(); |
| 735 | 739 |
| 736 // Explicitly skip one word fillers. Incremental markbit patterns are | 740 // Explicitly skip one word fillers. Incremental markbit patterns are |
| 737 // correct only for objects that occupy at least two words. | 741 // correct only for objects that occupy at least two words. |
| 738 Map* map = obj->map(); | 742 Map* map = obj->map(); |
| 739 if (map == filler_map) continue; | 743 if (map == filler_map) continue; |
| 740 | 744 |
| 741 int size = obj->SizeFromMap(map); | 745 int size = obj->SizeFromMap(map); |
| 742 bytes_to_process -= size; | 746 unscanned_bytes_of_large_object_ = 0; |
| 743 VisitObject(map, obj, size); | 747 VisitObject(map, obj, size); |
| 748 bytes_to_process -= (size - unscanned_bytes_of_large_object_); |
| 744 } | 749 } |
| 745 } | 750 } |
| 746 | 751 |
| 747 | 752 |
| 748 void IncrementalMarking::ProcessMarkingDeque() { | 753 void IncrementalMarking::ProcessMarkingDeque() { |
| 749 Map* filler_map = heap_->one_pointer_filler_map(); | 754 Map* filler_map = heap_->one_pointer_filler_map(); |
| 750 while (!marking_deque_.IsEmpty()) { | 755 while (!marking_deque_.IsEmpty()) { |
| 751 HeapObject* obj = marking_deque_.Pop(); | 756 HeapObject* obj = marking_deque_.Pop(); |
| 752 | 757 |
| 753 // Explicitly skip one word fillers. Incremental markbit patterns are | 758 // Explicitly skip one word fillers. Incremental markbit patterns are |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 bytes_scanned_ = 0; | 1028 bytes_scanned_ = 0; |
| 1024 write_barriers_invoked_since_last_step_ = 0; | 1029 write_barriers_invoked_since_last_step_ = 0; |
| 1025 } | 1030 } |
| 1026 | 1031 |
| 1027 | 1032 |
| 1028 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 1033 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
| 1029 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 1034 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
| 1030 } | 1035 } |
| 1031 | 1036 |
| 1032 } } // namespace v8::internal | 1037 } } // namespace v8::internal |
| OLD | NEW |