| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class CodeEntry { | 38 class CodeEntry { |
| 39 public: | 39 public: |
| 40 // CodeEntry doesn't own name strings, just references them. | 40 // CodeEntry doesn't own name strings, just references them. |
| 41 INLINE(CodeEntry(Logger::LogEventsAndTags tag, | 41 INLINE(CodeEntry(Logger::LogEventsAndTags tag, |
| 42 const char* name_prefix, | 42 const char* name_prefix, |
| 43 const char* name, | 43 const char* name, |
| 44 const char* resource_name, | 44 const char* resource_name, |
| 45 int line_number)); | 45 int line_number)); |
| 46 | 46 |
| 47 INLINE(bool is_js_function() const); | 47 INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); } |
| 48 INLINE(const char* name_prefix() const) { return name_prefix_; } | 48 INLINE(const char* name_prefix() const) { return name_prefix_; } |
| 49 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; } | 49 INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; } |
| 50 INLINE(const char* name() const) { return name_; } | 50 INLINE(const char* name() const) { return name_; } |
| 51 INLINE(const char* resource_name() const) { return resource_name_; } | 51 INLINE(const char* resource_name() const) { return resource_name_; } |
| 52 INLINE(int line_number() const) { return line_number_; } | 52 INLINE(int line_number() const) { return line_number_; } |
| 53 INLINE(unsigned call_uid() const) { return call_uid_; } | 53 INLINE(unsigned call_uid() const) { return call_uid_; } |
| 54 | 54 |
| 55 INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag)); |
| 56 |
| 55 static const char* kEmptyNamePrefix; | 57 static const char* kEmptyNamePrefix; |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 const unsigned call_uid_; | 60 const unsigned call_uid_; |
| 59 Logger::LogEventsAndTags tag_; | 61 Logger::LogEventsAndTags tag_; |
| 60 const char* name_prefix_; | 62 const char* name_prefix_; |
| 61 const char* name_; | 63 const char* name_; |
| 62 const char* resource_name_; | 64 const char* resource_name_; |
| 63 int line_number_; | 65 int line_number_; |
| 64 | 66 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 String* name, String* resource_name, int line_number); | 218 String* name, String* resource_name, int line_number); |
| 217 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, const char* name); | 219 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, const char* name); |
| 218 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, | 220 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, |
| 219 const char* name_prefix, String* name); | 221 const char* name_prefix, String* name); |
| 220 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, int args_count); | 222 CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, int args_count); |
| 221 | 223 |
| 222 // Called from profile generator thread. | 224 // Called from profile generator thread. |
| 223 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path); | 225 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path); |
| 224 | 226 |
| 225 private: | 227 private: |
| 226 const char* GetFunctionName(String* name); | 228 INLINE(const char* GetFunctionName(String* name)); |
| 229 INLINE(const char* GetFunctionName(const char* name)); |
| 227 const char* GetName(String* name); | 230 const char* GetName(String* name); |
| 228 const char* GetName(int args_count); | 231 const char* GetName(int args_count); |
| 229 | 232 |
| 230 INLINE(static bool StringsMatch(void* key1, void* key2)) { | 233 INLINE(static bool StringsMatch(void* key1, void* key2)) { |
| 231 return strcmp(reinterpret_cast<char*>(key1), | 234 return strcmp(reinterpret_cast<char*>(key1), |
| 232 reinterpret_cast<char*>(key2)) == 0; | 235 reinterpret_cast<char*>(key2)) == 0; |
| 233 } | 236 } |
| 234 | 237 |
| 235 INLINE(static bool CpuProfilesMatch(void* key1, void* key2)) { | 238 INLINE(static bool CpuProfilesMatch(void* key1, void* key2)) { |
| 236 return key1 == key2; | 239 return key1 == key2; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 280 |
| 278 INLINE(CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, | 281 INLINE(CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, |
| 279 int args_count)) { | 282 int args_count)) { |
| 280 return profiles_->NewCodeEntry(tag, args_count); | 283 return profiles_->NewCodeEntry(tag, args_count); |
| 281 } | 284 } |
| 282 | 285 |
| 283 void RecordTickSample(const TickSample& sample); | 286 void RecordTickSample(const TickSample& sample); |
| 284 | 287 |
| 285 INLINE(CodeMap* code_map()) { return &code_map_; } | 288 INLINE(CodeMap* code_map()) { return &code_map_; } |
| 286 | 289 |
| 290 static const char* kAnonymousFunctionName; |
| 291 static const char* kProgramEntryName; |
| 292 static const char* kGarbageCollectorEntryName; |
| 293 |
| 287 private: | 294 private: |
| 295 INLINE(CodeEntry* EntryForVMState(StateTag tag)); |
| 296 |
| 288 CpuProfilesCollection* profiles_; | 297 CpuProfilesCollection* profiles_; |
| 289 CodeMap code_map_; | 298 CodeMap code_map_; |
| 290 CodeEntry* program_entry_; | 299 CodeEntry* program_entry_; |
| 300 CodeEntry* gc_entry_; |
| 291 | 301 |
| 292 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 302 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 293 }; | 303 }; |
| 294 | 304 |
| 295 } } // namespace v8::internal | 305 } } // namespace v8::internal |
| 296 | 306 |
| 297 #endif // ENABLE_CPP_PROFILES_PROCESSOR | 307 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
| 298 | 308 |
| 299 #endif // V8_PROFILE_GENERATOR_H_ | 309 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |