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

Side by Side Diff: src/spaces.cc

Issue 9241010: Fix corner-case in heap size estimation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. 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') | 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 first_unswept_page_ = page->next_page(); 874 first_unswept_page_ = page->next_page();
875 if (first_unswept_page_ == anchor()) { 875 if (first_unswept_page_ == anchor()) {
876 first_unswept_page_ = Page::FromAddress(NULL); 876 first_unswept_page_ = Page::FromAddress(NULL);
877 } 877 }
878 } 878 }
879 879
880 if (page->WasSwept()) { 880 if (page->WasSwept()) {
881 intptr_t size = free_list_.EvictFreeListItems(page); 881 intptr_t size = free_list_.EvictFreeListItems(page);
882 accounting_stats_.AllocateBytes(size); 882 accounting_stats_.AllocateBytes(size);
883 ASSERT_EQ(Page::kObjectAreaSize, static_cast<int>(size)); 883 ASSERT_EQ(Page::kObjectAreaSize, static_cast<int>(size));
884 } else {
885 DecreaseUnsweptFreeBytes(page);
884 } 886 }
885 887
886 if (Page::FromAllocationTop(allocation_info_.top) == page) { 888 if (Page::FromAllocationTop(allocation_info_.top) == page) {
887 allocation_info_.top = allocation_info_.limit = NULL; 889 allocation_info_.top = allocation_info_.limit = NULL;
888 } 890 }
889 891
890 intptr_t size = page->ObjectAreaEnd() - page->ObjectAreaStart(); 892 intptr_t size = page->ObjectAreaEnd() - page->ObjectAreaStart();
891 893
892 page->Unlink(); 894 page->Unlink();
893 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) { 895 if (page->IsFlagSet(MemoryChunk::CONTAINS_ONLY_DATA)) {
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 2275
2274 intptr_t freed_bytes = 0; 2276 intptr_t freed_bytes = 0;
2275 Page* p = first_unswept_page_; 2277 Page* p = first_unswept_page_;
2276 do { 2278 do {
2277 Page* next_page = p->next_page(); 2279 Page* next_page = p->next_page();
2278 if (ShouldBeSweptLazily(p)) { 2280 if (ShouldBeSweptLazily(p)) {
2279 if (FLAG_gc_verbose) { 2281 if (FLAG_gc_verbose) {
2280 PrintF("Sweeping 0x%" V8PRIxPTR " lazily advanced.\n", 2282 PrintF("Sweeping 0x%" V8PRIxPTR " lazily advanced.\n",
2281 reinterpret_cast<intptr_t>(p)); 2283 reinterpret_cast<intptr_t>(p));
2282 } 2284 }
2283 unswept_free_bytes_ -= (Page::kObjectAreaSize - p->LiveBytes()); 2285 DecreaseUnsweptFreeBytes(p);
2284 freed_bytes += MarkCompactCollector::SweepConservatively(this, p); 2286 freed_bytes += MarkCompactCollector::SweepConservatively(this, p);
2285 } 2287 }
2286 p = next_page; 2288 p = next_page;
2287 } while (p != anchor() && freed_bytes < bytes_to_sweep); 2289 } while (p != anchor() && freed_bytes < bytes_to_sweep);
2288 2290
2289 if (p == anchor()) { 2291 if (p == anchor()) {
2290 first_unswept_page_ = Page::FromAddress(NULL); 2292 first_unswept_page_ = Page::FromAddress(NULL);
2291 } else { 2293 } else {
2292 first_unswept_page_ = p; 2294 first_unswept_page_ = p;
2293 } 2295 }
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 object->ShortPrint(); 2832 object->ShortPrint();
2831 PrintF("\n"); 2833 PrintF("\n");
2832 } 2834 }
2833 printf(" --------------------------------------\n"); 2835 printf(" --------------------------------------\n");
2834 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 2836 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
2835 } 2837 }
2836 2838
2837 #endif // DEBUG 2839 #endif // DEBUG
2838 2840
2839 } } // namespace v8::internal 2841 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698