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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 int line_number) | 42 int line_number) |
43 : call_uid_(next_call_uid_++), | 43 : call_uid_(next_call_uid_++), |
44 tag_(tag), | 44 tag_(tag), |
45 name_prefix_(name_prefix), | 45 name_prefix_(name_prefix), |
46 name_(name), | 46 name_(name), |
47 resource_name_(resource_name), | 47 resource_name_(resource_name), |
48 line_number_(line_number) { | 48 line_number_(line_number) { |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 bool CodeEntry::is_js_function() const { | 52 bool CodeEntry::is_js_function_tag(Logger::LogEventsAndTags tag) { |
53 return tag_ == Logger::FUNCTION_TAG | 53 return tag == Logger::FUNCTION_TAG |
54 || tag_ == Logger::LAZY_COMPILE_TAG | 54 || tag == Logger::LAZY_COMPILE_TAG |
55 || tag_ == Logger::SCRIPT_TAG; | 55 || tag == Logger::SCRIPT_TAG |
| 56 || tag == Logger::NATIVE_FUNCTION_TAG |
| 57 || tag == Logger::NATIVE_LAZY_COMPILE_TAG |
| 58 || tag == Logger::NATIVE_SCRIPT_TAG; |
56 } | 59 } |
57 | 60 |
58 | 61 |
59 ProfileNode::ProfileNode(CodeEntry* entry) | 62 ProfileNode::ProfileNode(CodeEntry* entry) |
60 : entry_(entry), | 63 : entry_(entry), |
61 total_ticks_(0), | 64 total_ticks_(0), |
62 self_ticks_(0), | 65 self_ticks_(0), |
63 children_(CodeEntriesMatch) { | 66 children_(CodeEntriesMatch) { |
64 } | 67 } |
65 | 68 |
(...skipping 13 matching lines...) Expand all Loading... |
79 tree_.Remove(addr); | 82 tree_.Remove(addr); |
80 } | 83 } |
81 | 84 |
82 | 85 |
83 bool CpuProfilesCollection::is_last_profile() { | 86 bool CpuProfilesCollection::is_last_profile() { |
84 // Called from VM thread, and only it can mutate the list, | 87 // Called from VM thread, and only it can mutate the list, |
85 // so no locking is needed here. | 88 // so no locking is needed here. |
86 return current_profiles_.length() == 1; | 89 return current_profiles_.length() == 1; |
87 } | 90 } |
88 | 91 |
| 92 |
| 93 const char* CpuProfilesCollection::GetFunctionName(String* name) { |
| 94 return GetFunctionName(GetName(name)); |
| 95 } |
| 96 |
| 97 |
| 98 const char* CpuProfilesCollection::GetFunctionName(const char* name) { |
| 99 return strlen(name) > 0 ? name : ProfileGenerator::kAnonymousFunctionName; |
| 100 } |
| 101 |
| 102 |
| 103 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { |
| 104 switch (tag) { |
| 105 case GC: |
| 106 return gc_entry_; |
| 107 case JS: |
| 108 case COMPILER: |
| 109 // DOM events handlers are reported as OTHER / EXTERNAL entries. |
| 110 // To avoid confusing people, let's put all these entries into |
| 111 // one bucket. |
| 112 case OTHER: |
| 113 case EXTERNAL: |
| 114 return program_entry_; |
| 115 default: return NULL; |
| 116 } |
| 117 } |
| 118 |
89 } } // namespace v8::internal | 119 } } // namespace v8::internal |
90 | 120 |
91 #endif // ENABLE_CPP_PROFILES_PROCESSOR | 121 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
92 | 122 |
93 #endif // V8_PROFILE_GENERATOR_INL_H_ | 123 #endif // V8_PROFILE_GENERATOR_INL_H_ |
OLD | NEW |