Index: src/profile-generator.cc |
diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
index c6e6131a71ea0e343a53dc133f99e21195d9d8e0..2b5580b352abd92477943dc08c096853eaebea7b 100644 |
--- a/src/profile-generator.cc |
+++ b/src/profile-generator.cc |
@@ -3411,8 +3411,13 @@ class OutputStreamWriter { |
bool aborted_; |
}; |
+#if defined(V8_TARGET_ARCH_X64) |
+const int HeapSnapshotJSONSerializer::kMaxSerializableSnapshotRawSize = |
+ 768 * MB; |
mnaganov (inactive)
2012/02/10 12:33:50
I know a better place for this: SnapshotSizeConsta
|
+#else |
const int HeapSnapshotJSONSerializer::kMaxSerializableSnapshotRawSize = |
256 * MB; |
+#endif |
void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) { |
ASSERT(writer_ == NULL); |
@@ -3422,7 +3427,7 @@ void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) { |
if (snapshot_->raw_entries_size() >= kMaxSerializableSnapshotRawSize) { |
// The snapshot is too big. Serialize a fake snapshot. |
original_snapshot = snapshot_; |
- snapshot_ = CreateFakeSnapshot(); |
+ snapshot_ = CreateFakeSnapshot(snapshot_->raw_entries_size()); |
mnaganov (inactive)
2012/02/10 12:33:50
Why can't CreateFakeSnapshot extract this value it
|
} |
// Since nodes graph is cyclic, we need the first pass to enumerate |
// them. Strings can be serialized in one pass. |
@@ -3439,15 +3444,22 @@ void HeapSnapshotJSONSerializer::Serialize(v8::OutputStream* stream) { |
} |
-HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot() { |
+HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot( |
+ int raw_snapshot_size) { |
HeapSnapshot* result = new HeapSnapshot(snapshot_->collection(), |
HeapSnapshot::kFull, |
snapshot_->title(), |
snapshot_->uid()); |
result->AllocateEntries(2, 1, 0); |
HeapEntry* root = result->AddRootEntry(1); |
+ const char* text = snapshot_->collection()->names()->GetFormatted( |
+ "The snapshot is too big. " |
+ "Maximum snapshot size is %d MB. " |
+ "Actual snapshot size is %d MB.", |
+ kMaxSerializableSnapshotRawSize / MB, |
+ (raw_snapshot_size + MB - 1) / MB); |
HeapEntry* message = result->AddEntry( |
- HeapEntry::kString, "The snapshot is too big", 0, 4, 0, 0); |
+ HeapEntry::kString, text, 0, 4, 0, 0); |
root->SetUnidirElementReference(0, 1, message); |
result->SetDominatorsToSelf(); |
return result; |