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

Side by Side Diff: src/api.cc

Issue 261037: Add an API to V8 to get simple heap statistics. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 } 2604 }
2605 } 2605 }
2606 2606
2607 2607
2608 bool v8::V8::Dispose() { 2608 bool v8::V8::Dispose() {
2609 i::V8::TearDown(); 2609 i::V8::TearDown();
2610 return true; 2610 return true;
2611 } 2611 }
2612 2612
2613 2613
2614 HeapStatistics::HeapStatistics(): total_heap_size_(0), used_heap_size_(0) { }
2615
2616
2617 void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
2618 heap_statistics->set_total_heap_size(i::Heap::CommittedMemory());
2619 heap_statistics->set_used_heap_size(i::Heap::SizeOfObjects());
2620 }
2621
2622
2614 bool v8::V8::IdleNotification() { 2623 bool v8::V8::IdleNotification() {
2615 // Returning true tells the caller that it need not 2624 // Returning true tells the caller that it need not
2616 // continue to call IdleNotification. 2625 // continue to call IdleNotification.
2617 if (!i::V8::IsRunning()) return true; 2626 if (!i::V8::IsRunning()) return true;
2618 return i::V8::IdleNotification(); 2627 return i::V8::IdleNotification();
2619 } 2628 }
2620 2629
2621 2630
2622 void v8::V8::LowMemoryNotification() { 2631 void v8::V8::LowMemoryNotification() {
2623 #if defined(ANDROID) 2632 #if defined(ANDROID)
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3803 3812
3804 3813
3805 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 3814 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
3806 HandleScopeImplementer* thread_local = 3815 HandleScopeImplementer* thread_local =
3807 reinterpret_cast<HandleScopeImplementer*>(storage); 3816 reinterpret_cast<HandleScopeImplementer*>(storage);
3808 thread_local->IterateThis(v); 3817 thread_local->IterateThis(v);
3809 return storage + ArchiveSpacePerThread(); 3818 return storage + ArchiveSpacePerThread();
3810 } 3819 }
3811 3820
3812 } } // namespace v8::internal 3821 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698