| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } \ | 219 } \ |
| 220 } while (false) | 220 } while (false) |
| 221 #else | 221 #else |
| 222 #define PROFILE(Call) LOG(Call) | 222 #define PROFILE(Call) LOG(Call) |
| 223 #endif // ENABLE_LOGGING_AND_PROFILING | 223 #endif // ENABLE_LOGGING_AND_PROFILING |
| 224 | 224 |
| 225 | 225 |
| 226 namespace v8 { | 226 namespace v8 { |
| 227 namespace internal { | 227 namespace internal { |
| 228 | 228 |
| 229 |
| 230 // TODO(isolates): isolatify this class. |
| 229 class CpuProfiler { | 231 class CpuProfiler { |
| 230 public: | 232 public: |
| 231 static void Setup(); | 233 static void Setup(); |
| 232 static void TearDown(); | 234 static void TearDown(); |
| 233 | 235 |
| 234 #ifdef ENABLE_LOGGING_AND_PROFILING | 236 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 235 static void StartProfiling(const char* title); | 237 static void StartProfiling(const char* title); |
| 236 static void StartProfiling(String* title); | 238 static void StartProfiling(String* title); |
| 237 static CpuProfile* StopProfiling(const char* title); | 239 static CpuProfile* StopProfiling(const char* title); |
| 238 static CpuProfile* StopProfiling(Object* security_token, String* title); | 240 static CpuProfile* StopProfiling(Object* security_token, String* title); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 263 // if it was created from compiled code). | 265 // if it was created from compiled code). |
| 264 static void FunctionCreateEventFromMove(Heap* heap, JSFunction* function); | 266 static void FunctionCreateEventFromMove(Heap* heap, JSFunction* function); |
| 265 static void FunctionMoveEvent(Heap* heap, Address from, Address to); | 267 static void FunctionMoveEvent(Heap* heap, Address from, Address to); |
| 266 static void FunctionDeleteEvent(Address from); | 268 static void FunctionDeleteEvent(Address from); |
| 267 static void GetterCallbackEvent(String* name, Address entry_point); | 269 static void GetterCallbackEvent(String* name, Address entry_point); |
| 268 static void RegExpCodeCreateEvent(Code* code, String* source); | 270 static void RegExpCodeCreateEvent(Code* code, String* source); |
| 269 static void ProcessMovedFunctions(); | 271 static void ProcessMovedFunctions(); |
| 270 static void SetterCallbackEvent(String* name, Address entry_point); | 272 static void SetterCallbackEvent(String* name, Address entry_point); |
| 271 | 273 |
| 272 static INLINE(bool is_profiling()) { | 274 static INLINE(bool is_profiling()) { |
| 273 Isolate* isolate = Isolate::Current(); | 275 return is_profiling(Isolate::Current()); |
| 276 } |
| 277 |
| 278 static INLINE(bool is_profiling(Isolate* isolate)) { |
| 274 return isolate->cpu_profiler() != NULL && | 279 return isolate->cpu_profiler() != NULL && |
| 275 isolate->cpu_profiler()->processor_ != NULL; | 280 isolate->cpu_profiler()->processor_ != NULL; |
| 276 } | 281 } |
| 277 | 282 |
| 278 private: | 283 private: |
| 279 CpuProfiler(); | 284 CpuProfiler(); |
| 280 ~CpuProfiler(); | 285 ~CpuProfiler(); |
| 281 void StartCollectingProfile(const char* title); | 286 void StartCollectingProfile(const char* title); |
| 282 void StartCollectingProfile(String* title); | 287 void StartCollectingProfile(String* title); |
| 283 void StartProcessorIfNotStarted(); | 288 void StartProcessorIfNotStarted(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 297 #endif // ENABLE_LOGGING_AND_PROFILING | 302 #endif // ENABLE_LOGGING_AND_PROFILING |
| 298 | 303 |
| 299 private: | 304 private: |
| 300 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 305 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 301 }; | 306 }; |
| 302 | 307 |
| 303 } } // namespace v8::internal | 308 } } // namespace v8::internal |
| 304 | 309 |
| 305 | 310 |
| 306 #endif // V8_CPU_PROFILER_H_ | 311 #endif // V8_CPU_PROFILER_H_ |
| OLD | NEW |