From 754c32ec8dacd47ec7fd791f3807025e33ad01db Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Wed, 27 Mar 2013 10:33:25 +0000 Subject: [PATCH] Make Isolate::GetHeapStatistics robust against half-initialized isolates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The (deprecated) non-Isolate GetHeapStatistics contains the same check. BUG=2591 Review URL: https://codereview.chromium.org/12965013 Patch from Marja Hölttä . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14079 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/api.cc b/src/api.cc index 7fce39e3a5..f1fe6eaabe 100644 --- a/src/api.cc +++ b/src/api.cc @@ -5971,6 +5971,14 @@ void Isolate::Exit() { void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { i::Isolate* isolate = reinterpret_cast(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_ =