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

Side by Side Diff: src/store-buffer.cc

Issue 183553003: Deal with filler object map pointers in the ool constant pool correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update comment Created 6 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // This function iterates over all the pointers in a paged space in the heap, 502 // This function iterates over all the pointers in a paged space in the heap,
503 // looking for pointers into new space. Within the pages there may be dead 503 // looking for pointers into new space. Within the pages there may be dead
504 // objects that have not been overwritten by free spaces or fillers because of 504 // objects that have not been overwritten by free spaces or fillers because of
505 // lazy sweeping. These dead objects may not contain pointers to new space. 505 // lazy sweeping. These dead objects may not contain pointers to new space.
506 // The garbage areas that have been swept properly (these will normally be the 506 // The garbage areas that have been swept properly (these will normally be the
507 // large ones) will be marked with free space and filler map words. In 507 // large ones) will be marked with free space and filler map words. In
508 // addition any area that has never been used at all for object allocation must 508 // addition any area that has never been used at all for object allocation must
509 // be marked with a free space or filler. Because the free space and filler 509 // be marked with a free space or filler. Because the free space and filler
510 // maps do not move we can always recognize these even after a compaction. 510 // maps do not move we can always recognize these even after a compaction.
511 // Normal objects like FixedArrays and JSObjects should not contain references 511 // Normal objects like FixedArrays and JSObjects should not contain references
512 // to these maps. The special garbage section (see comment in spaces.h) is 512 // to these maps. Constant pool array objects may contain references to these
513 // skipped since it can contain absolutely anything. Any objects that are 513 // maps, however, constant pool arrays cannot contain pointers to new space
514 // allocated during iteration may or may not be visited by the iteration, but 514 // objects, therefore they are skipped. The special garbage section (see
515 // they will not be partially visited. 515 // comment in spaces.h) is skipped since it can contain absolutely anything.
516 // Any objects that are allocated during iteration may or may not be visited by
517 // the iteration, but they will not be partially visited.
516 void StoreBuffer::FindPointersToNewSpaceOnPage( 518 void StoreBuffer::FindPointersToNewSpaceOnPage(
517 PagedSpace* space, 519 PagedSpace* space,
518 Page* page, 520 Page* page,
519 RegionCallback region_callback, 521 RegionCallback region_callback,
520 ObjectSlotCallback slot_callback, 522 ObjectSlotCallback slot_callback,
521 bool clear_maps) { 523 bool clear_maps) {
522 Address visitable_start = page->area_start(); 524 Address visitable_start = page->area_start();
523 Address end_of_page = page->area_end(); 525 Address end_of_page = page->area_end();
524 526
525 Address visitable_end = visitable_start; 527 Address visitable_end = visitable_start;
526 528
527 Object* free_space_map = heap_->free_space_map(); 529 Object* free_space_map = heap_->free_space_map();
528 Object* two_pointer_filler_map = heap_->two_pointer_filler_map(); 530 Object* two_pointer_filler_map = heap_->two_pointer_filler_map();
531 Object* constant_pool_array_map = heap_->constant_pool_array_map();
529 532
530 while (visitable_end < end_of_page) { 533 while (visitable_end < end_of_page) {
531 Object* o = *reinterpret_cast<Object**>(visitable_end); 534 Object* o = *reinterpret_cast<Object**>(visitable_end);
532 // Skip fillers but not things that look like fillers in the special 535 // Skip fillers or constant pool arrays (which never contain new-space
533 // garbage section which can contain anything. 536 // pointers but can contain pointers which can be confused for fillers)
537 // but not things that look like fillers in the special garbage section
538 // which can contain anything.
534 if (o == free_space_map || 539 if (o == free_space_map ||
535 o == two_pointer_filler_map || 540 o == two_pointer_filler_map ||
541 o == constant_pool_array_map ||
536 (visitable_end == space->top() && visitable_end != space->limit())) { 542 (visitable_end == space->top() && visitable_end != space->limit())) {
537 if (visitable_start != visitable_end) { 543 if (visitable_start != visitable_end) {
538 // After calling this the special garbage section may have moved. 544 // After calling this the special garbage section may have moved.
539 (this->*region_callback)(visitable_start, 545 (this->*region_callback)(visitable_start,
540 visitable_end, 546 visitable_end,
541 slot_callback, 547 slot_callback,
542 clear_maps); 548 clear_maps);
543 if (visitable_end >= space->top() && visitable_end < space->limit()) { 549 if (visitable_end >= space->top() && visitable_end < space->limit()) {
544 visitable_end = space->limit(); 550 visitable_end = space->limit();
545 visitable_start = visitable_end; 551 visitable_start = visitable_end;
546 continue; 552 continue;
547 } 553 }
548 } 554 }
549 if (visitable_end == space->top() && visitable_end != space->limit()) { 555 if (visitable_end == space->top() && visitable_end != space->limit()) {
550 visitable_start = visitable_end = space->limit(); 556 visitable_start = visitable_end = space->limit();
551 } else { 557 } else {
552 // At this point we are either at the start of a filler or we are at 558 // At this point we are either at the start of a filler, a
553 // the point where the space->top() used to be before the 559 // constant pool array, or we are at the point where the space->top()
554 // visit_pointer_region call above. Either way we can skip the 560 // used to be before the visit_pointer_region call above. Either way we
555 // object at the current spot: We don't promise to visit objects 561 // can skip the object at the current spot: We don't promise to visit
556 // allocated during heap traversal, and if space->top() moved then it 562 // objects allocated during heap traversal, and if space->top() moved
557 // must be because an object was allocated at this point. 563 // then it must be because an object was allocated at this point.
558 visitable_start = 564 visitable_start =
559 visitable_end + HeapObject::FromAddress(visitable_end)->Size(); 565 visitable_end + HeapObject::FromAddress(visitable_end)->Size();
560 visitable_end = visitable_start; 566 visitable_end = visitable_start;
561 } 567 }
562 } else { 568 } else {
563 ASSERT(o != free_space_map); 569 ASSERT(o != free_space_map);
564 ASSERT(o != two_pointer_filler_map); 570 ASSERT(o != two_pointer_filler_map);
571 ASSERT(o != constant_pool_array_map);
565 ASSERT(visitable_end < space->top() || visitable_end >= space->limit()); 572 ASSERT(visitable_end < space->top() || visitable_end >= space->limit());
566 visitable_end += kPointerSize; 573 visitable_end += kPointerSize;
567 } 574 }
568 } 575 }
569 ASSERT(visitable_end == end_of_page); 576 ASSERT(visitable_end == end_of_page);
570 if (visitable_start != visitable_end) { 577 if (visitable_start != visitable_end) {
571 (this->*region_callback)(visitable_start, 578 (this->*region_callback)(visitable_start,
572 visitable_end, 579 visitable_end,
573 slot_callback, 580 slot_callback,
574 clear_maps); 581 clear_maps);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 } 731 }
725 old_buffer_is_sorted_ = false; 732 old_buffer_is_sorted_ = false;
726 old_buffer_is_filtered_ = false; 733 old_buffer_is_filtered_ = false;
727 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); 734 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2);
728 ASSERT(old_top_ <= old_limit_); 735 ASSERT(old_top_ <= old_limit_);
729 } 736 }
730 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); 737 heap_->isolate()->counters()->store_buffer_compactions()->Increment();
731 } 738 }
732 739
733 } } // namespace v8::internal 740 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698