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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 class IncrementalMarkingMarkingVisitor | 178 class IncrementalMarkingMarkingVisitor |
179 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { | 179 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { |
180 public: | 180 public: |
181 static void Initialize() { | 181 static void Initialize() { |
182 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); | 182 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); |
183 | 183 |
184 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | |
185 | |
186 table_.Register(kVisitJSFunction, &VisitJSFunction); | |
187 | |
188 table_.Register(kVisitJSRegExp, &VisitJSRegExp); | 184 table_.Register(kVisitJSRegExp, &VisitJSRegExp); |
189 } | 185 } |
190 | 186 |
191 static void VisitJSWeakMap(Map* map, HeapObject* object) { | 187 static void VisitJSWeakMap(Map* map, HeapObject* object) { |
192 Heap* heap = map->GetHeap(); | 188 Heap* heap = map->GetHeap(); |
193 Object** start_slot = | 189 Object** start_slot = |
194 HeapObject::RawField(object, JSWeakMap::kPropertiesOffset); | 190 HeapObject::RawField(object, JSWeakMap::kPropertiesOffset); |
195 VisitPointers(heap, | 191 VisitPointers(heap, |
196 start_slot, | 192 start_slot, |
197 start_slot, | 193 start_slot, |
198 HeapObject::RawField(object, JSWeakMap::kSize)); | 194 HeapObject::RawField(object, JSWeakMap::kSize)); |
199 } | 195 } |
200 | 196 |
201 static void VisitSharedFunctionInfo(Map* map, HeapObject* object) { | 197 static void BeforeVisitingSharedFunctionInfo(HeapObject* object) {} |
202 Heap* heap = map->GetHeap(); | |
203 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object); | |
204 if (shared->ic_age() != heap->global_ic_age()) { | |
205 shared->ResetForNewContext(heap->global_ic_age()); | |
206 } | |
207 FixedBodyVisitor<IncrementalMarkingMarkingVisitor, | |
208 SharedFunctionInfo::BodyDescriptor, | |
209 void>::Visit(map, object); | |
210 } | |
211 | 198 |
212 static const int kScanningChunk = 32 * 1024; | 199 static const int kScanningChunk = 32 * 1024; |
213 | 200 |
214 static int VisitHugeArray(FixedArray* array) { | 201 static int VisitHugeArray(FixedArray* array) { |
215 Heap* heap = array->GetHeap(); | 202 Heap* heap = array->GetHeap(); |
216 MemoryChunk* chunk = MemoryChunk::FromAddress(array->address()); | 203 MemoryChunk* chunk = MemoryChunk::FromAddress(array->address()); |
217 Object** start_slot = array->data_start(); | 204 Object** start_slot = array->data_start(); |
218 int length = array->length(); | 205 int length = array->length(); |
219 | 206 |
220 if (chunk->owner()->identity() != LO_SPACE) { | 207 if (chunk->owner()->identity() != LO_SPACE) { |
(...skipping 16 matching lines...) Expand all Loading... |
237 chunk->SetPartiallyScannedProgress(0); | 224 chunk->SetPartiallyScannedProgress(0); |
238 } else { | 225 } else { |
239 chunk->SetCompletelyScanned(); | 226 chunk->SetCompletelyScanned(); |
240 } | 227 } |
241 } else { | 228 } else { |
242 chunk->SetPartiallyScannedProgress(to); | 229 chunk->SetPartiallyScannedProgress(to); |
243 } | 230 } |
244 return to - from; | 231 return to - from; |
245 } | 232 } |
246 | 233 |
247 static inline void VisitJSFunction(Map* map, HeapObject* object) { | |
248 Heap* heap = map->GetHeap(); | |
249 // Iterate over all fields in the body but take care in dealing with | |
250 // the code entry and skip weak fields. | |
251 Object** start_slot = | |
252 HeapObject::RawField(object, JSFunction::kPropertiesOffset); | |
253 VisitPointers(heap, | |
254 start_slot, | |
255 start_slot, | |
256 HeapObject::RawField(object, JSFunction::kCodeEntryOffset)); | |
257 VisitCodeEntry(heap, object->address() + JSFunction::kCodeEntryOffset); | |
258 VisitPointers(heap, | |
259 start_slot, | |
260 HeapObject::RawField(object, | |
261 JSFunction::kCodeEntryOffset + kPointerSize), | |
262 HeapObject::RawField(object, | |
263 JSFunction::kNonWeakFieldsEndOffset)); | |
264 } | |
265 | |
266 INLINE(static void VisitPointer(Heap* heap, Object** p)) { | 234 INLINE(static void VisitPointer(Heap* heap, Object** p)) { |
267 Object* obj = *p; | 235 Object* obj = *p; |
268 if (obj->NonFailureIsHeapObject()) { | 236 if (obj->NonFailureIsHeapObject()) { |
269 heap->mark_compact_collector()->RecordSlot(p, p, obj); | 237 heap->mark_compact_collector()->RecordSlot(p, p, obj); |
270 MarkObject(heap, obj); | 238 MarkObject(heap, obj); |
271 } | 239 } |
272 } | 240 } |
273 | 241 |
274 INLINE(static void VisitPointers(Heap* heap, | 242 INLINE(static void VisitPointers(Heap* heap, |
275 Object** anchor, | 243 Object** anchor, |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 bytes_scanned_ = 0; | 1015 bytes_scanned_ = 0; |
1048 write_barriers_invoked_since_last_step_ = 0; | 1016 write_barriers_invoked_since_last_step_ = 0; |
1049 } | 1017 } |
1050 | 1018 |
1051 | 1019 |
1052 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 1020 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
1053 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 1021 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
1054 } | 1022 } |
1055 | 1023 |
1056 } } // namespace v8::internal | 1024 } } // namespace v8::internal |
OLD | NEW |