Commit 8204dfa1 authored by yurys@chromium.org's avatar yurys@chromium.org

Deprecate HeapSnapshot type

There is only one type of heap snapshot - kFull and we are not going to add any new types.

BUG=None

Review URL: https://codereview.chromium.org/12943004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14005 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cdf4bb5a
...@@ -321,8 +321,8 @@ class V8EXPORT HeapSnapshot { ...@@ -321,8 +321,8 @@ class V8EXPORT HeapSnapshot {
kJSON = 0 // See format description near 'Serialize' method. kJSON = 0 // See format description near 'Serialize' method.
}; };
/** Returns heap snapshot type. */ /** Deprecated. Returns kFull. */
Type GetType() const; V8_DEPRECATED(Type GetType() const);
/** Returns heap snapshot UID (assigned by the profiler.) */ /** Returns heap snapshot UID (assigned by the profiler.) */
unsigned GetUid() const; unsigned GetUid() const;
...@@ -451,7 +451,6 @@ class V8EXPORT HeapProfiler { ...@@ -451,7 +451,6 @@ class V8EXPORT HeapProfiler {
ObjectNameResolver* global_object_name_resolver = NULL); ObjectNameResolver* global_object_name_resolver = NULL);
/** /**
* Takes a heap snapshot and returns it. Title may be an empty string. * Takes a heap snapshot and returns it. Title may be an empty string.
* See HeapSnapshot::Type for types description.
*/ */
const HeapSnapshot* TakeHeapSnapshot( const HeapSnapshot* TakeHeapSnapshot(
Handle<String> title, Handle<String> title,
......
...@@ -6727,7 +6727,7 @@ void HeapSnapshot::Delete() { ...@@ -6727,7 +6727,7 @@ void HeapSnapshot::Delete() {
HeapSnapshot::Type HeapSnapshot::GetType() const { HeapSnapshot::Type HeapSnapshot::GetType() const {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); return kFull;
} }
...@@ -6861,17 +6861,9 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, ...@@ -6861,17 +6861,9 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
ObjectNameResolver* resolver) { ObjectNameResolver* resolver) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
switch (type) {
case HeapSnapshot::kFull:
internal_type = i::HeapSnapshot::kFull;
break;
default:
UNREACHABLE();
}
return reinterpret_cast<const HeapSnapshot*>( return reinterpret_cast<const HeapSnapshot*>(
isolate->heap_profiler()->TakeSnapshot( isolate->heap_profiler()->TakeSnapshot(
*Utils::OpenHandle(*title), internal_type, control, resolver)); *Utils::OpenHandle(*title), control, resolver));
} }
...@@ -6881,8 +6873,7 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot( ...@@ -6881,8 +6873,7 @@ const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
ObjectNameResolver* resolver) { ObjectNameResolver* resolver) {
return reinterpret_cast<const HeapSnapshot*>( return reinterpret_cast<const HeapSnapshot*>(
reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot( reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot(
*Utils::OpenHandle(*title), i::HeapSnapshot::kFull, *Utils::OpenHandle(*title), control, resolver));
control, resolver));
} }
......
...@@ -72,25 +72,15 @@ v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback( ...@@ -72,25 +72,15 @@ v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
HeapSnapshot* HeapProfiler::TakeSnapshot( HeapSnapshot* HeapProfiler::TakeSnapshot(
const char* name, const char* name,
int type,
v8::ActivityControl* control, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) { v8::HeapProfiler::ObjectNameResolver* resolver) {
HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); HeapSnapshot* result = snapshots_->NewSnapshot(name, next_snapshot_uid_++);
HeapSnapshot* result = {
snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); HeapSnapshotGenerator generator(result, control, resolver, heap());
bool generation_completed = true; if (!generator.GenerateSnapshot()) {
switch (s_type) { delete result;
case HeapSnapshot::kFull: { result = NULL;
HeapSnapshotGenerator generator(result, control, resolver, heap());
generation_completed = generator.GenerateSnapshot();
break;
} }
default:
UNREACHABLE();
}
if (!generation_completed) {
delete result;
result = NULL;
} }
snapshots_->SnapshotGenerationFinished(result); snapshots_->SnapshotGenerationFinished(result);
return result; return result;
...@@ -99,11 +89,9 @@ HeapSnapshot* HeapProfiler::TakeSnapshot( ...@@ -99,11 +89,9 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
HeapSnapshot* HeapProfiler::TakeSnapshot( HeapSnapshot* HeapProfiler::TakeSnapshot(
String* name, String* name,
int type,
v8::ActivityControl* control, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver) { v8::HeapProfiler::ObjectNameResolver* resolver) {
return TakeSnapshot(snapshots_->names()->GetName(name), type, control, return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver);
resolver);
} }
void HeapProfiler::StartHeapObjectsTracking() { void HeapProfiler::StartHeapObjectsTracking() {
......
...@@ -53,12 +53,10 @@ class HeapProfiler { ...@@ -53,12 +53,10 @@ class HeapProfiler {
HeapSnapshot* TakeSnapshot( HeapSnapshot* TakeSnapshot(
const char* name, const char* name,
int type,
v8::ActivityControl* control, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver); v8::HeapProfiler::ObjectNameResolver* resolver);
HeapSnapshot* TakeSnapshot( HeapSnapshot* TakeSnapshot(
String* name, String* name,
int type,
v8::ActivityControl* control, v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver); v8::HeapProfiler::ObjectNameResolver* resolver);
......
...@@ -189,7 +189,7 @@ template <> struct SnapshotSizeConstants<4> { ...@@ -189,7 +189,7 @@ template <> struct SnapshotSizeConstants<4> {
static const int kExpectedHeapGraphEdgeSize = 12; static const int kExpectedHeapGraphEdgeSize = 12;
static const int kExpectedHeapEntrySize = 24; static const int kExpectedHeapEntrySize = 24;
static const int kExpectedHeapSnapshotsCollectionSize = 100; static const int kExpectedHeapSnapshotsCollectionSize = 100;
static const int kExpectedHeapSnapshotSize = 136; static const int kExpectedHeapSnapshotSize = 132;
static const size_t kMaxSerializableSnapshotRawSize = 256 * MB; static const size_t kMaxSerializableSnapshotRawSize = 256 * MB;
}; };
...@@ -197,7 +197,7 @@ template <> struct SnapshotSizeConstants<8> { ...@@ -197,7 +197,7 @@ template <> struct SnapshotSizeConstants<8> {
static const int kExpectedHeapGraphEdgeSize = 24; static const int kExpectedHeapGraphEdgeSize = 24;
static const int kExpectedHeapEntrySize = 32; static const int kExpectedHeapEntrySize = 32;
static const int kExpectedHeapSnapshotsCollectionSize = 152; static const int kExpectedHeapSnapshotsCollectionSize = 152;
static const int kExpectedHeapSnapshotSize = 168; static const int kExpectedHeapSnapshotSize = 160;
static const uint64_t kMaxSerializableSnapshotRawSize = static const uint64_t kMaxSerializableSnapshotRawSize =
static_cast<uint64_t>(6000) * MB; static_cast<uint64_t>(6000) * MB;
}; };
...@@ -205,11 +205,9 @@ template <> struct SnapshotSizeConstants<8> { ...@@ -205,11 +205,9 @@ template <> struct SnapshotSizeConstants<8> {
} // namespace } // namespace
HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection, HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection,
HeapSnapshot::Type type,
const char* title, const char* title,
unsigned uid) unsigned uid)
: collection_(collection), : collection_(collection),
type_(type),
title_(title), title_(title),
uid_(uid), uid_(uid),
root_index_(HeapEntry::kNoEntry), root_index_(HeapEntry::kNoEntry),
...@@ -599,11 +597,10 @@ HeapSnapshotsCollection::~HeapSnapshotsCollection() { ...@@ -599,11 +597,10 @@ HeapSnapshotsCollection::~HeapSnapshotsCollection() {
} }
HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(HeapSnapshot::Type type, HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name,
const char* name,
unsigned uid) { unsigned uid) {
is_tracking_objects_ = true; // Start watching for heap objects moves. is_tracking_objects_ = true; // Start watching for heap objects moves.
return new HeapSnapshot(this, type, name, uid); return new HeapSnapshot(this, name, uid);
} }
...@@ -2410,7 +2407,6 @@ void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) { ...@@ -2410,7 +2407,6 @@ void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) {
HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot() { HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot() {
HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(), HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(),
HeapSnapshot::kFull,
snapshot_->title(), snapshot_->title(),
snapshot_->uid()); snapshot_->uid());
result->AddRootEntry(); result->AddRootEntry();
......
...@@ -157,18 +157,12 @@ class HeapSnapshotsCollection; ...@@ -157,18 +157,12 @@ class HeapSnapshotsCollection;
// HeapSnapshotGenerator fills in a HeapSnapshot. // HeapSnapshotGenerator fills in a HeapSnapshot.
class HeapSnapshot { class HeapSnapshot {
public: public:
enum Type {
kFull = v8::HeapSnapshot::kFull
};
HeapSnapshot(HeapSnapshotsCollection* collection, HeapSnapshot(HeapSnapshotsCollection* collection,
Type type,
const char* title, const char* title,
unsigned uid); unsigned uid);
void Delete(); void Delete();
HeapSnapshotsCollection* collection() { return collection_; } HeapSnapshotsCollection* collection() { return collection_; }
Type type() { return type_; }
const char* title() { return title_; } const char* title() { return title_; }
unsigned uid() { return uid_; } unsigned uid() { return uid_; }
size_t RawSnapshotSize() const; size_t RawSnapshotSize() const;
...@@ -203,7 +197,6 @@ class HeapSnapshot { ...@@ -203,7 +197,6 @@ class HeapSnapshot {
private: private:
HeapSnapshotsCollection* collection_; HeapSnapshotsCollection* collection_;
Type type_;
const char* title_; const char* title_;
unsigned uid_; unsigned uid_;
int root_index_; int root_index_;
...@@ -305,8 +298,7 @@ class HeapSnapshotsCollection { ...@@ -305,8 +298,7 @@ class HeapSnapshotsCollection {
void StartHeapObjectsTracking() { is_tracking_objects_ = true; } void StartHeapObjectsTracking() { is_tracking_objects_ = true; }
void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); }
HeapSnapshot* NewSnapshot( HeapSnapshot* NewSnapshot(const char* name, unsigned uid);
HeapSnapshot::Type type, const char* name, unsigned uid);
void SnapshotGenerationFinished(HeapSnapshot* snapshot); void SnapshotGenerationFinished(HeapSnapshot* snapshot);
List<HeapSnapshot*>* snapshots() { return &snapshots_; } List<HeapSnapshot*>* snapshots() { return &snapshots_; }
HeapSnapshot* GetSnapshot(unsigned uid); HeapSnapshot* GetSnapshot(unsigned uid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment