Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/objects-visiting-inl.h

Issue 10996018: Allow partial scanning of large arrays in order to avoid (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-visiting.h ('k') | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 // When map collection is enabled we have to mark through map's 257 // When map collection is enabled we have to mark through map's
258 // transitions and back pointers in a special way to make these links 258 // transitions and back pointers in a special way to make these links
259 // weak. Only maps for subclasses of JSReceiver can have transitions. 259 // weak. Only maps for subclasses of JSReceiver can have transitions.
260 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); 260 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
261 if (FLAG_collect_maps && 261 if (FLAG_collect_maps &&
262 map_object->instance_type() >= FIRST_JS_RECEIVER_TYPE) { 262 map_object->instance_type() >= FIRST_JS_RECEIVER_TYPE) {
263 MarkMapContents(heap, map_object); 263 MarkMapContents(heap, map_object);
264 } else { 264 } else {
265 StaticVisitor::VisitPointers(heap, 265 Object** start_slot =
266 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset), 266 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset);
267 HeapObject::RawField(object, Map::kPointerFieldsEndOffset)); 267 Object** end_slot =
268 HeapObject::RawField(object, Map::kPointerFieldsEndOffset);
269 StaticVisitor::VisitPointers(heap, start_slot, start_slot, end_slot);
268 } 270 }
269 } 271 }
270 272
271 273
272 template<typename StaticVisitor> 274 template<typename StaticVisitor>
273 void StaticMarkingVisitor<StaticVisitor>::VisitCode( 275 void StaticMarkingVisitor<StaticVisitor>::VisitCode(
274 Map* map, HeapObject* object) { 276 Map* map, HeapObject* object) {
275 Heap* heap = map->GetHeap(); 277 Heap* heap = map->GetHeap();
276 Code* code = Code::cast(object); 278 Code* code = Code::cast(object);
277 if (FLAG_cleanup_code_caches_at_gc) { 279 if (FLAG_cleanup_code_caches_at_gc) {
278 code->ClearTypeFeedbackCells(heap); 280 code->ClearTypeFeedbackCells(heap);
279 } 281 }
280 code->CodeIterateBody<StaticVisitor>(heap); 282 code->CodeIterateBody<StaticVisitor>(heap);
281 } 283 }
282 284
283 285
284 template<typename StaticVisitor> 286 template<typename StaticVisitor>
285 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp( 287 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(
286 Map* map, HeapObject* object) { 288 Map* map, HeapObject* object) {
287 int last_property_offset = 289 int last_property_offset =
288 JSRegExp::kSize + kPointerSize * map->inobject_properties(); 290 JSRegExp::kSize + kPointerSize * map->inobject_properties();
289 StaticVisitor::VisitPointers(map->GetHeap(), 291 Object** start_slot =
290 HeapObject::RawField(object, JSRegExp::kPropertiesOffset), 292 HeapObject::RawField(object, JSRegExp::kPropertiesOffset);
291 HeapObject::RawField(object, last_property_offset)); 293 Object** end_slot =
294 HeapObject::RawField(object, last_property_offset);
295 StaticVisitor::VisitPointers(
296 map->GetHeap(), start_slot, start_slot, end_slot);
292 } 297 }
293 298
294 299
295 template<typename StaticVisitor> 300 template<typename StaticVisitor>
296 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( 301 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents(
297 Heap* heap, Map* map) { 302 Heap* heap, Map* map) {
298 // Make sure that the back pointer stored either in the map itself or 303 // Make sure that the back pointer stored either in the map itself or
299 // inside its transitions array is marked. Skip recording the back 304 // inside its transitions array is marked. Skip recording the back
300 // pointer slot since map space is not compacted. 305 // pointer slot since map space is not compacted.
301 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); 306 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer()));
302 307
303 // Treat pointers in the transitions array as weak and also mark that 308 // Treat pointers in the transitions array as weak and also mark that
304 // array to prevent visiting it later. Skip recording the transition 309 // array to prevent visiting it later. Skip recording the transition
305 // array slot, since it will be implicitly recorded when the pointer 310 // array slot, since it will be implicitly recorded when the pointer
306 // fields of this map are visited. 311 // fields of this map are visited.
307 TransitionArray* transitions = map->unchecked_transition_array(); 312 TransitionArray* transitions = map->unchecked_transition_array();
308 if (transitions->IsTransitionArray()) { 313 if (transitions->IsTransitionArray()) {
309 MarkTransitionArray(heap, transitions); 314 MarkTransitionArray(heap, transitions);
310 } else { 315 } else {
311 // Already marked by marking map->GetBackPointer() above. 316 // Already marked by marking map->GetBackPointer() above.
312 ASSERT(transitions->IsMap() || transitions->IsUndefined()); 317 ASSERT(transitions->IsMap() || transitions->IsUndefined());
313 } 318 }
314 319
315 // Mark the pointer fields of the Map. Since the transitions array has 320 // Mark the pointer fields of the Map. Since the transitions array has
316 // been marked already, it is fine that one of these fields contains a 321 // been marked already, it is fine that one of these fields contains a
317 // pointer to it. 322 // pointer to it.
318 StaticVisitor::VisitPointers(heap, 323 Object** start_slot =
319 HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), 324 HeapObject::RawField(map, Map::kPointerFieldsBeginOffset);
320 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); 325 Object** end_slot =
326 HeapObject::RawField(map, Map::kPointerFieldsEndOffset);
327 StaticVisitor::VisitPointers(heap, start_slot, start_slot, end_slot);
321 } 328 }
322 329
323 330
324 template<typename StaticVisitor> 331 template<typename StaticVisitor>
325 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( 332 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray(
326 Heap* heap, TransitionArray* transitions) { 333 Heap* heap, TransitionArray* transitions) {
327 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; 334 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return;
328 335
329 // Skip recording the descriptors_pointer slot since the cell space 336 // Skip recording the descriptors_pointer slot since the cell space
330 // is not compacted and descriptors are referenced through a cell. 337 // is not compacted and descriptors are referenced through a cell.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 RelocIterator it(this, mode_mask); 407 RelocIterator it(this, mode_mask);
401 for (; !it.done(); it.next()) { 408 for (; !it.done(); it.next()) {
402 it.rinfo()->template Visit<StaticVisitor>(heap); 409 it.rinfo()->template Visit<StaticVisitor>(heap);
403 } 410 }
404 } 411 }
405 412
406 413
407 } } // namespace v8::internal 414 } } // namespace v8::internal
408 415
409 #endif // V8_OBJECTS_VISITING_INL_H_ 416 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/objects-visiting.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698