OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/cpu-profiler-inl.h" | 7 #include "src/cpu-profiler-inl.h" |
8 | 8 |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 215 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
216 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 216 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
217 rec->start = code->address(); | 217 rec->start = code->address(); |
218 rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name)); | 218 rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name)); |
219 rec->size = code->ExecutableSize(); | 219 rec->size = code->ExecutableSize(); |
220 rec->shared = NULL; | 220 rec->shared = NULL; |
221 processor_->Enqueue(evt_rec); | 221 processor_->Enqueue(evt_rec); |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 225 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
226 Code* code, | |
227 SharedFunctionInfo* shared, | 226 SharedFunctionInfo* shared, |
228 CompilationInfo* info, | 227 CompilationInfo* info, Name* script_name) { |
229 Name* name) { | |
230 if (FilterOutCodeCreateEvent(tag)) return; | 228 if (FilterOutCodeCreateEvent(tag)) return; |
231 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 229 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
232 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 230 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
233 rec->start = code->address(); | 231 rec->start = code->address(); |
234 rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name)); | 232 rec->entry = profiles_->NewCodeEntry( |
| 233 tag, profiles_->GetFunctionName(shared->DebugName()), |
| 234 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name)); |
235 if (info) { | 235 if (info) { |
236 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); | 236 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
237 } | 237 } |
238 if (shared->script()->IsScript()) { | 238 if (shared->script()->IsScript()) { |
239 DCHECK(Script::cast(shared->script())); | 239 DCHECK(Script::cast(shared->script())); |
240 Script* script = Script::cast(shared->script()); | 240 Script* script = Script::cast(shared->script()); |
241 rec->entry->set_script_id(script->id()->value()); | 241 rec->entry->set_script_id(script->id()->value()); |
242 rec->entry->set_bailout_reason( | 242 rec->entry->set_bailout_reason( |
243 GetBailoutReason(shared->DisableOptimizationReason())); | 243 GetBailoutReason(shared->DisableOptimizationReason())); |
244 } | 244 } |
245 rec->size = code->ExecutableSize(); | 245 rec->size = code->ExecutableSize(); |
246 rec->shared = shared->address(); | 246 rec->shared = shared->address(); |
247 processor_->Enqueue(evt_rec); | 247 processor_->Enqueue(evt_rec); |
248 } | 248 } |
249 | 249 |
250 | 250 |
251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, | 251 void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
252 Code* code, | |
253 SharedFunctionInfo* shared, | 252 SharedFunctionInfo* shared, |
254 CompilationInfo* info, | 253 CompilationInfo* info, Name* script_name, |
255 Name* source, int line, int column) { | 254 int line, int column) { |
256 if (FilterOutCodeCreateEvent(tag)) return; | 255 if (FilterOutCodeCreateEvent(tag)) return; |
257 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); | 256 CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
258 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; | 257 CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
259 rec->start = code->address(); | 258 rec->start = code->address(); |
260 rec->entry = profiles_->NewCodeEntry( | 259 rec->entry = profiles_->NewCodeEntry( |
261 tag, | 260 tag, profiles_->GetFunctionName(shared->DebugName()), |
262 profiles_->GetFunctionName(shared->DebugName()), | 261 CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, |
263 CodeEntry::kEmptyNamePrefix, | |
264 profiles_->GetName(source), | |
265 line, | |
266 column); | 262 column); |
267 if (info) { | 263 if (info) { |
268 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); | 264 rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges()); |
269 } | 265 } |
270 DCHECK(Script::cast(shared->script())); | 266 DCHECK(Script::cast(shared->script())); |
271 Script* script = Script::cast(shared->script()); | 267 Script* script = Script::cast(shared->script()); |
272 rec->entry->set_script_id(script->id()->value()); | 268 rec->entry->set_script_id(script->id()->value()); |
273 rec->size = code->ExecutableSize(); | 269 rec->size = code->ExecutableSize(); |
274 rec->shared = shared->address(); | 270 rec->shared = shared->address(); |
275 rec->entry->set_bailout_reason( | 271 rec->entry->set_bailout_reason( |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 499 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
504 Builtins::Name id = static_cast<Builtins::Name>(i); | 500 Builtins::Name id = static_cast<Builtins::Name>(i); |
505 rec->start = builtins->builtin(id)->address(); | 501 rec->start = builtins->builtin(id)->address(); |
506 rec->builtin_id = id; | 502 rec->builtin_id = id; |
507 processor_->Enqueue(evt_rec); | 503 processor_->Enqueue(evt_rec); |
508 } | 504 } |
509 } | 505 } |
510 | 506 |
511 | 507 |
512 } } // namespace v8::internal | 508 } } // namespace v8::internal |
OLD | NEW |