| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PROFILE_GENERATOR_H_ | 5 #ifndef V8_PROFILE_GENERATOR_H_ |
| 6 #define V8_PROFILE_GENERATOR_H_ | 6 #define V8_PROFILE_GENERATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include "include/v8-profiler.h" | 9 #include "include/v8-profiler.h" |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| 11 #include "src/hashmap.h" | 11 #include "src/hashmap.h" |
| 12 #include "src/strings-storage.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 struct OffsetRange; | 17 struct OffsetRange; |
| 17 | 18 |
| 18 // Provides a storage of strings allocated in C++ heap, to hold them | |
| 19 // forever, even if they disappear from JS heap or external storage. | |
| 20 class StringsStorage { | |
| 21 public: | |
| 22 explicit StringsStorage(Heap* heap); | |
| 23 ~StringsStorage(); | |
| 24 | |
| 25 const char* GetCopy(const char* src); | |
| 26 const char* GetFormatted(const char* format, ...); | |
| 27 const char* GetVFormatted(const char* format, va_list args); | |
| 28 const char* GetName(Name* name); | |
| 29 const char* GetName(int index); | |
| 30 const char* GetFunctionName(Name* name); | |
| 31 const char* GetFunctionName(const char* name); | |
| 32 size_t GetUsedMemorySize() const; | |
| 33 | |
| 34 private: | |
| 35 static const int kMaxNameSize = 1024; | |
| 36 | |
| 37 static bool StringsMatch(void* key1, void* key2); | |
| 38 const char* AddOrDisposeString(char* str, int len); | |
| 39 HashMap::Entry* GetEntry(const char* str, int len); | |
| 40 | |
| 41 uint32_t hash_seed_; | |
| 42 HashMap names_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(StringsStorage); | |
| 45 }; | |
| 46 | |
| 47 | |
| 48 // Provides a mapping from the offsets within generated code to | 19 // Provides a mapping from the offsets within generated code to |
| 49 // the source line. | 20 // the source line. |
| 50 class JITLineInfoTable : public Malloced { | 21 class JITLineInfoTable : public Malloced { |
| 51 public: | 22 public: |
| 52 JITLineInfoTable(); | 23 JITLineInfoTable(); |
| 53 ~JITLineInfoTable(); | 24 ~JITLineInfoTable(); |
| 54 | 25 |
| 55 void SetPosition(int pc_offset, int line); | 26 void SetPosition(int pc_offset, int line); |
| 56 int GetSourceLineNumber(int pc_offset) const; | 27 int GetSourceLineNumber(int pc_offset) const; |
| 57 | 28 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 CodeEntry* gc_entry_; | 374 CodeEntry* gc_entry_; |
| 404 CodeEntry* unresolved_entry_; | 375 CodeEntry* unresolved_entry_; |
| 405 | 376 |
| 406 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 377 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 407 }; | 378 }; |
| 408 | 379 |
| 409 | 380 |
| 410 } } // namespace v8::internal | 381 } } // namespace v8::internal |
| 411 | 382 |
| 412 #endif // V8_PROFILE_GENERATOR_H_ | 383 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |