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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Address alias; | 97 Address alias; |
98 Address start; | 98 Address start; |
99 | 99 |
100 INLINE(void UpdateCodeMap(CodeMap* code_map)); | 100 INLINE(void UpdateCodeMap(CodeMap* code_map)); |
101 }; | 101 }; |
102 | 102 |
103 | 103 |
104 class TickSampleEventRecord BASE_EMBEDDED { | 104 class TickSampleEventRecord BASE_EMBEDDED { |
105 public: | 105 public: |
106 // In memory, the first machine word of a TickSampleEventRecord will be the | 106 // In memory, the first machine word of a TickSampleEventRecord will be the |
107 // first entry of TickSample, that is -- a program counter field. | 107 // first entry of TickSample, that is -- the VM state field. |
108 // TickSample is put first, because 'order' can become equal to | 108 // TickSample is put first, because 'order' can become equal to |
109 // SamplingCircularQueue::kClear, while program counter can't. | 109 // SamplingCircularQueue::kClear, while VM state can't, see |
| 110 // the definition of 'enum StateTag'. |
110 TickSample sample; | 111 TickSample sample; |
111 unsigned order; | 112 unsigned order; |
112 | 113 |
113 static TickSampleEventRecord* cast(void* value) { | 114 static TickSampleEventRecord* cast(void* value) { |
114 return reinterpret_cast<TickSampleEventRecord*>(value); | 115 return reinterpret_cast<TickSampleEventRecord*>(value); |
115 } | 116 } |
116 | 117 |
117 private: | 118 private: |
118 DISALLOW_IMPLICIT_CONSTRUCTORS(TickSampleEventRecord); | 119 DISALLOW_IMPLICIT_CONSTRUCTORS(TickSampleEventRecord); |
119 }; | 120 }; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 CodeEventRecord generic; | 166 CodeEventRecord generic; |
166 #define DECLARE_CLASS(ignore, type) type type##_; | 167 #define DECLARE_CLASS(ignore, type) type type##_; |
167 CODE_EVENTS_TYPE_LIST(DECLARE_CLASS) | 168 CODE_EVENTS_TYPE_LIST(DECLARE_CLASS) |
168 #undef DECLARE_TYPE | 169 #undef DECLARE_TYPE |
169 }; | 170 }; |
170 | 171 |
171 // Called from events processing thread (Run() method.) | 172 // Called from events processing thread (Run() method.) |
172 bool ProcessCodeEvent(unsigned* dequeue_order); | 173 bool ProcessCodeEvent(unsigned* dequeue_order); |
173 bool ProcessTicks(unsigned dequeue_order); | 174 bool ProcessTicks(unsigned dequeue_order); |
174 | 175 |
| 176 INLINE(static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)); |
| 177 |
175 ProfileGenerator* generator_; | 178 ProfileGenerator* generator_; |
176 bool running_; | 179 bool running_; |
177 CircularQueue<CodeEventsContainer> events_buffer_; | 180 CircularQueue<CodeEventsContainer> events_buffer_; |
178 SamplingCircularQueue ticks_buffer_; | 181 SamplingCircularQueue ticks_buffer_; |
179 unsigned enqueue_order_; | 182 unsigned enqueue_order_; |
180 }; | 183 }; |
181 | 184 |
182 } } // namespace v8::internal | 185 } } // namespace v8::internal |
183 | 186 |
184 | 187 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 static void CodeMoveEvent(Address from, Address to); | 232 static void CodeMoveEvent(Address from, Address to); |
230 static void CodeDeleteEvent(Address from); | 233 static void CodeDeleteEvent(Address from); |
231 static void FunctionCreateEvent(JSFunction* function); | 234 static void FunctionCreateEvent(JSFunction* function); |
232 static void FunctionMoveEvent(Address from, Address to); | 235 static void FunctionMoveEvent(Address from, Address to); |
233 static void FunctionDeleteEvent(Address from); | 236 static void FunctionDeleteEvent(Address from); |
234 static void GetterCallbackEvent(String* name, Address entry_point); | 237 static void GetterCallbackEvent(String* name, Address entry_point); |
235 static void RegExpCodeCreateEvent(Code* code, String* source); | 238 static void RegExpCodeCreateEvent(Code* code, String* source); |
236 static void SetterCallbackEvent(String* name, Address entry_point); | 239 static void SetterCallbackEvent(String* name, Address entry_point); |
237 | 240 |
238 static INLINE(bool is_profiling()) { | 241 static INLINE(bool is_profiling()) { |
239 ASSERT(singleton_ != NULL); | 242 return singleton_ != NULL && singleton_->processor_ != NULL; |
240 return singleton_->processor_ != NULL; | |
241 } | 243 } |
242 | 244 |
243 private: | 245 private: |
244 CpuProfiler(); | 246 CpuProfiler(); |
245 ~CpuProfiler(); | 247 ~CpuProfiler(); |
246 void StartCollectingProfile(const char* title); | 248 void StartCollectingProfile(const char* title); |
247 void StartCollectingProfile(String* title); | 249 void StartCollectingProfile(String* title); |
248 void StartProcessorIfNotStarted(); | 250 void StartProcessorIfNotStarted(); |
249 CpuProfile* StopCollectingProfile(const char* title); | 251 CpuProfile* StopCollectingProfile(const char* title); |
250 CpuProfile* StopCollectingProfile(String* title); | 252 CpuProfile* StopCollectingProfile(String* title); |
(...skipping 11 matching lines...) Expand all Loading... |
262 #endif // ENABLE_CPP_PROFILES_PROCESSOR | 264 #endif // ENABLE_CPP_PROFILES_PROCESSOR |
263 | 265 |
264 private: | 266 private: |
265 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 267 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
266 }; | 268 }; |
267 | 269 |
268 } } // namespace v8::internal | 270 } } // namespace v8::internal |
269 | 271 |
270 | 272 |
271 #endif // V8_CPU_PROFILER_H_ | 273 #endif // V8_CPU_PROFILER_H_ |
OLD | NEW |