yangguo@chromium.org | ab30bb8 | 2012-02-24 14:41:46 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_LOG_H_ |
| 29 | #define V8_LOG_H_ |
| 30 | |
lrn@chromium.org | 1c09276 | 2011-05-09 09:42:16 +0000 | [diff] [blame] | 31 | #include "allocation.h" |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 32 | #include "objects.h" |
ager@chromium.org | 3e87580 | 2009-06-29 08:26:34 +0000 | [diff] [blame] | 33 | #include "platform.h" |
jkummerow@chromium.org | dc94e19 | 2013-08-30 11:35:42 +0000 | [diff] [blame] | 34 | #include "platform/elapsed-timer.h" |
ager@chromium.org | 3e87580 | 2009-06-29 08:26:34 +0000 | [diff] [blame] | 35 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 36 | namespace v8 { |
| 37 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 38 | |
| 39 | // Logger is used for collecting logging information from V8 during |
| 40 | // execution. The result is dumped to a file. |
| 41 | // |
| 42 | // Available command line flags: |
| 43 | // |
| 44 | // --log |
| 45 | // Minimal logging (no API, code, or GC sample events), default is off. |
| 46 | // |
| 47 | // --log-all |
| 48 | // Log all events to the file, default is off. This is the same as combining |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 49 | // --log-api, --log-code, --log-gc, and --log-regexp. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 50 | // |
| 51 | // --log-api |
| 52 | // Log API events to the logfile, default is off. --log-api implies --log. |
| 53 | // |
| 54 | // --log-code |
| 55 | // Log code (create, move, and delete) events to the logfile, default is off. |
| 56 | // --log-code implies --log. |
| 57 | // |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 58 | // --log-gc |
| 59 | // Log GC heap samples after each GC that can be processed by hp2ps, default |
| 60 | // is off. --log-gc implies --log. |
| 61 | // |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 62 | // --log-regexp |
| 63 | // Log creation and use of regular expressions, Default is off. |
| 64 | // --log-regexp implies --log. |
| 65 | // |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 66 | // --logfile <filename> |
| 67 | // Specify the name of the logfile, default is "v8.log". |
| 68 | // |
| 69 | // --prof |
| 70 | // Collect statistical profiling information (ticks), default is off. The |
| 71 | // tick profiler requires code events, so --prof implies --log-code. |
| 72 | |
| 73 | // Forward declarations. |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 74 | class CodeEventListener; |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 75 | class CompilationInfo; |
| 76 | class CpuProfiler; |
| 77 | class Isolate; |
| 78 | class Log; |
| 79 | class PositionsRecorder; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 80 | class Profiler; |
| 81 | class Semaphore; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 82 | class Ticker; |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 83 | struct TickSample; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 84 | |
| 85 | #undef LOG |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 86 | #define LOG(isolate, Call) \ |
| 87 | do { \ |
| 88 | v8::internal::Logger* logger = \ |
| 89 | (isolate)->logger(); \ |
| 90 | if (logger->is_logging()) \ |
| 91 | logger->Call; \ |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 92 | } while (false) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 93 | |
yangguo@chromium.org | 355cfd1 | 2012-08-29 15:32:24 +0000 | [diff] [blame] | 94 | #define LOG_CODE_EVENT(isolate, Call) \ |
| 95 | do { \ |
| 96 | v8::internal::Logger* logger = \ |
| 97 | (isolate)->logger(); \ |
| 98 | if (logger->is_logging_code_events()) \ |
| 99 | logger->Call; \ |
| 100 | } while (false) |
| 101 | |
| 102 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 103 | #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
| 104 | V(CODE_CREATION_EVENT, "code-creation") \ |
| 105 | V(CODE_MOVE_EVENT, "code-move") \ |
| 106 | V(CODE_DELETE_EVENT, "code-delete") \ |
| 107 | V(CODE_MOVING_GC, "code-moving-gc") \ |
| 108 | V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ |
| 109 | V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ |
| 110 | V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ |
| 111 | V(TICK_EVENT, "tick") \ |
| 112 | V(REPEAT_META_EVENT, "repeat") \ |
| 113 | V(BUILTIN_TAG, "Builtin") \ |
| 114 | V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ |
| 115 | V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ |
| 116 | V(CALL_IC_TAG, "CallIC") \ |
| 117 | V(CALL_INITIALIZE_TAG, "CallInitialize") \ |
| 118 | V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ |
| 119 | V(CALL_MISS_TAG, "CallMiss") \ |
| 120 | V(CALL_NORMAL_TAG, "CallNormal") \ |
| 121 | V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ |
| 122 | V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ |
| 123 | V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ |
| 124 | "KeyedCallDebugPrepareStepIn") \ |
| 125 | V(KEYED_CALL_IC_TAG, "KeyedCallIC") \ |
| 126 | V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ |
| 127 | V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ |
| 128 | V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ |
| 129 | V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ |
| 130 | V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ |
| 131 | V(CALLBACK_TAG, "Callback") \ |
| 132 | V(EVAL_TAG, "Eval") \ |
| 133 | V(FUNCTION_TAG, "Function") \ |
jkummerow@chromium.org | 32aa03c | 2013-10-01 08:21:50 +0000 | [diff] [blame] | 134 | V(HANDLER_TAG, "Handler") \ |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 135 | V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 136 | V(KEYED_LOAD_POLYMORPHIC_IC_TAG, "KeyedLoadPolymorphicIC") \ |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 137 | V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ |
| 138 | V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 139 | V(KEYED_STORE_POLYMORPHIC_IC_TAG, "KeyedStorePolymorphicIC") \ |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 140 | V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \ |
| 141 | V(LAZY_COMPILE_TAG, "LazyCompile") \ |
| 142 | V(LOAD_IC_TAG, "LoadIC") \ |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame] | 143 | V(LOAD_POLYMORPHIC_IC_TAG, "LoadPolymorphicIC") \ |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 144 | V(REG_EXP_TAG, "RegExp") \ |
| 145 | V(SCRIPT_TAG, "Script") \ |
| 146 | V(STORE_IC_TAG, "StoreIC") \ |
svenpanne@chromium.org | 2bda543 | 2013-03-15 12:39:50 +0000 | [diff] [blame] | 147 | V(STORE_POLYMORPHIC_IC_TAG, "StorePolymorphicIC") \ |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 148 | V(STUB_TAG, "Stub") \ |
| 149 | V(NATIVE_FUNCTION_TAG, "Function") \ |
| 150 | V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 151 | V(NATIVE_SCRIPT_TAG, "Script") |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 152 | // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
| 153 | // original tags when writing to the log. |
| 154 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 155 | |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 156 | class JitLogger; |
jkummerow@chromium.org | 1048047 | 2013-07-17 08:22:15 +0000 | [diff] [blame] | 157 | class LowLevelLogger; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 158 | class Sampler; |
| 159 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 160 | class Logger { |
| 161 | public: |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 162 | #define DECLARE_ENUM(enum_item, ignore) enum_item, |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 163 | enum LogEventsAndTags { |
| 164 | LOG_EVENTS_AND_TAGS_LIST(DECLARE_ENUM) |
| 165 | NUMBER_OF_LOG_EVENTS |
| 166 | }; |
| 167 | #undef DECLARE_ENUM |
| 168 | |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 169 | // Acquires resources for logging if the right flags are set. |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 170 | bool SetUp(Isolate* isolate); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 171 | |
yangguo@chromium.org | 355cfd1 | 2012-08-29 15:32:24 +0000 | [diff] [blame] | 172 | // Sets the current code event handler. |
| 173 | void SetCodeEventHandler(uint32_t options, |
| 174 | JitCodeEventHandler event_handler); |
| 175 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 176 | Sampler* sampler(); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 177 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 178 | // Frees resources acquired in SetUp. |
whesse@chromium.org | 030d38e | 2011-07-13 13:23:34 +0000 | [diff] [blame] | 179 | // When a temporary file is used for the log, returns its stream descriptor, |
| 180 | // leaving the file open. |
| 181 | FILE* TearDown(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 182 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 183 | // Emits an event with a string value -> (name, value). |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 184 | void StringEvent(const char* name, const char* value); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 185 | |
| 186 | // Emits an event with an int value -> (name, value). |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 187 | void IntEvent(const char* name, int value); |
| 188 | void IntPtrTEvent(const char* name, intptr_t value); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 189 | |
| 190 | // Emits an event with an handle value -> (name, location). |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 191 | void HandleEvent(const char* name, Object** location); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 192 | |
| 193 | // Emits memory management events for C allocated structures. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 194 | void NewEvent(const char* name, void* object, size_t size); |
| 195 | void DeleteEvent(const char* name, void* object); |
| 196 | |
| 197 | // Static versions of the above, operate on current isolate's logger. |
| 198 | // Used in TRACK_MEMORY(TypeName) defined in globals.h |
| 199 | static void NewEventStatic(const char* name, void* object, size_t size); |
| 200 | static void DeleteEventStatic(const char* name, void* object); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 201 | |
| 202 | // Emits an event with a tag, and some resource usage information. |
| 203 | // -> (name, tag, <rusage information>). |
| 204 | // Currently, the resource usage information is a process time stamp |
| 205 | // and a real time timestamp. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 206 | void ResourceEvent(const char* name, const char* tag); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 207 | |
| 208 | // Emits an event that an undefined property was read from an |
| 209 | // object. |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 210 | void SuspectReadEvent(Name* name, Object* obj); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 211 | |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 212 | // Emits an event when a message is put on or read from a debugging queue. |
| 213 | // DebugTag lets us put a call-site specific label on the event. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 214 | void DebugTag(const char* call_site_tag); |
| 215 | void DebugEvent(const char* event_type, Vector<uint16_t> parameter); |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 216 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 217 | |
| 218 | // ==== Events logged by --log-api. ==== |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 219 | void ApiNamedSecurityCheck(Object* key); |
| 220 | void ApiIndexedSecurityCheck(uint32_t index); |
| 221 | void ApiNamedPropertyAccess(const char* tag, JSObject* holder, Object* name); |
| 222 | void ApiIndexedPropertyAccess(const char* tag, |
| 223 | JSObject* holder, |
| 224 | uint32_t index); |
| 225 | void ApiObjectAccess(const char* tag, JSObject* obj); |
| 226 | void ApiEntryCall(const char* name); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 227 | |
| 228 | |
| 229 | // ==== Events logged by --log-code. ==== |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 230 | void addCodeEventListener(CodeEventListener* listener); |
| 231 | void removeCodeEventListener(CodeEventListener* listener); |
| 232 | bool hasCodeEventListener(CodeEventListener* listener); |
| 233 | |
| 234 | |
ager@chromium.org | 01beca7 | 2009-11-24 14:29:16 +0000 | [diff] [blame] | 235 | // Emits a code event for a callback function. |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 236 | void CallbackEvent(Name* name, Address entry_point); |
| 237 | void GetterCallbackEvent(Name* name, Address entry_point); |
| 238 | void SetterCallbackEvent(Name* name, Address entry_point); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 239 | // Emits a code create event. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 240 | void CodeCreateEvent(LogEventsAndTags tag, |
| 241 | Code* code, const char* source); |
| 242 | void CodeCreateEvent(LogEventsAndTags tag, |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 243 | Code* code, Name* name); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 244 | void CodeCreateEvent(LogEventsAndTags tag, |
| 245 | Code* code, |
| 246 | SharedFunctionInfo* shared, |
jkummerow@chromium.org | 4e308cf | 2013-05-17 13:39:16 +0000 | [diff] [blame] | 247 | CompilationInfo* info, |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 248 | Name* name); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 249 | void CodeCreateEvent(LogEventsAndTags tag, |
| 250 | Code* code, |
| 251 | SharedFunctionInfo* shared, |
jkummerow@chromium.org | 4e308cf | 2013-05-17 13:39:16 +0000 | [diff] [blame] | 252 | CompilationInfo* info, |
jkummerow@chromium.org | 1e8da74 | 2013-08-26 17:13:35 +0000 | [diff] [blame] | 253 | Name* source, int line, int column); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 254 | void CodeCreateEvent(LogEventsAndTags tag, Code* code, int args_count); |
| 255 | void CodeMovingGCEvent(); |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 256 | // Emits a code create event for a RegExp. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 257 | void RegExpCodeCreateEvent(Code* code, String* source); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 258 | // Emits a code move event. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 259 | void CodeMoveEvent(Address from, Address to); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 260 | // Emits a code delete event. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 261 | void CodeDeleteEvent(Address from); |
yangguo@chromium.org | c03a192 | 2013-02-19 13:55:47 +0000 | [diff] [blame] | 262 | // Emits a code line info add event with Postion type. |
| 263 | void CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
| 264 | int pc_offset, |
| 265 | int position); |
| 266 | // Emits a code line info add event with StatementPostion type. |
| 267 | void CodeLinePosInfoAddStatementPositionEvent(void* jit_handler_data, |
| 268 | int pc_offset, |
| 269 | int position); |
| 270 | // Emits a code line info start to record event |
| 271 | void CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder); |
| 272 | // Emits a code line info finish record event. |
| 273 | // It's the callee's responsibility to dispose the parameter jit_handler_data. |
| 274 | void CodeEndLinePosInfoRecordEvent(Code* code, void* jit_handler_data); |
fschneider@chromium.org | 3a5fd78 | 2011-02-24 10:10:44 +0000 | [diff] [blame] | 275 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 276 | void SharedFunctionInfoMoveEvent(Address from, Address to); |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 277 | |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 278 | void CodeNameEvent(Address addr, int pos, const char* code_name); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 279 | void SnapshotPositionEvent(Address addr, int pos); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 280 | |
| 281 | // ==== Events logged by --log-gc. ==== |
| 282 | // Heap sampling events: start, end, and individual types. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 283 | void HeapSampleBeginEvent(const char* space, const char* kind); |
| 284 | void HeapSampleEndEvent(const char* space, const char* kind); |
| 285 | void HeapSampleItemEvent(const char* type, int number, int bytes); |
| 286 | void HeapSampleJSConstructorEvent(const char* constructor, |
| 287 | int number, int bytes); |
| 288 | void HeapSampleJSRetainersEvent(const char* constructor, |
christian.plesner.hansen@gmail.com | 2bc58ef | 2009-09-22 10:00:30 +0000 | [diff] [blame] | 289 | const char* event); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 290 | void HeapSampleJSProducerEvent(const char* constructor, |
| 291 | Address* stack); |
| 292 | void HeapSampleStats(const char* space, const char* kind, |
| 293 | intptr_t capacity, intptr_t used); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 294 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 295 | void SharedLibraryEvent(const char* library_path, |
| 296 | uintptr_t start, |
| 297 | uintptr_t end); |
| 298 | void SharedLibraryEvent(const wchar_t* library_path, |
| 299 | uintptr_t start, |
| 300 | uintptr_t end); |
svenpanne@chromium.org | 83130cf | 2012-11-30 10:13:25 +0000 | [diff] [blame] | 301 | |
| 302 | // ==== Events logged by --log-timer-events. ==== |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 303 | enum StartEnd { START, END }; |
| 304 | |
machenbach@chromium.org | c1789ee | 2013-07-05 07:09:57 +0000 | [diff] [blame] | 305 | void CodeDeoptEvent(Code* code); |
| 306 | |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 307 | void TimerEvent(StartEnd se, const char* name); |
svenpanne@chromium.org | 83130cf | 2012-11-30 10:13:25 +0000 | [diff] [blame] | 308 | |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 309 | static void EnterExternal(Isolate* isolate); |
| 310 | static void LeaveExternal(Isolate* isolate); |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 311 | |
| 312 | class TimerEventScope { |
| 313 | public: |
danno@chromium.org | 1f34ad3 | 2012-11-26 14:53:56 +0000 | [diff] [blame] | 314 | TimerEventScope(Isolate* isolate, const char* name) |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 315 | : isolate_(isolate), name_(name) { |
| 316 | if (FLAG_log_internal_timer_events) LogTimerEvent(START); |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | ~TimerEventScope() { |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 320 | if (FLAG_log_internal_timer_events) LogTimerEvent(END); |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 321 | } |
| 322 | |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 323 | void LogTimerEvent(StartEnd se); |
danno@chromium.org | 1f34ad3 | 2012-11-26 14:53:56 +0000 | [diff] [blame] | 324 | |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 325 | static const char* v8_recompile_synchronous; |
rossberg@chromium.org | 9259716 | 2013-08-23 13:28:00 +0000 | [diff] [blame] | 326 | static const char* v8_recompile_concurrent; |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 327 | static const char* v8_compile_full_code; |
| 328 | static const char* v8_execute; |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 329 | static const char* v8_external; |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 330 | |
| 331 | private: |
danno@chromium.org | 1f34ad3 | 2012-11-26 14:53:56 +0000 | [diff] [blame] | 332 | Isolate* isolate_; |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 333 | const char* name_; |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 334 | }; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 335 | |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 336 | // ==== Events logged by --log-regexp ==== |
| 337 | // Regexp compilation and execution events. |
| 338 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 339 | void RegExpCompileEvent(Handle<JSRegExp> regexp, bool in_cache); |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 340 | |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 341 | // Log an event reported from generated code |
mstarzinger@chromium.org | e27d617 | 2013-04-17 11:51:44 +0000 | [diff] [blame] | 342 | void LogRuntime(Vector<const char> format, JSArray* args); |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 343 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 344 | bool is_logging() { |
jkummerow@chromium.org | dc94e19 | 2013-08-30 11:35:42 +0000 | [diff] [blame] | 345 | return is_logging_; |
ager@chromium.org | 3e87580 | 2009-06-29 08:26:34 +0000 | [diff] [blame] | 346 | } |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 347 | |
yangguo@chromium.org | 355cfd1 | 2012-08-29 15:32:24 +0000 | [diff] [blame] | 348 | bool is_logging_code_events() { |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 349 | return is_logging() || jit_logger_ != NULL; |
yangguo@chromium.org | 355cfd1 | 2012-08-29 15:32:24 +0000 | [diff] [blame] | 350 | } |
| 351 | |
jkummerow@chromium.org | dc94e19 | 2013-08-30 11:35:42 +0000 | [diff] [blame] | 352 | // Stop collection of profiling data. |
| 353 | // When data collection is paused, CPU Tick events are discarded. |
| 354 | void StopProfiler(); |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 355 | |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 356 | void LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| 357 | Handle<Code> code); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 358 | // Logs all compiled functions found in the heap. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 359 | void LogCompiledFunctions(); |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 360 | // Logs all accessor callbacks found in the heap. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 361 | void LogAccessorCallbacks(); |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 362 | // Used for logging stubs found in the snapshot. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 363 | void LogCodeObjects(); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 364 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 365 | // Converts tag to a corresponding NATIVE_... if the script is native. |
| 366 | INLINE(static LogEventsAndTags ToNativeByScript(LogEventsAndTags, Script*)); |
| 367 | |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 368 | // Profiler's sampling interval (in milliseconds). |
svenpanne@chromium.org | ecb9dd6 | 2011-12-01 08:22:35 +0000 | [diff] [blame] | 369 | #if defined(ANDROID) |
| 370 | // Phones and tablets have processors that are much slower than desktop |
| 371 | // and laptop computers for which current heuristics are tuned. |
| 372 | static const int kSamplingIntervalMs = 5; |
| 373 | #else |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 374 | static const int kSamplingIntervalMs = 1; |
svenpanne@chromium.org | ecb9dd6 | 2011-12-01 08:22:35 +0000 | [diff] [blame] | 375 | #endif |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 376 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 377 | // Callback from Log, stops profiling in case of insufficient resources. |
| 378 | void LogFailure(); |
| 379 | |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 380 | private: |
yangguo@chromium.org | c03a192 | 2013-02-19 13:55:47 +0000 | [diff] [blame] | 381 | explicit Logger(Isolate* isolate); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 382 | ~Logger(); |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 383 | |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 384 | // Emits the profiler's first message. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 385 | void ProfilerBeginEvent(); |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 386 | |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 387 | // Emits callback event messages. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 388 | void CallbackEventInternal(const char* prefix, |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 389 | Name* name, |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 390 | Address entry_point); |
sgjesse@chromium.org | ac6aa17 | 2009-12-04 12:29:05 +0000 | [diff] [blame] | 391 | |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 392 | // Internal configurable move event. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 393 | void MoveEventInternal(LogEventsAndTags event, Address from, Address to); |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 394 | |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 395 | // Emits the source code of a regexp. Used by regexp events. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 396 | void LogRegExpSource(Handle<JSRegExp> regexp); |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 397 | |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 398 | // Used for logging stubs found in the snapshot. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 399 | void LogCodeObject(Object* code_object); |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 400 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 401 | // Helper method. It resets name_buffer_ and add tag name into it. |
| 402 | void InitNameBuffer(LogEventsAndTags tag); |
| 403 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 404 | // Emits a profiler tick event. Used by the profiler thread. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 405 | void TickEvent(TickSample* sample, bool overflow); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 406 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 407 | void ApiEvent(const char* name, ...); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 408 | |
ager@chromium.org | 6f10e41 | 2009-02-13 10:11:16 +0000 | [diff] [blame] | 409 | // Logs a StringEvent regardless of whether FLAG_log is true. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 410 | void UncheckedStringEvent(const char* name, const char* value); |
ager@chromium.org | 6f10e41 | 2009-02-13 10:11:16 +0000 | [diff] [blame] | 411 | |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 412 | // Logs an IntEvent regardless of whether FLAG_log is true. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 413 | void UncheckedIntEvent(const char* name, int value); |
| 414 | void UncheckedIntPtrTEvent(const char* name, intptr_t value); |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 415 | |
yangguo@chromium.org | c03a192 | 2013-02-19 13:55:47 +0000 | [diff] [blame] | 416 | Isolate* isolate_; |
| 417 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 418 | // The sampler used by the profiler and the sliding state window. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 419 | Ticker* ticker_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 420 | |
| 421 | // When the statistical profile is active, profiler_ |
| 422 | // points to a Profiler, that handles collection |
| 423 | // of samples. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 424 | Profiler* profiler_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 425 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 426 | // An array of log events names. |
| 427 | const char* const* log_events_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 428 | |
| 429 | // Internal implementation classes with access to |
| 430 | // private members. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 431 | friend class EventLog; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 432 | friend class Isolate; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 433 | friend class TimeLog; |
| 434 | friend class Profiler; |
danno@chromium.org | ca29dd8 | 2013-04-26 11:59:48 +0000 | [diff] [blame] | 435 | template <StateTag Tag> friend class VMState; |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 436 | friend class LoggerTestHelper; |
ager@chromium.org | 3e87580 | 2009-06-29 08:26:34 +0000 | [diff] [blame] | 437 | |
jkummerow@chromium.org | dc94e19 | 2013-08-30 11:35:42 +0000 | [diff] [blame] | 438 | bool is_logging_; |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 439 | Log* log_; |
jkummerow@chromium.org | 1048047 | 2013-07-17 08:22:15 +0000 | [diff] [blame] | 440 | LowLevelLogger* ll_logger_; |
jkummerow@chromium.org | ba72ec8 | 2013-07-22 09:21:20 +0000 | [diff] [blame] | 441 | JitLogger* jit_logger_; |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 442 | List<CodeEventListener*> listeners_; |
sgjesse@chromium.org | 8e8294a | 2011-05-02 14:30:53 +0000 | [diff] [blame] | 443 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 444 | // Guards against multiple calls to TearDown() that can happen in some tests. |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 445 | // 'true' between SetUp() and TearDown(). |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 446 | bool is_initialized_; |
| 447 | |
jkummerow@chromium.org | dc94e19 | 2013-08-30 11:35:42 +0000 | [diff] [blame] | 448 | ElapsedTimer timer_; |
ulan@chromium.org | 8e8d882 | 2012-11-23 14:36:46 +0000 | [diff] [blame] | 449 | |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 450 | friend class CpuProfiler; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 451 | }; |
| 452 | |
| 453 | |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 454 | class CodeEventListener { |
| 455 | public: |
| 456 | virtual ~CodeEventListener() {} |
| 457 | |
| 458 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 459 | Code* code, |
| 460 | const char* comment) = 0; |
| 461 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 462 | Code* code, |
| 463 | Name* name) = 0; |
| 464 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 465 | Code* code, |
| 466 | SharedFunctionInfo* shared, |
| 467 | CompilationInfo* info, |
| 468 | Name* name) = 0; |
| 469 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 470 | Code* code, |
| 471 | SharedFunctionInfo* shared, |
| 472 | CompilationInfo* info, |
| 473 | Name* source, |
mvstanton@chromium.org | dd6d9ee | 2013-10-11 10:35:37 +0000 | [diff] [blame] | 474 | int line, int column) = 0; |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 475 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 476 | Code* code, |
| 477 | int args_count) = 0; |
| 478 | virtual void CallbackEvent(Name* name, Address entry_point) = 0; |
| 479 | virtual void GetterCallbackEvent(Name* name, Address entry_point) = 0; |
| 480 | virtual void SetterCallbackEvent(Name* name, Address entry_point) = 0; |
| 481 | virtual void RegExpCodeCreateEvent(Code* code, String* source) = 0; |
| 482 | virtual void CodeMoveEvent(Address from, Address to) = 0; |
| 483 | virtual void CodeDeleteEvent(Address from) = 0; |
| 484 | virtual void SharedFunctionInfoMoveEvent(Address from, Address to) = 0; |
| 485 | virtual void CodeMovingGCEvent() = 0; |
| 486 | }; |
| 487 | |
| 488 | |
| 489 | class CodeEventLogger : public CodeEventListener { |
| 490 | public: |
| 491 | CodeEventLogger(); |
| 492 | virtual ~CodeEventLogger(); |
| 493 | |
| 494 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 495 | Code* code, |
| 496 | const char* comment); |
| 497 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 498 | Code* code, |
| 499 | Name* name); |
| 500 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 501 | Code* code, |
| 502 | int args_count); |
| 503 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 504 | Code* code, |
| 505 | SharedFunctionInfo* shared, |
| 506 | CompilationInfo* info, |
| 507 | Name* name); |
| 508 | virtual void CodeCreateEvent(Logger::LogEventsAndTags tag, |
| 509 | Code* code, |
| 510 | SharedFunctionInfo* shared, |
| 511 | CompilationInfo* info, |
| 512 | Name* source, |
mvstanton@chromium.org | dd6d9ee | 2013-10-11 10:35:37 +0000 | [diff] [blame] | 513 | int line, int column); |
danno@chromium.org | d3c4210 | 2013-08-01 16:58:23 +0000 | [diff] [blame] | 514 | virtual void RegExpCodeCreateEvent(Code* code, String* source); |
| 515 | |
| 516 | virtual void CallbackEvent(Name* name, Address entry_point) { } |
| 517 | virtual void GetterCallbackEvent(Name* name, Address entry_point) { } |
| 518 | virtual void SetterCallbackEvent(Name* name, Address entry_point) { } |
| 519 | virtual void SharedFunctionInfoMoveEvent(Address from, Address to) { } |
| 520 | virtual void CodeMovingGCEvent() { } |
| 521 | |
| 522 | private: |
| 523 | class NameBuffer; |
| 524 | |
| 525 | virtual void LogRecordedBuffer(Code* code, |
| 526 | SharedFunctionInfo* shared, |
| 527 | const char* name, |
| 528 | int length) = 0; |
| 529 | |
| 530 | NameBuffer* name_buffer_; |
| 531 | }; |
| 532 | |
| 533 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 534 | } } // namespace v8::internal |
| 535 | |
lrn@chromium.org | 25156de | 2010-04-06 13:10:27 +0000 | [diff] [blame] | 536 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 537 | #endif // V8_LOG_H_ |