| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 struct OffsetRange; | 38 struct OffsetRange; |
| 39 | 39 |
| 40 // Provides a storage of strings allocated in C++ heap, to hold them | 40 // Provides a storage of strings allocated in C++ heap, to hold them |
| 41 // forever, even if they disappear from JS heap or external storage. | 41 // forever, even if they disappear from JS heap or external storage. |
| 42 class StringsStorage { | 42 class StringsStorage { |
| 43 public: | 43 public: |
| 44 StringsStorage(); | 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 inline const char* GetFunctionName(Name* name); |
| 53 inline const char* GetFunctionName(const char* name); | 53 inline 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 INLINE(static bool StringsMatch(void* key1, void* key2)) { | 59 INLINE(static bool StringsMatch(void* key1, void* key2)) { |
| 60 return strcmp(reinterpret_cast<char*>(key1), | 60 return strcmp(reinterpret_cast<char*>(key1), |
| 61 reinterpret_cast<char*>(key2)) == 0; | 61 reinterpret_cast<char*>(key2)) == 0; |
| 62 } | 62 } |
| 63 const char* AddOrDisposeString(char* str, uint32_t hash); | 63 const char* AddOrDisposeString(char* str, uint32_t hash); |
| 64 | 64 |
| 65 // Mapping of strings by String::Hash to const char* strings. | 65 // Mapping of strings by String::Hash to const char* strings. |
| 66 uint32_t hash_seed_; |
| 66 HashMap names_; | 67 HashMap names_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(StringsStorage); | 69 DISALLOW_COPY_AND_ASSIGN(StringsStorage); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 | 72 |
| 72 class CodeEntry { | 73 class CodeEntry { |
| 73 public: | 74 public: |
| 74 // CodeEntry doesn't own name strings, just references them. | 75 // CodeEntry doesn't own name strings, just references them. |
| 75 INLINE(CodeEntry(Logger::LogEventsAndTags tag, | 76 INLINE(CodeEntry(Logger::LogEventsAndTags tag, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 271 |
| 271 CodeTree tree_; | 272 CodeTree tree_; |
| 272 int next_shared_id_; | 273 int next_shared_id_; |
| 273 | 274 |
| 274 DISALLOW_COPY_AND_ASSIGN(CodeMap); | 275 DISALLOW_COPY_AND_ASSIGN(CodeMap); |
| 275 }; | 276 }; |
| 276 | 277 |
| 277 | 278 |
| 278 class CpuProfilesCollection { | 279 class CpuProfilesCollection { |
| 279 public: | 280 public: |
| 280 CpuProfilesCollection(); | 281 explicit CpuProfilesCollection(Heap* heap); |
| 281 ~CpuProfilesCollection(); | 282 ~CpuProfilesCollection(); |
| 282 | 283 |
| 283 bool StartProfiling(const char* title, unsigned uid, bool record_samples); | 284 bool StartProfiling(const char* title, unsigned uid, bool record_samples); |
| 284 CpuProfile* StopProfiling(const char* title); | 285 CpuProfile* StopProfiling(const char* title); |
| 285 List<CpuProfile*>* profiles() { return &finished_profiles_; } | 286 List<CpuProfile*>* profiles() { return &finished_profiles_; } |
| 286 const char* GetName(Name* name) { | 287 const char* GetName(Name* name) { |
| 287 return function_and_resource_names_.GetName(name); | 288 return function_and_resource_names_.GetName(name); |
| 288 } | 289 } |
| 289 const char* GetName(int args_count) { | 290 const char* GetName(int args_count) { |
| 290 return function_and_resource_names_.GetName(args_count); | 291 return function_and_resource_names_.GetName(args_count); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 CodeEntry* gc_entry_; | 351 CodeEntry* gc_entry_; |
| 351 CodeEntry* unresolved_entry_; | 352 CodeEntry* unresolved_entry_; |
| 352 | 353 |
| 353 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 354 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 354 }; | 355 }; |
| 355 | 356 |
| 356 | 357 |
| 357 } } // namespace v8::internal | 358 } } // namespace v8::internal |
| 358 | 359 |
| 359 #endif // V8_PROFILE_GENERATOR_H_ | 360 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |