Merge from v8 at revision 3723
diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc
index b615055..3cb65ee 100644
--- a/src/heap-profiler.cc
+++ b/src/heap-profiler.cc
@@ -625,8 +625,7 @@
   ConstructorHeapProfile js_cons_profile;
   RetainerHeapProfile js_retainer_profile;
   HeapIterator iterator;
-  while (iterator.has_next()) {
-    HeapObject* obj = iterator.next();
+  for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
     CollectStats(obj, info);
     js_cons_profile.CollectStats(obj);
     js_retainer_profile.CollectStats(obj);