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

Unified Diff: src/profile-generator.cc

Issue 9582006: Fix corrupted snapshot serializaton on ia32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index dd2f7014dbd4ae1a36ae8f74bdeb53c27a7b58fd..39f8ff3c910441fa4c998929792b0d3032e29cab 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -3490,6 +3490,9 @@ void HeapSnapshotJSONSerializer::SerializeEdge(HeapGraphEdge* edge) {
|| edge->type() == HeapGraphEdge::kHidden
|| edge->type() == HeapGraphEdge::kWeak
? edge->index() : GetStringId(edge->name());
+ STATIC_CHECK(sizeof(int) == sizeof(edge->type())); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(edge_name_or_index)); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(GetNodeId(edge->to()))); // NOLINT
int result = OS::SNPrintF(buffer, ",%d,%d,%d",
edge->type(), edge_name_or_index, GetNodeId(edge->to()));
USE(result);
@@ -3499,12 +3502,21 @@ void HeapSnapshotJSONSerializer::SerializeEdge(HeapGraphEdge* edge) {
void HeapSnapshotJSONSerializer::SerializeNode(HeapEntry* entry) {
- // The buffer needs space for 7 ints, 7 commas, \n and \0
+ // The buffer needs space for 6 ints, 1 uint64_t, 7 commas, \n and \0
static const int kBufferSize =
- MaxDecimalDigitsIn<sizeof(int)>::kSigned * 7 + 7 + 1 + 1; // NOLINT
+ 6 * MaxDecimalDigitsIn<sizeof(int)>::kSigned // NOLINT
+ + MaxDecimalDigitsIn<sizeof(uint64_t)>::kUnsigned // NOLINT
+ + 7 + 1 + 1;
EmbeddedVector<char, kBufferSize> buffer;
Vector<HeapGraphEdge> children = entry->children();
- int result = OS::SNPrintF(buffer, "\n,%d,%d,%d,%d,%d,%d,%d",
+ STATIC_CHECK(sizeof(int) == sizeof(entry->type())); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(GetStringId(entry->name()))); // NOLINT
+ STATIC_CHECK(sizeof(uint64_t) == sizeof(entry->id())); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(entry->self_size())); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(entry->retained_size())); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(GetNodeId(entry->dominator()))); // NOLINT
+ STATIC_CHECK(sizeof(int) == sizeof(children.length())); // NOLINT
+ int result = OS::SNPrintF(buffer, "\n,%d,%d,%llu,%d,%d,%d,%d",
entry->type(),
GetStringId(entry->name()),
entry->id(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698