Revision: 14079
Author:   [email protected]
Date:     Wed Mar 27 03:33:25 2013
Log: Make Isolate::GetHeapStatistics robust against half-initialized isolates.

The (deprecated) non-Isolate GetHeapStatistics contains the same check.

BUG=2591

Review URL: https://codereview.chromium.org/12965013
Patch from Marja Hölttä <[email protected]>.
http://code.google.com/p/v8/source/detail?r=14079

Modified:
 /branches/bleeding_edge/src/api.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Fri Mar 22 09:33:50 2013
+++ /branches/bleeding_edge/src/api.cc  Wed Mar 27 03:33:25 2013
@@ -5971,6 +5971,14 @@

 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+  if (!isolate->IsInitialized()) {
+    heap_statistics->total_heap_size_ = 0;
+    heap_statistics->total_heap_size_executable_ = 0;
+    heap_statistics->total_physical_size_ = 0;
+    heap_statistics->used_heap_size_ = 0;
+    heap_statistics->heap_size_limit_ = 0;
+    return;
+  }
   i::Heap* heap = isolate->heap();
   heap_statistics->total_heap_size_ = heap->CommittedMemory();
   heap_statistics->total_heap_size_executable_ =

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to