Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index d3d472d79947cd208684db88d98cc633a551f48c..a2f38744e5f668718bddb80a5d1a597b3c7600f1 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -4407,23 +4407,18 @@ HeapStatistics::HeapStatistics(): total_heap_size_(0), |
void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) { |
- if (!i::Isolate::Current()->IsInitialized()) { |
+ i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
+ if (isolate == NULL || !isolate->IsInitialized()) { |
// Isolate is unitialized thus heap is not configured yet. |
- heap_statistics->set_total_heap_size(0); |
- heap_statistics->set_total_heap_size_executable(0); |
- heap_statistics->set_total_physical_size(0); |
- heap_statistics->set_used_heap_size(0); |
- heap_statistics->set_heap_size_limit(0); |
+ 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 = i::Isolate::Current()->heap(); |
- heap_statistics->set_total_heap_size(heap->CommittedMemory()); |
- heap_statistics->set_total_heap_size_executable( |
- heap->CommittedMemoryExecutable()); |
- heap_statistics->set_total_physical_size(heap->CommittedPhysicalMemory()); |
- heap_statistics->set_used_heap_size(heap->SizeOfObjects()); |
- heap_statistics->set_heap_size_limit(heap->MaxReserved()); |
+ Isolate* ext_isolate = reinterpret_cast<Isolate*>(isolate); |
+ return ext_isolate->GetHeapStatistics(heap_statistics); |
} |
@@ -5609,6 +5604,18 @@ void Isolate::Exit() { |
} |
+void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { |
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
+ i::Heap* heap = isolate->heap(); |
+ heap_statistics->total_heap_size_ = heap->CommittedMemory(); |
+ heap_statistics->total_heap_size_executable_ = |
+ heap->CommittedMemoryExecutable(); |
+ heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); |
+ heap_statistics->used_heap_size_ = heap->SizeOfObjects(); |
+ heap_statistics->heap_size_limit_ = heap->MaxReserved(); |
+} |
+ |
+ |
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
: str_(NULL), length_(0) { |
i::Isolate* isolate = i::Isolate::Current(); |