Push bleeding_edge revision 3387, 3390 to trunk in order to fix test.

Push bleeding_edge revision 3406 to trunk to add stack allocated
information about the state of the heap in OOM situations.  This will
be helpful in getting information from OOM crashes.

Review URL: http://codereview.chromium.org/465026

git-svn-id: http://v8.googlecode.com/svn/trunk@3408 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/global-handles.cc b/src/global-handles.cc
index e519d70..5b01f61 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -429,6 +429,26 @@
 GlobalHandles::Node* GlobalHandles::first_free_ = NULL;
 GlobalHandles::Node* GlobalHandles::first_deallocated_ = NULL;
 
+void GlobalHandles::RecordStats(HeapStats* stats) {
+  stats->global_handle_count = 0;
+  stats->weak_global_handle_count = 0;
+  stats->pending_global_handle_count = 0;
+  stats->near_death_global_handle_count = 0;
+  stats->destroyed_global_handle_count = 0;
+  for (Node* current = head_; current != NULL; current = current->next()) {
+    stats->global_handle_count++;
+    if (current->state_ == Node::WEAK) {
+      stats->weak_global_handle_count++;
+    } else if (current->state_ == Node::PENDING) {
+      stats->pending_global_handle_count++;
+    } else if (current->state_ == Node::NEAR_DEATH) {
+      stats->near_death_global_handle_count++;
+    } else if (current->state_ == Node::DESTROYED) {
+      stats->destroyed_global_handle_count++;
+    }
+  }
+}
+
 #ifdef DEBUG
 
 void GlobalHandles::PrintStats() {