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

Side by Side Diff: src/liveobjectlist.cc

Issue 8342037: Switch UnreachableObjectsFilter to use Marking instead of InstrusiveMarking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: simplify Created 9 years, 2 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/heap.cc ('k') | src/mark-compact.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 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 lol->Sort(); 1078 lol->Sort();
1079 lol = lol->prev_; 1079 lol = lol->prev_;
1080 } 1080 }
1081 } 1081 }
1082 1082
1083 1083
1084 // Counts the number of objects in the heap. 1084 // Counts the number of objects in the heap.
1085 static int CountHeapObjects() { 1085 static int CountHeapObjects() {
1086 int count = 0; 1086 int count = 0;
1087 // Iterate over all the heap spaces and count the number of objects. 1087 // Iterate over all the heap spaces and count the number of objects.
1088 HeapIterator iterator(HeapIterator::kFilterFreeListNodes); 1088 HeapIterator iterator;
1089 HeapObject* heap_obj = NULL; 1089 HeapObject* heap_obj = NULL;
1090 while ((heap_obj = iterator.next()) != NULL) { 1090 while ((heap_obj = iterator.next()) != NULL) {
1091 count++; 1091 count++;
1092 } 1092 }
1093 return count; 1093 return count;
1094 } 1094 }
1095 1095
1096 1096
1097 // Captures a current snapshot of all objects in the heap. 1097 // Captures a current snapshot of all objects in the heap.
1098 MaybeObject* LiveObjectList::Capture() { 1098 MaybeObject* LiveObjectList::Capture() {
(...skipping 16 matching lines...) Expand all
1115 // Create a lol large enough to track all the objects. 1115 // Create a lol large enough to track all the objects.
1116 lol = new LiveObjectList(last_lol, count); 1116 lol = new LiveObjectList(last_lol, count);
1117 if (lol == NULL) { 1117 if (lol == NULL) {
1118 return NULL; // No memory to proceed. 1118 return NULL; // No memory to proceed.
1119 } 1119 }
1120 1120
1121 // The HeapIterator needs to be in its own scope because it disables 1121 // The HeapIterator needs to be in its own scope because it disables
1122 // allocation, and we need allocate below. 1122 // allocation, and we need allocate below.
1123 { 1123 {
1124 // Iterate over all the heap spaces and add the objects. 1124 // Iterate over all the heap spaces and add the objects.
1125 HeapIterator iterator(HeapIterator::kFilterFreeListNodes); 1125 HeapIterator iterator;
1126 HeapObject* heap_obj = NULL; 1126 HeapObject* heap_obj = NULL;
1127 bool failed = false; 1127 bool failed = false;
1128 while (!failed && (heap_obj = iterator.next()) != NULL) { 1128 while (!failed && (heap_obj = iterator.next()) != NULL) {
1129 failed = !lol->Add(heap_obj); 1129 failed = !lol->Add(heap_obj);
1130 size += heap_obj->Size(); 1130 size += heap_obj->Size();
1131 } 1131 }
1132 ASSERT(!failed); 1132 ASSERT(!failed);
1133 1133
1134 lol->Sort(); 1134 lol->Sort();
1135 1135
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 // and specified match_heap_exactly = true. 2506 // and specified match_heap_exactly = true.
2507 2507
2508 int number_of_heap_objects = 0; 2508 int number_of_heap_objects = 0;
2509 int number_of_matches = 0; 2509 int number_of_matches = 0;
2510 int number_not_in_heap = total_count; 2510 int number_not_in_heap = total_count;
2511 int number_not_in_lol = 0; 2511 int number_not_in_lol = 0;
2512 2512
2513 OS::Print(" Start verify ...\n"); 2513 OS::Print(" Start verify ...\n");
2514 OS::Print(" Verifying ..."); 2514 OS::Print(" Verifying ...");
2515 Flush(); 2515 Flush();
2516 HeapIterator iterator(HeapIterator::kFilterFreeListNodes); 2516 HeapIterator iterator;
2517 HeapObject* heap_obj = NULL; 2517 HeapObject* heap_obj = NULL;
2518 while ((heap_obj = iterator.next()) != NULL) { 2518 while ((heap_obj = iterator.next()) != NULL) {
2519 number_of_heap_objects++; 2519 number_of_heap_objects++;
2520 2520
2521 // Check if the heap_obj is in the lol. 2521 // Check if the heap_obj is in the lol.
2522 Element key; 2522 Element key;
2523 key.obj_ = heap_obj; 2523 key.obj_ = heap_obj;
2524 2524
2525 Element* result = reinterpret_cast<Element*>( 2525 Element* result = reinterpret_cast<Element*>(
2526 bsearch(&key, elements, total_count, sizeof(Element), 2526 bsearch(&key, elements, total_count, sizeof(Element),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 i++, heap_obj, Heap::new_space()->FromSpaceStart()); 2622 i++, heap_obj, Heap::new_space()->FromSpaceStart());
2623 } 2623 }
2624 } 2624 }
2625 } 2625 }
2626 #endif // VERIFY_LOL 2626 #endif // VERIFY_LOL
2627 2627
2628 2628
2629 } } // namespace v8::internal 2629 } } // namespace v8::internal
2630 2630
2631 #endif // LIVE_OBJECT_LIST 2631 #endif // LIVE_OBJECT_LIST
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698