| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_LOG_H_ | 28 #ifndef V8_LOG_H_ |
| 29 #define V8_LOG_H_ | 29 #define V8_LOG_H_ |
| 30 | 30 |
| 31 #include "allocation.h" |
| 31 #include "objects.h" | 32 #include "objects.h" |
| 32 #include "platform.h" | 33 #include "platform.h" |
| 33 #include "log-utils.h" | 34 #include "log-utils.h" |
| 34 | 35 |
| 35 namespace v8 { | 36 namespace v8 { |
| 36 namespace internal { | 37 namespace internal { |
| 37 | 38 |
| 38 // Logger is used for collecting logging information from V8 during | 39 // Logger is used for collecting logging information from V8 during |
| 39 // execution. The result is dumped to a file. | 40 // execution. The result is dumped to a file. |
| 40 // | 41 // |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 do { \ | 84 do { \ |
| 84 v8::internal::Logger* logger = \ | 85 v8::internal::Logger* logger = \ |
| 85 (isolate)->logger(); \ | 86 (isolate)->logger(); \ |
| 86 if (logger->is_logging()) \ | 87 if (logger->is_logging()) \ |
| 87 logger->Call; \ | 88 logger->Call; \ |
| 88 } while (false) | 89 } while (false) |
| 89 #else | 90 #else |
| 90 #define LOG(isolate, Call) ((void) 0) | 91 #define LOG(isolate, Call) ((void) 0) |
| 91 #endif | 92 #endif |
| 92 | 93 |
| 93 #define LOG_EVENTS_AND_TAGS_LIST(V) \ | 94 #define LOG_EVENTS_AND_TAGS_LIST(V) \ |
| 94 V(CODE_CREATION_EVENT, "code-creation") \ | 95 V(CODE_CREATION_EVENT, "code-creation") \ |
| 95 V(CODE_MOVE_EVENT, "code-move") \ | 96 V(CODE_MOVE_EVENT, "code-move") \ |
| 96 V(CODE_DELETE_EVENT, "code-delete") \ | 97 V(CODE_DELETE_EVENT, "code-delete") \ |
| 97 V(CODE_MOVING_GC, "code-moving-gc") \ | 98 V(CODE_MOVING_GC, "code-moving-gc") \ |
| 98 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ | 99 V(SHARED_FUNC_MOVE_EVENT, "sfi-move") \ |
| 99 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ | 100 V(SNAPSHOT_POSITION_EVENT, "snapshot-pos") \ |
| 100 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ | 101 V(SNAPSHOT_CODE_NAME_EVENT, "snapshot-code-name") \ |
| 101 V(TICK_EVENT, "tick") \ | 102 V(TICK_EVENT, "tick") \ |
| 102 V(REPEAT_META_EVENT, "repeat") \ | 103 V(REPEAT_META_EVENT, "repeat") \ |
| 103 V(BUILTIN_TAG, "Builtin") \ | 104 V(BUILTIN_TAG, "Builtin") \ |
| 104 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ | 105 V(CALL_DEBUG_BREAK_TAG, "CallDebugBreak") \ |
| 105 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ | 106 V(CALL_DEBUG_PREPARE_STEP_IN_TAG, "CallDebugPrepareStepIn") \ |
| 106 V(CALL_IC_TAG, "CallIC") \ | 107 V(CALL_IC_TAG, "CallIC") \ |
| 107 V(CALL_INITIALIZE_TAG, "CallInitialize") \ | 108 V(CALL_INITIALIZE_TAG, "CallInitialize") \ |
| 108 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ | 109 V(CALL_MEGAMORPHIC_TAG, "CallMegamorphic") \ |
| 109 V(CALL_MISS_TAG, "CallMiss") \ | 110 V(CALL_MISS_TAG, "CallMiss") \ |
| 110 V(CALL_NORMAL_TAG, "CallNormal") \ | 111 V(CALL_NORMAL_TAG, "CallNormal") \ |
| 111 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ | 112 V(CALL_PRE_MONOMORPHIC_TAG, "CallPreMonomorphic") \ |
| 112 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ | 113 V(KEYED_CALL_DEBUG_BREAK_TAG, "KeyedCallDebugBreak") \ |
| 113 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ | 114 V(KEYED_CALL_DEBUG_PREPARE_STEP_IN_TAG, \ |
| 114 "KeyedCallDebugPrepareStepIn") \ | 115 "KeyedCallDebugPrepareStepIn") \ |
| 115 V(KEYED_CALL_IC_TAG, "KeyedCallIC") \ | 116 V(KEYED_CALL_IC_TAG, "KeyedCallIC") \ |
| 116 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ | 117 V(KEYED_CALL_INITIALIZE_TAG, "KeyedCallInitialize") \ |
| 117 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ | 118 V(KEYED_CALL_MEGAMORPHIC_TAG, "KeyedCallMegamorphic") \ |
| 118 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ | 119 V(KEYED_CALL_MISS_TAG, "KeyedCallMiss") \ |
| 119 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ | 120 V(KEYED_CALL_NORMAL_TAG, "KeyedCallNormal") \ |
| 120 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ | 121 V(KEYED_CALL_PRE_MONOMORPHIC_TAG, "KeyedCallPreMonomorphic") \ |
| 121 V(CALLBACK_TAG, "Callback") \ | 122 V(CALLBACK_TAG, "Callback") \ |
| 122 V(EVAL_TAG, "Eval") \ | 123 V(EVAL_TAG, "Eval") \ |
| 123 V(FUNCTION_TAG, "Function") \ | 124 V(FUNCTION_TAG, "Function") \ |
| 124 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ | 125 V(KEYED_LOAD_IC_TAG, "KeyedLoadIC") \ |
| 125 V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ | 126 V(KEYED_LOAD_MEGAMORPHIC_IC_TAG, "KeyedLoadMegamorphicIC") \ |
| 126 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ | 127 V(KEYED_EXTERNAL_ARRAY_LOAD_IC_TAG, "KeyedExternalArrayLoadIC") \ |
| 127 V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC")\ | 128 V(KEYED_STORE_IC_TAG, "KeyedStoreIC") \ |
| 128 V(LAZY_COMPILE_TAG, "LazyCompile") \ | 129 V(KEYED_STORE_MEGAMORPHIC_IC_TAG, "KeyedStoreMegamorphicIC") \ |
| 129 V(LOAD_IC_TAG, "LoadIC") \ | 130 V(KEYED_EXTERNAL_ARRAY_STORE_IC_TAG, "KeyedExternalArrayStoreIC") \ |
| 130 V(REG_EXP_TAG, "RegExp") \ | 131 V(LAZY_COMPILE_TAG, "LazyCompile") \ |
| 131 V(SCRIPT_TAG, "Script") \ | 132 V(LOAD_IC_TAG, "LoadIC") \ |
| 132 V(STORE_IC_TAG, "StoreIC") \ | 133 V(REG_EXP_TAG, "RegExp") \ |
| 133 V(STUB_TAG, "Stub") \ | 134 V(SCRIPT_TAG, "Script") \ |
| 134 V(NATIVE_FUNCTION_TAG, "Function") \ | 135 V(STORE_IC_TAG, "StoreIC") \ |
| 135 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ | 136 V(STUB_TAG, "Stub") \ |
| 137 V(NATIVE_FUNCTION_TAG, "Function") \ |
| 138 V(NATIVE_LAZY_COMPILE_TAG, "LazyCompile") \ |
| 136 V(NATIVE_SCRIPT_TAG, "Script") | 139 V(NATIVE_SCRIPT_TAG, "Script") |
| 137 // Note that 'NATIVE_' cases for functions and scripts are mapped onto | 140 // Note that 'NATIVE_' cases for functions and scripts are mapped onto |
| 138 // original tags when writing to the log. | 141 // original tags when writing to the log. |
| 139 | 142 |
| 140 | 143 |
| 141 class Sampler; | 144 class Sampler; |
| 142 | 145 |
| 143 | 146 |
| 144 class Logger { | 147 class Logger { |
| 145 public: | 148 public: |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // Class that extracts stack trace, used for profiling. | 468 // Class that extracts stack trace, used for profiling. |
| 466 class StackTracer : public AllStatic { | 469 class StackTracer : public AllStatic { |
| 467 public: | 470 public: |
| 468 static void Trace(Isolate* isolate, TickSample* sample); | 471 static void Trace(Isolate* isolate, TickSample* sample); |
| 469 }; | 472 }; |
| 470 | 473 |
| 471 } } // namespace v8::internal | 474 } } // namespace v8::internal |
| 472 | 475 |
| 473 | 476 |
| 474 #endif // V8_LOG_H_ | 477 #endif // V8_LOG_H_ |
| OLD | NEW |