Chromium Code Reviews

Side by Side Diff: src/spaces.cc

Issue 7326012: Split single slots buffer into per page slots buffers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
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 418 matching lines...)
429 Executability executable, 429 Executability executable,
430 Space* owner) { 430 Space* owner) {
431 MemoryChunk* chunk = FromAddress(base); 431 MemoryChunk* chunk = FromAddress(base);
432 432
433 ASSERT(base == chunk->address()); 433 ASSERT(base == chunk->address());
434 434
435 chunk->heap_ = heap; 435 chunk->heap_ = heap;
436 chunk->size_ = size; 436 chunk->size_ = size;
437 chunk->flags_ = 0; 437 chunk->flags_ = 0;
438 chunk->set_owner(owner); 438 chunk->set_owner(owner);
439 chunk->slots_buffer_ = NULL;
439 Bitmap::Clear(chunk); 440 Bitmap::Clear(chunk);
440 chunk->initialize_scan_on_scavenge(false); 441 chunk->initialize_scan_on_scavenge(false);
441 442
442 ASSERT(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset); 443 ASSERT(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset);
443 444
444 if (executable == EXECUTABLE) chunk->SetFlag(IS_EXECUTABLE); 445 if (executable == EXECUTABLE) chunk->SetFlag(IS_EXECUTABLE);
445 446
446 if (owner == heap->old_data_space()) chunk->SetFlag(CONTAINS_ONLY_DATA); 447 if (owner == heap->old_data_space()) chunk->SetFlag(CONTAINS_ONLY_DATA);
447 448
448 return chunk; 449 return chunk;
(...skipping 1523 matching lines...)
1972 // Stop lazy sweeping for the space. 1973 // Stop lazy sweeping for the space.
1973 first_unswept_page_ = last_unswept_page_ = Page::FromAddress(NULL); 1974 first_unswept_page_ = last_unswept_page_ = Page::FromAddress(NULL);
1974 1975
1975 // Clear the free list before a full GC---it will be rebuilt afterward. 1976 // Clear the free list before a full GC---it will be rebuilt afterward.
1976 free_list_.Reset(); 1977 free_list_.Reset();
1977 1978
1978 // Clear EVACUATED flag from all pages. 1979 // Clear EVACUATED flag from all pages.
1979 PageIterator it(this); 1980 PageIterator it(this);
1980 while (it.has_next()) { 1981 while (it.has_next()) {
1981 Page* page = it.next(); 1982 Page* page = it.next();
1982 page->ClearFlag(MemoryChunk::EVACUATED); 1983 page->ClearSwept();
1983 } 1984 }
1984 } 1985 }
1985 1986
1986 1987
1987 bool PagedSpace::ReserveSpace(int size_in_bytes) { 1988 bool PagedSpace::ReserveSpace(int size_in_bytes) {
1988 ASSERT(size_in_bytes <= Page::kMaxHeapObjectSize); 1989 ASSERT(size_in_bytes <= Page::kMaxHeapObjectSize);
1989 ASSERT(size_in_bytes == RoundSizeDownToObjectAlignment(size_in_bytes)); 1990 ASSERT(size_in_bytes == RoundSizeDownToObjectAlignment(size_in_bytes));
1990 Address current_top = allocation_info_.top; 1991 Address current_top = allocation_info_.top;
1991 Address new_top = current_top + size_in_bytes; 1992 Address new_top = current_top + size_in_bytes;
1992 if (new_top <= allocation_info_.limit) return true; 1993 if (new_top <= allocation_info_.limit) return true;
(...skipping 23 matching lines...)
2016 2017
2017 bool PagedSpace::AdvanceSweeper(intptr_t bytes_to_sweep) { 2018 bool PagedSpace::AdvanceSweeper(intptr_t bytes_to_sweep) {
2018 if (IsSweepingComplete()) return true; 2019 if (IsSweepingComplete()) return true;
2019 2020
2020 int freed_bytes = 0; 2021 int freed_bytes = 0;
2021 Page* last = last_unswept_page_->next_page(); 2022 Page* last = last_unswept_page_->next_page();
2022 Page* p = first_unswept_page_; 2023 Page* p = first_unswept_page_;
2023 do { 2024 do {
2024 Page* next_page = p->next_page(); 2025 Page* next_page = p->next_page();
2025 // Evacuation candidates were swept by evacuator. 2026 // Evacuation candidates were swept by evacuator.
2026 if (!p->IsEvacuationCandidate() && !p->WasEvacuated()) { 2027 if (!p->IsEvacuationCandidate() &&
2028 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) &&
2029 !p->WasSwept()) {
2027 freed_bytes += MarkCompactCollector::SweepConservatively(this, p); 2030 freed_bytes += MarkCompactCollector::SweepConservatively(this, p);
2028 } 2031 }
2029 p = next_page; 2032 p = next_page;
2030 } while (p != last && freed_bytes < bytes_to_sweep); 2033 } while (p != last && freed_bytes < bytes_to_sweep);
2031 2034
2032 if (p == last) { 2035 if (p == last) {
2033 last_unswept_page_ = first_unswept_page_ = Page::FromAddress(NULL); 2036 last_unswept_page_ = first_unswept_page_ = Page::FromAddress(NULL);
2034 } else { 2037 } else {
2035 first_unswept_page_ = p; 2038 first_unswept_page_ = p;
2036 } 2039 }
(...skipping 530 matching lines...)
2567 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { 2570 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
2568 if (obj->IsCode()) { 2571 if (obj->IsCode()) {
2569 Code* code = Code::cast(obj); 2572 Code* code = Code::cast(obj);
2570 isolate->code_kind_statistics()[code->kind()] += code->Size(); 2573 isolate->code_kind_statistics()[code->kind()] += code->Size();
2571 } 2574 }
2572 } 2575 }
2573 } 2576 }
2574 #endif // DEBUG 2577 #endif // DEBUG
2575 2578
2576 } } // namespace v8::internal 2579 } } // namespace v8::internal
OLDNEW
« src/mark-compact.cc ('K') | « src/spaces.h ('k') | src/x64/code-stubs-x64.h » ('j') | no next file with comments »

Powered by Google App Engine