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

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

Issue 9104039: Revert memory saving change due to failures on multithreaded tests (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 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/spaces-inl.h ('k') | src/utils.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 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 490
491 void StoreBuffer::FindPointersToNewSpaceInMapsRegion( 491 void StoreBuffer::FindPointersToNewSpaceInMapsRegion(
492 Address start, 492 Address start,
493 Address end, 493 Address end,
494 ObjectSlotCallback slot_callback) { 494 ObjectSlotCallback slot_callback) {
495 Address map_aligned_start = MapStartAlign(start); 495 Address map_aligned_start = MapStartAlign(start);
496 Address map_aligned_end = MapEndAlign(end); 496 Address map_aligned_end = MapEndAlign(end);
497 497
498 ASSERT(map_aligned_start == start); 498 ASSERT(map_aligned_start == start);
499 ASSERT(map_aligned_end == end);
499 500
500 FindPointersToNewSpaceInMaps(map_aligned_start, 501 FindPointersToNewSpaceInMaps(map_aligned_start,
501 map_aligned_end, 502 map_aligned_end,
502 slot_callback); 503 slot_callback);
503 } 504 }
504 505
505 506
506 // This function iterates over all the pointers in a paged space in the heap, 507 // This function iterates over all the pointers in a paged space in the heap,
507 // looking for pointers into new space. Within the pages there may be dead 508 // looking for pointers into new space. Within the pages there may be dead
508 // objects that have not been overwritten by free spaces or fillers because of 509 // objects that have not been overwritten by free spaces or fillers because of
509 // lazy sweeping. These dead objects may not contain pointers to new space. 510 // lazy sweeping. These dead objects may not contain pointers to new space.
510 // The garbage areas that have been swept properly (these will normally be the 511 // The garbage areas that have been swept properly (these will normally be the
511 // large ones) will be marked with free space and filler map words. In 512 // large ones) will be marked with free space and filler map words. In
512 // addition any area that has never been used at all for object allocation must 513 // addition any area that has never been used at all for object allocation must
513 // be marked with a free space or filler. Because the free space and filler 514 // be marked with a free space or filler. Because the free space and filler
514 // maps do not move we can always recognize these even after a compaction. 515 // maps do not move we can always recognize these even after a compaction.
515 // Normal objects like FixedArrays and JSObjects should not contain references 516 // Normal objects like FixedArrays and JSObjects should not contain references
516 // to these maps. The special garbage section (see comment in spaces.h) is 517 // to these maps. The special garbage section (see comment in spaces.h) is
517 // skipped since it can contain absolutely anything. Any objects that are 518 // skipped since it can contain absolutely anything. Any objects that are
518 // allocated during iteration may or may not be visited by the iteration, but 519 // allocated during iteration may or may not be visited by the iteration, but
519 // they will not be partially visited. 520 // they will not be partially visited.
520 void StoreBuffer::FindPointersToNewSpaceOnPage( 521 void StoreBuffer::FindPointersToNewSpaceOnPage(
521 PagedSpace* space, 522 PagedSpace* space,
522 Page* page, 523 Page* page,
523 RegionCallback region_callback, 524 RegionCallback region_callback,
524 ObjectSlotCallback slot_callback) { 525 ObjectSlotCallback slot_callback) {
525 Address visitable_start = page->ObjectAreaStart(); 526 Address visitable_start = page->ObjectAreaStart();
527 Address end_of_page = page->ObjectAreaEnd();
526 528
527 Address visitable_end = visitable_start; 529 Address visitable_end = visitable_start;
528 530
529 Object* free_space_map = heap_->free_space_map(); 531 Object* free_space_map = heap_->free_space_map();
530 Object* two_pointer_filler_map = heap_->two_pointer_filler_map(); 532 Object* two_pointer_filler_map = heap_->two_pointer_filler_map();
531 533
532 while (true) { // While the page grows (doesn't normally happen). 534 while (visitable_end < end_of_page) {
533 Address end_of_page = page->ObjectAreaEnd(); 535 Object* o = *reinterpret_cast<Object**>(visitable_end);
534 while (visitable_end < end_of_page) { 536 // Skip fillers but not things that look like fillers in the special
535 Object* o = *reinterpret_cast<Object**>(visitable_end); 537 // garbage section which can contain anything.
536 // Skip fillers but not things that look like fillers in the special 538 if (o == free_space_map ||
537 // garbage section which can contain anything. 539 o == two_pointer_filler_map ||
538 if (o == free_space_map || 540 (visitable_end == space->top() && visitable_end != space->limit())) {
539 o == two_pointer_filler_map || 541 if (visitable_start != visitable_end) {
540 (visitable_end == space->top() && visitable_end != space->limit())) { 542 // After calling this the special garbage section may have moved.
541 if (visitable_start != visitable_end) { 543 (this->*region_callback)(visitable_start,
542 // After calling this the special garbage section may have moved. 544 visitable_end,
543 (this->*region_callback)(visitable_start, 545 slot_callback);
544 visitable_end, 546 if (visitable_end >= space->top() && visitable_end < space->limit()) {
545 slot_callback); 547 visitable_end = space->limit();
546 if (visitable_end >= space->top() && visitable_end < space->limit()) { 548 visitable_start = visitable_end;
547 visitable_end = space->limit(); 549 continue;
548 visitable_start = visitable_end;
549 continue;
550 }
551 } 550 }
552 if (visitable_end == space->top() && visitable_end != space->limit()) { 551 }
553 visitable_start = visitable_end = space->limit(); 552 if (visitable_end == space->top() && visitable_end != space->limit()) {
554 } else { 553 visitable_start = visitable_end = space->limit();
555 // At this point we are either at the start of a filler or we are at
556 // the point where the space->top() used to be before the
557 // visit_pointer_region call above. Either way we can skip the
558 // object at the current spot: We don't promise to visit objects
559 // allocated during heap traversal, and if space->top() moved then it
560 // must be because an object was allocated at this point.
561 visitable_start =
562 visitable_end + HeapObject::FromAddress(visitable_end)->Size();
563 intptr_t start_integer = reinterpret_cast<intptr_t>(visitable_start);
564 if ((start_integer & (Page::kGrowthUnit - 1)) == 0 &&
565 visitable_start != page->ObjectAreaEnd()) {
566 // Sometimes there is a little free-space object left at what used
567 // to be the end of the page. Due to object alignment restrictions
568 // (this is primarily an issue for maps on 64 bit) they never
569 // contain pointers. We skip them because the scanning logic on
570 // pages in FixedSpace spaces does not scan partial objects.
571 visitable_start = page->RoundUpToObjectAlignment(visitable_start);
572 }
573 visitable_end = visitable_start;
574 }
575 } else { 554 } else {
576 ASSERT(o != free_space_map); 555 // At this point we are either at the start of a filler or we are at
577 ASSERT(o != two_pointer_filler_map); 556 // the point where the space->top() used to be before the
578 ASSERT(visitable_end < space->top() || visitable_end >= space->limit()); 557 // visit_pointer_region call above. Either way we can skip the
579 visitable_end += kPointerSize; 558 // object at the current spot: We don't promise to visit objects
559 // allocated during heap traversal, and if space->top() moved then it
560 // must be because an object was allocated at this point.
561 visitable_start =
562 visitable_end + HeapObject::FromAddress(visitable_end)->Size();
563 visitable_end = visitable_start;
580 } 564 }
565 } else {
566 ASSERT(o != free_space_map);
567 ASSERT(o != two_pointer_filler_map);
568 ASSERT(visitable_end < space->top() || visitable_end >= space->limit());
569 visitable_end += kPointerSize;
581 } 570 }
582 ASSERT(visitable_end >= end_of_page);
583 // If the page did not grow we are done.
584 if (end_of_page == page->ObjectAreaEnd()) break;
585 } 571 }
586 ASSERT(visitable_end == page->ObjectAreaEnd()); 572 ASSERT(visitable_end == end_of_page);
587 if (visitable_start != visitable_end) { 573 if (visitable_start != visitable_end) {
588 (this->*region_callback)(visitable_start, 574 (this->*region_callback)(visitable_start,
589 visitable_end, 575 visitable_end,
590 slot_callback); 576 slot_callback);
591 } 577 }
592 } 578 }
593 579
594 580
595 void StoreBuffer::IteratePointersInStoreBuffer( 581 void StoreBuffer::IteratePointersInStoreBuffer(
596 ObjectSlotCallback slot_callback) { 582 ObjectSlotCallback slot_callback) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); 710 heap_->isolate()->counters()->store_buffer_compactions()->Increment();
725 CheckForFullBuffer(); 711 CheckForFullBuffer();
726 } 712 }
727 713
728 714
729 void StoreBuffer::CheckForFullBuffer() { 715 void StoreBuffer::CheckForFullBuffer() {
730 EnsureSpace(kStoreBufferSize * 2); 716 EnsureSpace(kStoreBufferSize * 2);
731 } 717 }
732 718
733 } } // namespace v8::internal 719 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces-inl.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698