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

Side by Side Diff: src/mark-compact.cc

Issue 1700005: Fix bugs introduced by r4475:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 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 | « no previous file | src/spaces.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 1049
1050 1050
1051 template<MarkCompactCollector::AllocationFunction Alloc, 1051 template<MarkCompactCollector::AllocationFunction Alloc,
1052 MarkCompactCollector::ProcessNonLiveFunction ProcessNonLive> 1052 MarkCompactCollector::ProcessNonLiveFunction ProcessNonLive>
1053 void MarkCompactCollector::EncodeForwardingAddressesInPagedSpace( 1053 void MarkCompactCollector::EncodeForwardingAddressesInPagedSpace(
1054 PagedSpace* space) { 1054 PagedSpace* space) {
1055 PageIterator it(space, PageIterator::PAGES_IN_USE); 1055 PageIterator it(space, PageIterator::PAGES_IN_USE);
1056 while (it.has_next()) { 1056 while (it.has_next()) {
1057 Page* p = it.next(); 1057 Page* p = it.next();
1058 1058
1059 if (p->WasInUseBeforeMC()) { 1059 // The offset of each live object in the page from the first live object
1060 // The offset of each live object in the page from the first live object 1060 // in the page.
1061 // in the page. 1061 int offset = 0;
1062 int offset = 0; 1062 EncodeForwardingAddressesInRange<Alloc,
1063 EncodeForwardingAddressesInRange<Alloc, 1063 EncodeForwardingAddressInPagedSpace,
1064 EncodeForwardingAddressInPagedSpace, 1064 ProcessNonLive>(
1065 ProcessNonLive>( 1065 p->ObjectAreaStart(),
1066 p->ObjectAreaStart(), 1066 p->AllocationTop(),
1067 p->AllocationTop(), 1067 &offset);
1068 &offset);
1069 } else {
1070 // Mark whole unused page as a free region.
1071 EncodeFreeRegion(p->ObjectAreaStart(),
1072 p->AllocationTop() - p->ObjectAreaStart());
1073 }
1074 } 1068 }
1075 } 1069 }
1076 1070
1077 1071
1078 // We scavange new space simultaneously with sweeping. This is done in two 1072 // We scavange new space simultaneously with sweeping. This is done in two
1079 // passes. 1073 // passes.
1080 // The first pass migrates all alive objects from one semispace to another or 1074 // The first pass migrates all alive objects from one semispace to another or
1081 // promotes them to old space. Forwading address is written directly into 1075 // promotes them to old space. Forwading address is written directly into
1082 // first word of object without any encoding. If object is dead we are writing 1076 // first word of object without any encoding. If object is dead we are writing
1083 // NULL as a forwarding address. 1077 // NULL as a forwarding address.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 1384
1391 if (last_free_size > 0) { 1385 if (last_free_size > 0) {
1392 // There was a free ending area on the previous page. 1386 // There was a free ending area on the previous page.
1393 // Deallocate it without putting it into freelist and move allocation 1387 // Deallocate it without putting it into freelist and move allocation
1394 // top to the beginning of this free area. 1388 // top to the beginning of this free area.
1395 dealloc(last_free_start, last_free_size, false); 1389 dealloc(last_free_start, last_free_size, false);
1396 new_allocation_top = last_free_start; 1390 new_allocation_top = last_free_start;
1397 } 1391 }
1398 1392
1399 if (new_allocation_top != NULL) { 1393 if (new_allocation_top != NULL) {
1394 #ifdef DEBUG
1400 Page* new_allocation_top_page = Page::FromAllocationTop(new_allocation_top); 1395 Page* new_allocation_top_page = Page::FromAllocationTop(new_allocation_top);
1401
1402 ASSERT(((first_empty_page == NULL) && 1396 ASSERT(((first_empty_page == NULL) &&
Mads Ager (chromium) 2010/04/23 06:48:37 Now that you have an #ifdef DEBUG here in any case
1403 (new_allocation_top_page == space->AllocationTopPage())) || 1397 (new_allocation_top_page == space->AllocationTopPage())) ||
1404 ((first_empty_page != NULL) && (last_free_size > 0) && 1398 ((first_empty_page != NULL) && (last_free_size > 0) &&
1405 (new_allocation_top_page == prec_first_empty_page)) || 1399 (new_allocation_top_page == prec_first_empty_page)) ||
1406 ((first_empty_page != NULL) && (last_free_size == 0) && 1400 ((first_empty_page != NULL) && (last_free_size == 0) &&
1407 (new_allocation_top_page == first_empty_page))); 1401 (new_allocation_top_page == first_empty_page)));
1402 #endif
1408 1403
1409 space->SetTop(new_allocation_top, 1404 space->SetTop(new_allocation_top);
1410 new_allocation_top_page->ObjectAreaEnd());
1411 } 1405 }
1412 } 1406 }
1413 1407
1414 1408
1415 void MarkCompactCollector::DeallocateOldPointerBlock(Address start, 1409 void MarkCompactCollector::DeallocateOldPointerBlock(Address start,
1416 int size_in_bytes, 1410 int size_in_bytes,
1417 bool add_to_freelist) { 1411 bool add_to_freelist) {
1418 Heap::ClearRSetRange(start, size_in_bytes); 1412 Heap::ClearRSetRange(start, size_in_bytes);
1419 Heap::old_pointer_space()->Free(start, size_in_bytes, add_to_freelist); 1413 Heap::old_pointer_space()->Free(start, size_in_bytes, add_to_freelist);
1420 } 1414 }
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 #ifdef ENABLE_LOGGING_AND_PROFILING 2303 #ifdef ENABLE_LOGGING_AND_PROFILING
2310 if (obj->IsCode()) { 2304 if (obj->IsCode()) {
2311 PROFILE(CodeDeleteEvent(obj->address())); 2305 PROFILE(CodeDeleteEvent(obj->address()));
2312 } else if (obj->IsJSFunction()) { 2306 } else if (obj->IsJSFunction()) {
2313 PROFILE(FunctionDeleteEvent(obj->address())); 2307 PROFILE(FunctionDeleteEvent(obj->address()));
2314 } 2308 }
2315 #endif 2309 #endif
2316 } 2310 }
2317 2311
2318 } } // namespace v8::internal 2312 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698