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

Side by Side Diff: src/api.cc

Issue 7204040: Heap profiler: add an ability to iterate over snapshot's nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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-profiler.h ('k') | test/cctest/test-heap-profiler.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5868 matching lines...) Expand 10 before | Expand all | Expand 10 after
5879 i::Isolate* isolate = i::Isolate::Current(); 5879 i::Isolate* isolate = i::Isolate::Current();
5880 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); 5880 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById");
5881 return reinterpret_cast<const HeapGraphNode*>( 5881 return reinterpret_cast<const HeapGraphNode*>(
5882 ToInternal(this)->GetEntryById(id)); 5882 ToInternal(this)->GetEntryById(id));
5883 #else 5883 #else
5884 return NULL; 5884 return NULL;
5885 #endif 5885 #endif
5886 } 5886 }
5887 5887
5888 5888
5889 int HeapSnapshot::GetNodesCount() const {
5890 #ifdef ENABLE_LOGGING_AND_PROFILING
5891 i::Isolate* isolate = i::Isolate::Current();
5892 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodesCount");
5893 return ToInternal(this)->entries()->length();
5894 #else
5895 return 0;
5896 #endif
5897 }
5898
5899
5900 const HeapGraphNode* HeapSnapshot::GetNode(int index) const {
5901 #ifdef ENABLE_LOGGING_AND_PROFILING
5902 i::Isolate* isolate = i::Isolate::Current();
5903 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNode");
5904 return reinterpret_cast<const HeapGraphNode*>(
5905 ToInternal(this)->entries()->at(index));
5906 #else
5907 return 0;
5908 #endif
5909 }
5910
5911
5889 void HeapSnapshot::Serialize(OutputStream* stream, 5912 void HeapSnapshot::Serialize(OutputStream* stream,
5890 HeapSnapshot::SerializationFormat format) const { 5913 HeapSnapshot::SerializationFormat format) const {
5891 #ifdef ENABLE_LOGGING_AND_PROFILING 5914 #ifdef ENABLE_LOGGING_AND_PROFILING
5892 i::Isolate* isolate = i::Isolate::Current(); 5915 i::Isolate* isolate = i::Isolate::Current();
5893 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); 5916 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize");
5894 ApiCheck(format == kJSON, 5917 ApiCheck(format == kJSON,
5895 "v8::HeapSnapshot::Serialize", 5918 "v8::HeapSnapshot::Serialize",
5896 "Unknown serialization format"); 5919 "Unknown serialization format");
5897 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii, 5920 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii,
5898 "v8::HeapSnapshot::Serialize", 5921 "v8::HeapSnapshot::Serialize",
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 6136
6114 6137
6115 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6138 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6116 HandleScopeImplementer* scope_implementer = 6139 HandleScopeImplementer* scope_implementer =
6117 reinterpret_cast<HandleScopeImplementer*>(storage); 6140 reinterpret_cast<HandleScopeImplementer*>(storage);
6118 scope_implementer->IterateThis(v); 6141 scope_implementer->IterateThis(v);
6119 return storage + ArchiveSpacePerThread(); 6142 return storage + ArchiveSpacePerThread();
6120 } 6143 }
6121 6144
6122 } } // namespace v8::internal 6145 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698