| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Forward declarations. | 40 // Forward declarations. |
| 41 class CodeEntry; | 41 class CodeEntry; |
| 42 class CodeMap; | 42 class CodeMap; |
| 43 class CpuProfile; | 43 class CpuProfile; |
| 44 class CpuProfilesCollection; | 44 class CpuProfilesCollection; |
| 45 class HashMap; | 45 class HashMap; |
| 46 class ProfileGenerator; | 46 class ProfileGenerator; |
| 47 class TokenEnumerator; | 47 class TokenEnumerator; |
| 48 | 48 |
| 49 #define CODE_EVENTS_TYPE_LIST(V) \ | 49 #define CODE_EVENTS_TYPE_LIST(V) \ |
| 50 V(CODE_CREATION, CodeCreateEventRecord) \ | 50 V(CODE_CREATION, CodeCreateEventRecord) \ |
| 51 V(CODE_MOVE, CodeMoveEventRecord) \ | 51 V(CODE_MOVE, CodeMoveEventRecord) \ |
| 52 V(CODE_DELETE, CodeDeleteEventRecord) \ | 52 V(CODE_DELETE, CodeDeleteEventRecord) \ |
| 53 V(SFI_MOVE, SFIMoveEventRecord) | 53 V(SHARED_FUNC_MOVE, SharedFunctionInfoMoveEventRecord) |
| 54 | 54 |
| 55 | 55 |
| 56 class CodeEventRecord { | 56 class CodeEventRecord { |
| 57 public: | 57 public: |
| 58 #define DECLARE_TYPE(type, ignore) type, | 58 #define DECLARE_TYPE(type, ignore) type, |
| 59 enum Type { | 59 enum Type { |
| 60 NONE = 0, | 60 NONE = 0, |
| 61 CODE_EVENTS_TYPE_LIST(DECLARE_TYPE) | 61 CODE_EVENTS_TYPE_LIST(DECLARE_TYPE) |
| 62 NUMBER_OF_TYPES | 62 NUMBER_OF_TYPES |
| 63 }; | 63 }; |
| 64 #undef DECLARE_TYPE | 64 #undef DECLARE_TYPE |
| 65 | 65 |
| 66 Type type; | 66 Type type; |
| 67 unsigned order; | 67 unsigned order; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 | 70 |
| 71 class CodeCreateEventRecord : public CodeEventRecord { | 71 class CodeCreateEventRecord : public CodeEventRecord { |
| 72 public: | 72 public: |
| 73 Address start; | 73 Address start; |
| 74 CodeEntry* entry; | 74 CodeEntry* entry; |
| 75 unsigned size; | 75 unsigned size; |
| 76 Address sfi_address; | 76 Address shared; |
| 77 | 77 |
| 78 INLINE(void UpdateCodeMap(CodeMap* code_map)); | 78 INLINE(void UpdateCodeMap(CodeMap* code_map)); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 | 81 |
| 82 class CodeMoveEventRecord : public CodeEventRecord { | 82 class CodeMoveEventRecord : public CodeEventRecord { |
| 83 public: | 83 public: |
| 84 Address from; | 84 Address from; |
| 85 Address to; | 85 Address to; |
| 86 | 86 |
| 87 INLINE(void UpdateCodeMap(CodeMap* code_map)); | 87 INLINE(void UpdateCodeMap(CodeMap* code_map)); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 | 90 |
| 91 class CodeDeleteEventRecord : public CodeEventRecord { | 91 class CodeDeleteEventRecord : public CodeEventRecord { |
| 92 public: | 92 public: |
| 93 Address start; | 93 Address start; |
| 94 | 94 |
| 95 INLINE(void UpdateCodeMap(CodeMap* code_map)); | 95 INLINE(void UpdateCodeMap(CodeMap* code_map)); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 | 98 |
| 99 class SFIMoveEventRecord : public CodeEventRecord { | 99 class SharedFunctionInfoMoveEventRecord : public CodeEventRecord { |
| 100 public: | 100 public: |
| 101 Address from; | 101 Address from; |
| 102 Address to; | 102 Address to; |
| 103 | 103 |
| 104 INLINE(void UpdateCodeMap(CodeMap* code_map)); | 104 INLINE(void UpdateCodeMap(CodeMap* code_map)); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 | 107 |
| 108 class TickSampleEventRecord BASE_EMBEDDED { | 108 class TickSampleEventRecord BASE_EMBEDDED { |
| 109 public: | 109 public: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 INLINE(bool running()) { return running_; } | 143 INLINE(bool running()) { return running_; } |
| 144 | 144 |
| 145 // Events adding methods. Called by VM threads. | 145 // Events adding methods. Called by VM threads. |
| 146 void CallbackCreateEvent(Logger::LogEventsAndTags tag, | 146 void CallbackCreateEvent(Logger::LogEventsAndTags tag, |
| 147 const char* prefix, String* name, | 147 const char* prefix, String* name, |
| 148 Address start); | 148 Address start); |
| 149 void CodeCreateEvent(Logger::LogEventsAndTags tag, | 149 void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 150 String* name, | 150 String* name, |
| 151 String* resource_name, int line_number, | 151 String* resource_name, int line_number, |
| 152 Address start, unsigned size, | 152 Address start, unsigned size, |
| 153 Address sfi_address); | 153 Address shared); |
| 154 void CodeCreateEvent(Logger::LogEventsAndTags tag, | 154 void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 155 const char* name, | 155 const char* name, |
| 156 Address start, unsigned size); | 156 Address start, unsigned size); |
| 157 void CodeCreateEvent(Logger::LogEventsAndTags tag, | 157 void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 158 int args_count, | 158 int args_count, |
| 159 Address start, unsigned size); | 159 Address start, unsigned size); |
| 160 void CodeMoveEvent(Address from, Address to); | 160 void CodeMoveEvent(Address from, Address to); |
| 161 void CodeDeleteEvent(Address from); | 161 void CodeDeleteEvent(Address from); |
| 162 void SFIMoveEvent(Address from, Address to); | 162 void SharedFunctionInfoMoveEvent(Address from, Address to); |
| 163 void RegExpCodeCreateEvent(Logger::LogEventsAndTags tag, | 163 void RegExpCodeCreateEvent(Logger::LogEventsAndTags tag, |
| 164 const char* prefix, String* name, | 164 const char* prefix, String* name, |
| 165 Address start, unsigned size); | 165 Address start, unsigned size); |
| 166 // Puts current stack into tick sample events buffer. | 166 // Puts current stack into tick sample events buffer. |
| 167 void AddCurrentStack(); | 167 void AddCurrentStack(); |
| 168 | 168 |
| 169 // Tick sample events are filled directly in the buffer of the circular | 169 // Tick sample events are filled directly in the buffer of the circular |
| 170 // queue (because the structure is of fixed width, but usually not all | 170 // queue (because the structure is of fixed width, but usually not all |
| 171 // stack frame entries are filled.) This method returns a pointer to the | 171 // stack frame entries are filled.) This method returns a pointer to the |
| 172 // next record of the buffer. | 172 // next record of the buffer. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 SharedFunctionInfo *shared, | 247 SharedFunctionInfo *shared, |
| 248 String* source, int line); | 248 String* source, int line); |
| 249 static void CodeCreateEvent(Logger::LogEventsAndTags tag, | 249 static void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 250 Code* code, int args_count); | 250 Code* code, int args_count); |
| 251 static void CodeMovingGCEvent() {} | 251 static void CodeMovingGCEvent() {} |
| 252 static void CodeMoveEvent(Address from, Address to); | 252 static void CodeMoveEvent(Address from, Address to); |
| 253 static void CodeDeleteEvent(Address from); | 253 static void CodeDeleteEvent(Address from); |
| 254 static void GetterCallbackEvent(String* name, Address entry_point); | 254 static void GetterCallbackEvent(String* name, Address entry_point); |
| 255 static void RegExpCodeCreateEvent(Code* code, String* source); | 255 static void RegExpCodeCreateEvent(Code* code, String* source); |
| 256 static void SetterCallbackEvent(String* name, Address entry_point); | 256 static void SetterCallbackEvent(String* name, Address entry_point); |
| 257 static void SFIMoveEvent(Address from, Address to); | 257 static void SharedFunctionInfoMoveEvent(Address from, Address to); |
| 258 | 258 |
| 259 // TODO(isolates): this doesn't have to use atomics anymore. | 259 // TODO(isolates): this doesn't have to use atomics anymore. |
| 260 | 260 |
| 261 static INLINE(bool is_profiling()) { | 261 static INLINE(bool is_profiling()) { |
| 262 return is_profiling(Isolate::Current()); | 262 return is_profiling(Isolate::Current()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 static INLINE(bool is_profiling(Isolate* isolate)) { | 265 static INLINE(bool is_profiling(Isolate* isolate)) { |
| 266 CpuProfiler* profiler = isolate->cpu_profiler(); | 266 CpuProfiler* profiler = isolate->cpu_profiler(); |
| 267 return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_); | 267 return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 290 #endif // ENABLE_LOGGING_AND_PROFILING | 290 #endif // ENABLE_LOGGING_AND_PROFILING |
| 291 | 291 |
| 292 private: | 292 private: |
| 293 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); | 293 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 } } // namespace v8::internal | 296 } } // namespace v8::internal |
| 297 | 297 |
| 298 | 298 |
| 299 #endif // V8_CPU_PROFILER_H_ | 299 #endif // V8_CPU_PROFILER_H_ |
| OLD | NEW |