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

Side by Side Diff: src/heap.cc

Issue 5798002: Provide baseline for new GC infrastructure. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects. 219 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects.
220 ASSERT(!MarkCompactCollector::are_map_pointers_encoded()); 220 ASSERT(!MarkCompactCollector::are_map_pointers_encoded());
221 MapWord map_word = object->map_word(); 221 MapWord map_word = object->map_word();
222 map_word.ClearMark(); 222 map_word.ClearMark();
223 map_word.ClearOverflow(); 223 map_word.ClearOverflow();
224 return object->SizeFromMap(map_word.ToMap()); 224 return object->SizeFromMap(map_word.ToMap());
225 } 225 }
226 226
227 227
228 int Heap::GcSafeSizeOfOldObjectWithEncodedMap(HeapObject* object) { 228 int Heap::GcSafeSizeOfOldObjectWithEncodedMap(HeapObject* object) {
229 ASSERT(!FLAG_new_gc); // Should not be used in new GC.
229 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects. 230 ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects.
230 ASSERT(MarkCompactCollector::are_map_pointers_encoded()); 231 ASSERT(MarkCompactCollector::are_map_pointers_encoded());
231 uint32_t marker = Memory::uint32_at(object->address()); 232 uint32_t marker = Memory::uint32_at(object->address());
232 if (marker == MarkCompactCollector::kSingleFreeEncoding) { 233 if (marker == MarkCompactCollector::kSingleFreeEncoding) {
233 return kIntSize; 234 return kIntSize;
234 } else if (marker == MarkCompactCollector::kMultiFreeEncoding) { 235 } else if (marker == MarkCompactCollector::kMultiFreeEncoding) {
235 return Memory::int_at(object->address() + kIntSize); 236 return Memory::int_at(object->address() + kIntSize);
236 } else { 237 } else {
237 MapWord map_word = object->map_word(); 238 MapWord map_word = object->map_word();
238 Address map_address = map_word.DecodeMapAddress(Heap::map_space()); 239 Address map_address = map_word.DecodeMapAddress(Heap::map_space());
(...skipping 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after
3977 3978
3978 3979
3979 void Heap::Verify() { 3980 void Heap::Verify() {
3980 ASSERT(HasBeenSetup()); 3981 ASSERT(HasBeenSetup());
3981 3982
3982 VerifyPointersVisitor visitor; 3983 VerifyPointersVisitor visitor;
3983 IterateRoots(&visitor, VISIT_ONLY_STRONG); 3984 IterateRoots(&visitor, VISIT_ONLY_STRONG);
3984 3985
3985 new_space_.Verify(); 3986 new_space_.Verify();
3986 3987
3987 VerifyPointersAndDirtyRegionsVisitor dirty_regions_visitor; 3988 if (!FLAG_new_gc) {
3988 old_pointer_space_->Verify(&dirty_regions_visitor); 3989 VerifyPointersAndDirtyRegionsVisitor dirty_regions_visitor;
3989 map_space_->Verify(&dirty_regions_visitor); 3990 old_pointer_space_->Verify(&dirty_regions_visitor);
3991 map_space_->Verify(&dirty_regions_visitor);
3992 } else {
3993 old_pointer_space_->Verify(&visitor);
3994 map_space_->Verify(&visitor);
3995 }
3990 3996
3991 VerifyPointersUnderWatermark(old_pointer_space_, 3997 VerifyPointersUnderWatermark(old_pointer_space_,
3992 &IteratePointersInDirtyRegion); 3998 &IteratePointersInDirtyRegion);
3993 VerifyPointersUnderWatermark(map_space_, 3999 VerifyPointersUnderWatermark(map_space_,
3994 &IteratePointersInDirtyMapsRegion); 4000 &IteratePointersInDirtyMapsRegion);
3995 VerifyPointersUnderWatermark(lo_space_); 4001 VerifyPointersUnderWatermark(lo_space_);
3996 4002
3997 VerifyPageWatermarkValidity(old_pointer_space_, ALL_INVALID); 4003 VerifyPageWatermarkValidity(old_pointer_space_, ALL_INVALID);
3998 VerifyPageWatermarkValidity(map_space_, ALL_INVALID); 4004 VerifyPageWatermarkValidity(map_space_, ALL_INVALID);
3999 4005
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 page->SetRegionMarks(marks); 4206 page->SetRegionMarks(marks);
4201 } 4207 }
4202 4208
4203 4209
4204 uint32_t Heap::IterateDirtyRegions( 4210 uint32_t Heap::IterateDirtyRegions(
4205 uint32_t marks, 4211 uint32_t marks,
4206 Address area_start, 4212 Address area_start,
4207 Address area_end, 4213 Address area_end,
4208 DirtyRegionCallback visit_dirty_region, 4214 DirtyRegionCallback visit_dirty_region,
4209 ObjectSlotCallback copy_object_func) { 4215 ObjectSlotCallback copy_object_func) {
4216 if (FLAG_new_gc) {
4217 visit_dirty_region(area_start, area_end, copy_object_func);
4218 return Page::kAllRegionsDirtyMarks;
4219 }
4220
4210 uint32_t newmarks = 0; 4221 uint32_t newmarks = 0;
4211 uint32_t mask = 1; 4222 uint32_t mask = 1;
4212 4223
4213 if (area_start >= area_end) { 4224 if (area_start >= area_end) {
4214 return newmarks; 4225 return newmarks;
4215 } 4226 }
4216 4227
4217 Address region_start = area_start; 4228 Address region_start = area_start;
4218 4229
4219 // area_start does not necessarily coincide with start of the first region. 4230 // area_start does not necessarily coincide with start of the first region.
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
5438 void ExternalStringTable::TearDown() { 5449 void ExternalStringTable::TearDown() {
5439 new_space_strings_.Free(); 5450 new_space_strings_.Free();
5440 old_space_strings_.Free(); 5451 old_space_strings_.Free();
5441 } 5452 }
5442 5453
5443 5454
5444 List<Object*> ExternalStringTable::new_space_strings_; 5455 List<Object*> ExternalStringTable::new_space_strings_;
5445 List<Object*> ExternalStringTable::old_space_strings_; 5456 List<Object*> ExternalStringTable::old_space_strings_;
5446 5457
5447 } } // namespace v8::internal 5458 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698