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

Side by Side Diff: src/profile-generator.cc

Issue 8509003: Limit length of strings copied into a heap snapshot (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: length type was changed: uint32_t -> int Created 9 years, 1 month 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 | « src/profile-generator.h ('k') | no next file » | 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 DeleteArray(str.start()); 143 DeleteArray(str.start());
144 return format; 144 return format;
145 } 145 }
146 uint32_t hash = HashSequentialString(str.start(), len); 146 uint32_t hash = HashSequentialString(str.start(), len);
147 return AddOrDisposeString(str.start(), hash); 147 return AddOrDisposeString(str.start(), hash);
148 } 148 }
149 149
150 150
151 const char* StringsStorage::GetName(String* name) { 151 const char* StringsStorage::GetName(String* name) {
152 if (name->IsString()) { 152 if (name->IsString()) {
153 return AddOrDisposeString( 153 int length = Min(kMaxNameSize, name->length());
154 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL).Detach(), 154 SmartArrayPointer<char> data =
155 name->Hash()); 155 name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length);
156 uint32_t hash = HashSequentialString(*data, length);
157 return AddOrDisposeString(data.Detach(), hash);
156 } 158 }
157 return ""; 159 return "";
158 } 160 }
159 161
160 162
161 const char* StringsStorage::GetName(int index) { 163 const char* StringsStorage::GetName(int index) {
162 return GetFormatted("%d", index); 164 return GetFormatted("%d", index);
163 } 165 }
164 166
165 167
(...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 3409
3408 3410
3409 void HeapSnapshotJSONSerializer::SortHashMap( 3411 void HeapSnapshotJSONSerializer::SortHashMap(
3410 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3412 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3411 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3413 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3412 sorted_entries->Add(p); 3414 sorted_entries->Add(p);
3413 sorted_entries->Sort(SortUsingEntryValue); 3415 sorted_entries->Sort(SortUsingEntryValue);
3414 } 3416 }
3415 3417
3416 } } // namespace v8::internal 3418 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698