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

Side by Side Diff: src/spaces.cc

Issue 7712026: Clear mark bits while sweeping and not explicitly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Correctly handle incremental marking as well. Created 9 years, 4 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/mark-compact.cc ('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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 1923
1924 void PagedSpace::PrepareForMarkCompact() { 1924 void PagedSpace::PrepareForMarkCompact() {
1925 // We don't have a linear allocation area while sweeping. It will be restored 1925 // We don't have a linear allocation area while sweeping. It will be restored
1926 // on the first allocation after the sweep. 1926 // on the first allocation after the sweep.
1927 // Mark the old linear allocation area with a free space map so it can be 1927 // Mark the old linear allocation area with a free space map so it can be
1928 // skipped when scanning the heap. 1928 // skipped when scanning the heap.
1929 int old_linear_size = static_cast<int>(limit() - top()); 1929 int old_linear_size = static_cast<int>(limit() - top());
1930 Free(top(), old_linear_size); 1930 Free(top(), old_linear_size);
1931 SetTop(NULL, NULL); 1931 SetTop(NULL, NULL);
1932 1932
1933 // Stop lazy sweeping for the space. 1933 // Stop lazy sweeping and clear marking bits for the space.
1934 if (FLAG_trace_gc && first_unswept_page_ != NULL) { 1934 if (first_unswept_page_ != NULL) {
1935 int pages = 0; 1935 int pages = 0;
1936 Page* p = last_unswept_page_; 1936 Page* last = last_unswept_page_->next_page();
1937 Page* p = first_unswept_page_;
1937 do { 1938 do {
1938 pages++; 1939 pages++;
1940 Bitmap::Clear(p);
1939 p = p->next_page(); 1941 p = p->next_page();
1940 } while (p != last_unswept_page_); 1942 } while (p != last);
1941 PrintF("Abandoned %d unswept pages\n", pages); 1943 if (FLAG_trace_gc) {
1944 PrintF("Abandoned %d unswept pages\n", pages);
1945 }
1942 } 1946 }
1943 first_unswept_page_ = last_unswept_page_ = Page::FromAddress(NULL); 1947 first_unswept_page_ = last_unswept_page_ = Page::FromAddress(NULL);
1944 1948
1945 // Clear the free list before a full GC---it will be rebuilt afterward. 1949 // Clear the free list before a full GC---it will be rebuilt afterward.
1946 free_list_.Reset(); 1950 free_list_.Reset();
1947 1951
1948 // Clear EVACUATED flag from all pages. 1952 // Clear WAS_SWEPT and WAS_SWEPT_CONSERVATIVELY flags from all pages.
1949 PageIterator it(this); 1953 PageIterator it(this);
1950 while (it.has_next()) { 1954 while (it.has_next()) {
1951 Page* page = it.next(); 1955 Page* page = it.next();
1952 page->ClearSwept(); 1956 page->ClearSwept();
1957 page->ClearFlag(MemoryChunk::WAS_SWEPT_CONSERVATIVELY);
1953 } 1958 }
1954 } 1959 }
1955 1960
1956 1961
1957 bool PagedSpace::ReserveSpace(int size_in_bytes) { 1962 bool PagedSpace::ReserveSpace(int size_in_bytes) {
1958 ASSERT(size_in_bytes <= Page::kMaxHeapObjectSize); 1963 ASSERT(size_in_bytes <= Page::kMaxHeapObjectSize);
1959 ASSERT(size_in_bytes == RoundSizeDownToObjectAlignment(size_in_bytes)); 1964 ASSERT(size_in_bytes == RoundSizeDownToObjectAlignment(size_in_bytes));
1960 Address current_top = allocation_info_.top; 1965 Address current_top = allocation_info_.top;
1961 Address new_top = current_top + size_in_bytes; 1966 Address new_top = current_top + size_in_bytes;
1962 if (new_top <= allocation_info_.limit) return true; 1967 if (new_top <= allocation_info_.limit) return true;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { 2523 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
2519 if (obj->IsCode()) { 2524 if (obj->IsCode()) {
2520 Code* code = Code::cast(obj); 2525 Code* code = Code::cast(obj);
2521 isolate->code_kind_statistics()[code->kind()] += code->Size(); 2526 isolate->code_kind_statistics()[code->kind()] += code->Size();
2522 } 2527 }
2523 } 2528 }
2524 } 2529 }
2525 #endif // DEBUG 2530 #endif // DEBUG
2526 2531
2527 } } // namespace v8::internal 2532 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698