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

Unified Diff: src/mark-compact.cc

Issue 555072: Merge ObjectIterator::has_next and ObjectIterator::next methods.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log.cc ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
===================================================================
--- src/mark-compact.cc (revision 3683)
+++ src/mark-compact.cc (working copy)
@@ -129,7 +129,8 @@
#endif
PagedSpaces spaces;
- while (PagedSpace* space = spaces.next()) {
+ for (PagedSpace* space = spaces.next();
+ space != NULL; space = spaces.next()) {
space->PrepareForMarkCompact(compacting_collection_);
}
@@ -172,7 +173,7 @@
int old_gen_used = 0;
OldSpaces spaces;
- while (OldSpace* space = spaces.next()) {
+ for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) {
old_gen_recoverable += space->Waste() + space->AvailableFree();
old_gen_used += space->Size();
}
@@ -475,8 +476,8 @@
void MarkCompactCollector::CreateBackPointers() {
HeapObjectIterator iterator(Heap::map_space());
- while (iterator.has_next()) {
- Object* next_object = iterator.next();
+ for (HeapObject* next_object = iterator.next();
+ next_object != NULL; next_object = iterator.next()) {
if (next_object->IsMap()) { // Could also be ByteArray on free list.
Map* map = Map::cast(next_object);
if (map->instance_type() >= FIRST_JS_OBJECT_TYPE &&
@@ -509,8 +510,7 @@
// so that we don't waste effort pointlessly scanning for objects.
ASSERT(!marking_stack.is_full());
- while (it->has_next()) {
- HeapObject* object = it->next();
+ for (HeapObject* object = it->next(); object != NULL; object = it->next()) {
if (object->IsOverflowed()) {
object->ClearOverflow();
ASSERT(object->IsMarked());
@@ -793,8 +793,9 @@
// scan the descriptor arrays of those maps, not all maps.
// All of these actions are carried out only on maps of JSObjects
// and related subtypes.
- while (map_iterator.has_next()) {
- Map* map = reinterpret_cast<Map*>(map_iterator.next());
+ for (HeapObject* obj = map_iterator.next();
+ obj != NULL; obj = map_iterator.next()) {
+ Map* map = reinterpret_cast<Map*>(obj);
if (!map->IsMarked() && map->IsByteArray()) continue;
ASSERT(SafeIsMap(map));
@@ -1282,8 +1283,7 @@
MapIterator it;
HeapObject* o = it.next();
for (; o != first_map_to_evacuate_; o = it.next()) {
- it.has_next(); // Must be called for side-effects, see bug 586.
- ASSERT(it.has_next());
+ ASSERT(o != NULL);
Map* map = reinterpret_cast<Map*>(o);
ASSERT(!map->IsMarked());
ASSERT(!map->IsOverflowed());
@@ -1309,10 +1309,8 @@
void UpdateMapPointersInLargeObjectSpace() {
LargeObjectIterator it(Heap::lo_space());
- while (true) {
- if (!it.has_next()) break;
- UpdateMapPointersInObject(it.next());
- }
+ for (HeapObject* obj = it.next(); obj != NULL; obj = it.next())
+ UpdateMapPointersInObject(obj);
}
void Finish() {
@@ -1355,9 +1353,8 @@
static Map* NextMap(MapIterator* it, HeapObject* last, bool live) {
while (true) {
- it->has_next(); // Must be called for side-effects, see bug 586.
- ASSERT(it->has_next());
HeapObject* next = it->next();
+ ASSERT(next != NULL);
if (next == last)
return NULL;
ASSERT(!next->IsOverflowed());
@@ -1446,8 +1443,9 @@
if (!FLAG_enable_slow_asserts)
return;
- while (map_to_evacuate_it_.has_next())
- ASSERT(FreeListNode::IsFreeListNode(map_to_evacuate_it_.next()));
+ for (HeapObject* obj = map_to_evacuate_it_.next();
+ obj != NULL; obj = map_to_evacuate_it_.next())
+ ASSERT(FreeListNode::IsFreeListNode(obj));
}
#endif
};
@@ -1480,7 +1478,8 @@
map_compact.FinishMapSpace();
PagedSpaces spaces;
- while (PagedSpace* space = spaces.next()) {
+ for (PagedSpace* space = spaces.next();
+ space != NULL; space = spaces.next()) {
if (space == Heap::map_space()) continue;
map_compact.UpdateMapPointersInPagedSpace(space);
}
@@ -1655,7 +1654,8 @@
// Large objects do not move, the map word can be updated directly.
LargeObjectIterator it(Heap::lo_space());
- while (it.has_next()) UpdatePointersInNewObject(it.next());
+ for (HeapObject* obj = it.next(); obj != NULL; obj = it.next())
+ UpdatePointersInNewObject(obj);
USE(live_maps);
USE(live_pointer_olds);
@@ -1819,7 +1819,8 @@
Page::set_rset_state(Page::IN_USE);
#endif
PagedSpaces spaces;
- while (PagedSpace* space = spaces.next()) space->MCCommitRelocationInfo();
+ for (PagedSpace* space = spaces.next(); space != NULL; space = spaces.next())
+ space->MCCommitRelocationInfo();
}
« no previous file with comments | « src/log.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698