Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: src/log-inl.h

Issue 1523015: C++ profiles processor: align browser mode with the old implementation, sample VM state. (Closed)
Patch Set: Using Script::type to filter out native scripts. Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/log.cc ('k') | src/platform.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 11 matching lines...) Expand all
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_INL_H_ 28 #ifndef V8_LOG_INL_H_
29 #define V8_LOG_INL_H_ 29 #define V8_LOG_INL_H_
30 30
31 #include "log.h" 31 #include "log.h"
32 #include "cpu-profiler.h"
32 33
33 namespace v8 { 34 namespace v8 {
34 namespace internal { 35 namespace internal {
35 36
36 // 37 //
37 // VMState class implementation. A simple stack of VM states held by the 38 // VMState class implementation. A simple stack of VM states held by the
38 // logger and partially threaded through the call stack. States are pushed by 39 // logger and partially threaded through the call stack. States are pushed by
39 // VMState construction and popped by destruction. 40 // VMState construction and popped by destruction.
40 // 41 //
41 #ifdef ENABLE_LOGGING_AND_PROFILING 42 #ifdef ENABLE_LOGGING_AND_PROFILING
42 inline const char* StateToString(StateTag state) { 43 inline const char* StateToString(StateTag state) {
43 switch (state) { 44 switch (state) {
44 case JS: 45 case JS:
45 return "JS"; 46 return "JS";
46 case GC: 47 case GC:
47 return "GC"; 48 return "GC";
48 case COMPILER: 49 case COMPILER:
49 return "COMPILER"; 50 return "COMPILER";
50 case OTHER: 51 case OTHER:
51 return "OTHER"; 52 return "OTHER";
52 default: 53 default:
53 UNREACHABLE(); 54 UNREACHABLE();
54 return NULL; 55 return NULL;
55 } 56 }
56 } 57 }
57 58
58 VMState::VMState(StateTag state) : disabled_(true), external_callback_(NULL) { 59 VMState::VMState(StateTag state)
59 if (!Logger::is_logging()) { 60 : disabled_(true),
61 state_(OTHER),
62 external_callback_(NULL) {
63 if (!Logger::is_logging() && !CpuProfiler::is_profiling()) {
60 return; 64 return;
61 } 65 }
62 66
63 disabled_ = false; 67 disabled_ = false;
64 #if !defined(ENABLE_HEAP_PROTECTION) 68 #if !defined(ENABLE_HEAP_PROTECTION)
65 // When not protecting the heap, there is no difference between 69 // When not protecting the heap, there is no difference between
66 // EXTERNAL and OTHER. As an optimization in that case, we will not 70 // EXTERNAL and OTHER. As an optimization in that case, we will not
67 // perform EXTERNAL->OTHER transitions through the API. We thus 71 // perform EXTERNAL->OTHER transitions through the API. We thus
68 // compress the two states into one. 72 // compress the two states into one.
69 if (state == EXTERNAL) state = OTHER; 73 if (state == EXTERNAL) state = OTHER;
70 #endif 74 #endif
71 state_ = state; 75 state_ = state;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // We are reentering V8. 115 // We are reentering V8.
112 ASSERT(previous_->state_ != EXTERNAL); 116 ASSERT(previous_->state_ != EXTERNAL);
113 Heap::Unprotect(); 117 Heap::Unprotect();
114 } else if (previous_->state_ == EXTERNAL) { 118 } else if (previous_->state_ == EXTERNAL) {
115 // We are leaving V8. 119 // We are leaving V8.
116 Heap::Protect(); 120 Heap::Protect();
117 } 121 }
118 } 122 }
119 #endif 123 #endif
120 } 124 }
125
126 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
127 Script* script) {
128 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
129 if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG)
130 && script->type()->value() == Script::TYPE_NATIVE) {
131 switch (tag) {
132 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG;
133 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG;
134 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG;
135 default: return tag;
136 }
137 } else {
138 return tag;
139 }
140 #else
141 return tag;
142 #endif
143 }
144
121 #endif 145 #endif
122 146
123 147
124 } } // namespace v8::internal 148 } } // namespace v8::internal
125 149
126 #endif // V8_LOG_INL_H_ 150 #endif // V8_LOG_INL_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698