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

Side by Side Diff: src/spaces.cc

Issue 9173001: Make heap size estimation more accurate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Improved test case to do exact checking. Created 8 years, 11 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.h ('k') | test/cctest/test-heap.cc » ('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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 PageIterator it(this); 742 PageIterator it(this);
743 int count = 0; 743 int count = 0;
744 while (it.has_next()) { 744 while (it.has_next()) {
745 it.next(); 745 it.next();
746 count++; 746 count++;
747 } 747 }
748 return count; 748 return count;
749 } 749 }
750 750
751 751
752 intptr_t PagedSpace::SizeOfObjectsSlow() {
Vyacheslav Egorov (Chromium) 2012/01/10 17:42:43 we will call this function at least once at the en
Michael Starzinger 2012/01/11 09:55:57 Done. Yes, we can.
753 PageIterator it(this);
754 intptr_t size_of_objects = accounting_stats_.Size();
755 while (it.has_next()) {
756 Page* p = it.next();
757 if (!p->WasSwept()) {
758 size_of_objects -= Page::kObjectAreaSize;
759 size_of_objects += p->LiveBytes();
760 }
761 }
762 return size_of_objects - (limit() - top());
763 }
764
765
752 void PagedSpace::ReleasePage(Page* page) { 766 void PagedSpace::ReleasePage(Page* page) {
753 ASSERT(page->LiveBytes() == 0); 767 ASSERT(page->LiveBytes() == 0);
754 768
755 // Adjust list of unswept pages if the page is the head of the list. 769 // Adjust list of unswept pages if the page is the head of the list.
756 if (first_unswept_page_ == page) { 770 if (first_unswept_page_ == page) {
757 first_unswept_page_ = page->next_page(); 771 first_unswept_page_ = page->next_page();
758 if (first_unswept_page_ == anchor()) { 772 if (first_unswept_page_ == anchor()) {
759 first_unswept_page_ = Page::FromAddress(NULL); 773 first_unswept_page_ = Page::FromAddress(NULL);
760 } 774 }
761 } 775 }
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 object->ShortPrint(); 2672 object->ShortPrint();
2659 PrintF("\n"); 2673 PrintF("\n");
2660 } 2674 }
2661 printf(" --------------------------------------\n"); 2675 printf(" --------------------------------------\n");
2662 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 2676 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
2663 } 2677 }
2664 2678
2665 #endif // DEBUG 2679 #endif // DEBUG
2666 2680
2667 } } // namespace v8::internal 2681 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698