OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Avoid collecting traces while doing GC. | 153 // Avoid collecting traces while doing GC. |
154 if (sample->state == GC) return; | 154 if (sample->state == GC) return; |
155 | 155 |
156 const Address js_entry_sp = | 156 const Address js_entry_sp = |
157 Isolate::js_entry_sp(isolate->thread_local_top()); | 157 Isolate::js_entry_sp(isolate->thread_local_top()); |
158 if (js_entry_sp == 0) { | 158 if (js_entry_sp == 0) { |
159 // Not executing JS now. | 159 // Not executing JS now. |
160 return; | 160 return; |
161 } | 161 } |
162 | 162 |
163 // Sample potential return address value for frameless invocation of | |
164 // stubs (we'll figure out later, if this value makes sense). | |
165 sample->tos = Memory::Address_at(sample->sp); | |
166 | |
167 int i = 0; | |
168 const Address callback = isolate->external_callback(); | 163 const Address callback = isolate->external_callback(); |
169 // Surprisingly, PC can point _exactly_ to callback start, with good | 164 if (callback != NULL) { |
170 // probability, and this will result in reporting fake nested | 165 sample->external_callback = callback; |
171 // callback call. | 166 sample->has_external_callback = true; |
172 if (callback != NULL && callback != sample->pc) { | 167 } else { |
173 sample->stack[i++] = callback; | 168 // Sample potential return address value for frameless invocation of |
| 169 // stubs (we'll figure out later, if this value makes sense). |
| 170 sample->tos = Memory::Address_at(sample->sp); |
| 171 sample->has_external_callback = false; |
174 } | 172 } |
175 | 173 |
176 SafeStackTraceFrameIterator it(isolate, | 174 SafeStackTraceFrameIterator it(isolate, |
177 sample->fp, sample->sp, | 175 sample->fp, sample->sp, |
178 sample->sp, js_entry_sp); | 176 sample->sp, js_entry_sp); |
| 177 int i = 0; |
179 while (!it.done() && i < TickSample::kMaxFramesCount) { | 178 while (!it.done() && i < TickSample::kMaxFramesCount) { |
180 sample->stack[i++] = it.frame()->pc(); | 179 sample->stack[i++] = it.frame()->pc(); |
181 it.Advance(); | 180 it.Advance(); |
182 } | 181 } |
183 sample->frames_count = i; | 182 sample->frames_count = i; |
184 } | 183 } |
185 | 184 |
186 | 185 |
187 // | 186 // |
188 // Ticker used to provide ticks to the profiler and the sliding state | 187 // Ticker used to provide ticks to the profiler and the sliding state |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 | 1126 |
1128 #ifdef ENABLE_LOGGING_AND_PROFILING | 1127 #ifdef ENABLE_LOGGING_AND_PROFILING |
1129 void Logger::TickEvent(TickSample* sample, bool overflow) { | 1128 void Logger::TickEvent(TickSample* sample, bool overflow) { |
1130 if (!log_->IsEnabled() || !FLAG_prof) return; | 1129 if (!log_->IsEnabled() || !FLAG_prof) return; |
1131 LogMessageBuilder msg(this); | 1130 LogMessageBuilder msg(this); |
1132 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); | 1131 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); |
1133 msg.AppendAddress(sample->pc); | 1132 msg.AppendAddress(sample->pc); |
1134 msg.Append(','); | 1133 msg.Append(','); |
1135 msg.AppendAddress(sample->sp); | 1134 msg.AppendAddress(sample->sp); |
1136 msg.Append(','); | 1135 msg.Append(','); |
1137 msg.AppendAddress(sample->tos); | 1136 if (sample->has_external_callback) { |
| 1137 msg.Append(",1,"); |
| 1138 msg.AppendAddress(sample->external_callback); |
| 1139 } else { |
| 1140 msg.Append(",0,"); |
| 1141 msg.AppendAddress(sample->tos); |
| 1142 } |
1138 msg.Append(",%d", static_cast<int>(sample->state)); | 1143 msg.Append(",%d", static_cast<int>(sample->state)); |
1139 if (overflow) { | 1144 if (overflow) { |
1140 msg.Append(",overflow"); | 1145 msg.Append(",overflow"); |
1141 } | 1146 } |
1142 for (int i = 0; i < sample->frames_count; ++i) { | 1147 for (int i = 0; i < sample->frames_count; ++i) { |
1143 msg.Append(','); | 1148 msg.Append(','); |
1144 msg.AppendAddress(sample->stack[i]); | 1149 msg.AppendAddress(sample->stack[i]); |
1145 } | 1150 } |
1146 msg.Append('\n'); | 1151 msg.Append('\n'); |
1147 msg.WriteToLogFile(); | 1152 msg.WriteToLogFile(); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1654 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1650 ASSERT(sampler->IsActive()); | 1655 ASSERT(sampler->IsActive()); |
1651 ScopedLock lock(mutex_); | 1656 ScopedLock lock(mutex_); |
1652 ASSERT(active_samplers_ != NULL); | 1657 ASSERT(active_samplers_ != NULL); |
1653 bool removed = active_samplers_->RemoveElement(sampler); | 1658 bool removed = active_samplers_->RemoveElement(sampler); |
1654 ASSERT(removed); | 1659 ASSERT(removed); |
1655 USE(removed); | 1660 USE(removed); |
1656 } | 1661 } |
1657 | 1662 |
1658 } } // namespace v8::internal | 1663 } } // namespace v8::internal |
OLD | NEW |