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

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

Issue 27627006: Always make a copy of a string when adding it to StringsStorage (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added empty line Created 7 years, 2 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 | « no previous file | src/profile-generator.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class StringsStorage { 42 class StringsStorage {
43 public: 43 public:
44 explicit StringsStorage(Heap* heap); 44 explicit StringsStorage(Heap* heap);
45 ~StringsStorage(); 45 ~StringsStorage();
46 46
47 const char* GetCopy(const char* src); 47 const char* GetCopy(const char* src);
48 const char* GetFormatted(const char* format, ...); 48 const char* GetFormatted(const char* format, ...);
49 const char* GetVFormatted(const char* format, va_list args); 49 const char* GetVFormatted(const char* format, va_list args);
50 const char* GetName(Name* name); 50 const char* GetName(Name* name);
51 const char* GetName(int index); 51 const char* GetName(int index);
52 inline const char* GetFunctionName(Name* name); 52 const char* GetFunctionName(Name* name);
53 inline const char* GetFunctionName(const char* name); 53 const char* GetFunctionName(const char* name);
54 size_t GetUsedMemorySize() const; 54 size_t GetUsedMemorySize() const;
55 55
56 private: 56 private:
57 static const int kMaxNameSize = 1024; 57 static const int kMaxNameSize = 1024;
58 58
59 static bool StringsMatch(void* key1, void* key2) { 59 static bool StringsMatch(void* key1, void* key2);
60 return strcmp(reinterpret_cast<char*>(key1), 60 const char* BeautifyFunctionName(const char* name);
61 reinterpret_cast<char*>(key2)) == 0; 61 const char* AddOrDisposeString(char* str, int len);
62 } 62 HashMap::Entry* GetEntry(const char* str, int len);
63 const char* AddOrDisposeString(char* str, uint32_t hash);
64 63
65 // Mapping of strings by String::Hash to const char* strings.
66 uint32_t hash_seed_; 64 uint32_t hash_seed_;
67 HashMap names_; 65 HashMap names_;
68 66
69 DISALLOW_COPY_AND_ASSIGN(StringsStorage); 67 DISALLOW_COPY_AND_ASSIGN(StringsStorage);
70 }; 68 };
71 69
72 70
73 class CodeEntry { 71 class CodeEntry {
74 public: 72 public:
75 // CodeEntry doesn't own name strings, just references them. 73 // CodeEntry doesn't own name strings, just references them.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 CodeEntry* gc_entry_; 352 CodeEntry* gc_entry_;
355 CodeEntry* unresolved_entry_; 353 CodeEntry* unresolved_entry_;
356 354
357 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); 355 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
358 }; 356 };
359 357
360 358
361 } } // namespace v8::internal 359 } } // namespace v8::internal
362 360
363 #endif // V8_PROFILE_GENERATOR_H_ 361 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698