Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: src/api.cc

Issue 12207076: Added new GetHeapStatistics API entry and deprecated old one. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed Clear() again. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698