OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 | 58 |
59 void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) { | 59 void ProfilerEventsProcessor::Enqueue(const CodeEventsContainer& event) { |
60 event.generic.order = ++last_code_event_id_; | 60 event.generic.order = ++last_code_event_id_; |
61 events_buffer_.Enqueue(event); | 61 events_buffer_.Enqueue(event); |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) { | 65 void ProfilerEventsProcessor::AddCurrentStack(Isolate* isolate) { |
66 TickSampleEventRecord record(last_code_event_id_); | 66 TickSampleEventRecord record(last_code_event_id_); |
67 TickSample* sample = &record.sample; | 67 RegisterState regs; |
68 sample->state = isolate->current_vm_state(); | 68 StackFrameIterator it(isolate); |
69 sample->pc = reinterpret_cast<Address>(sample); // Not NULL. | 69 if (!it.done()) { |
70 for (StackTraceFrameIterator it(isolate); | 70 StackFrame* frame = it.frame(); |
71 !it.done() && sample->frames_count < TickSample::kMaxFramesCount; | 71 regs.sp = frame->sp(); |
72 it.Advance()) { | 72 regs.fp = frame->fp(); |
73 sample->stack[sample->frames_count++] = it.frame()->pc(); | 73 regs.pc = frame->pc(); |
74 } | 74 } |
| 75 record.sample.Init(isolate, regs); |
75 ticks_from_vm_buffer_.Enqueue(record); | 76 ticks_from_vm_buffer_.Enqueue(record); |
76 } | 77 } |
77 | 78 |
78 | 79 |
79 void ProfilerEventsProcessor::StopSynchronously() { | 80 void ProfilerEventsProcessor::StopSynchronously() { |
80 if (!running_) return; | 81 if (!running_) return; |
81 running_ = false; | 82 running_ = false; |
82 Join(); | 83 Join(); |
83 } | 84 } |
84 | 85 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 512 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
512 Builtins::Name id = static_cast<Builtins::Name>(i); | 513 Builtins::Name id = static_cast<Builtins::Name>(i); |
513 rec->start = builtins->builtin(id)->address(); | 514 rec->start = builtins->builtin(id)->address(); |
514 rec->builtin_id = id; | 515 rec->builtin_id = id; |
515 processor_->Enqueue(evt_rec); | 516 processor_->Enqueue(evt_rec); |
516 } | 517 } |
517 } | 518 } |
518 | 519 |
519 | 520 |
520 } } // namespace v8::internal | 521 } } // namespace v8::internal |
OLD | NEW |