| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/profiler/profiler-listener.h" | 5 #include "src/profiler/profiler-listener.h" |
| 6 | 6 |
| 7 #include "src/deoptimizer.h" | 7 #include "src/deoptimizer.h" |
| 8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
| 9 #include "src/profiler/cpu-profiler.h" | 9 #include "src/profiler/cpu-profiler.h" |
| 10 #include "src/profiler/profile-generator-inl.h" | 10 #include "src/profiler/profile-generator-inl.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 void ProfilerListener::CodeDisableOptEvent(AbstractCode* code, | 139 void ProfilerListener::CodeDisableOptEvent(AbstractCode* code, |
| 140 SharedFunctionInfo* shared) { | 140 SharedFunctionInfo* shared) { |
| 141 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); | 141 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); |
| 142 CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; | 142 CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; |
| 143 rec->start = code->address(); | 143 rec->start = code->address(); |
| 144 rec->bailout_reason = GetBailoutReason(shared->disable_optimization_reason()); | 144 rec->bailout_reason = GetBailoutReason(shared->disable_optimization_reason()); |
| 145 DispatchCodeEvent(evt_rec); | 145 DispatchCodeEvent(evt_rec); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ProfilerListener::CodeDeoptEvent(Code* code, Address pc, | 148 void ProfilerListener::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc, |
| 149 int fp_to_sp_delta) { | 149 int fp_to_sp_delta) { |
| 150 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT); | 150 CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT); |
| 151 CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_; | 151 CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_; |
| 152 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc); | 152 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc); |
| 153 rec->start = code->address(); | 153 rec->start = code->address(); |
| 154 rec->deopt_reason = DeoptimizeReasonToString(info.deopt_reason); | 154 rec->deopt_reason = DeoptimizeReasonToString(info.deopt_reason); |
| 155 rec->deopt_id = info.deopt_id; | 155 rec->deopt_id = info.deopt_id; |
| 156 rec->pc = reinterpret_cast<void*>(pc); | 156 rec->pc = reinterpret_cast<void*>(pc); |
| 157 rec->fp_to_sp_delta = fp_to_sp_delta; | 157 rec->fp_to_sp_delta = fp_to_sp_delta; |
| 158 DispatchCodeEvent(evt_rec); | 158 DispatchCodeEvent(evt_rec); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { | 305 void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { |
| 306 base::LockGuard<base::Mutex> guard(&mutex_); | 306 base::LockGuard<base::Mutex> guard(&mutex_); |
| 307 auto it = std::find(observers_.begin(), observers_.end(), observer); | 307 auto it = std::find(observers_.begin(), observers_.end(), observer); |
| 308 if (it == observers_.end()) return; | 308 if (it == observers_.end()) return; |
| 309 observers_.erase(it); | 309 observers_.erase(it); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace internal | 312 } // namespace internal |
| 313 } // namespace v8 | 313 } // namespace v8 |
| OLD | NEW |