1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef V8_CPU_PROFILER_INL_H_
6 #define V8_CPU_PROFILER_INL_H_
8 #include "src/cpu-profiler.h"
11 #include "src/circular-queue-inl.h"
12 #include "src/profile-generator-inl.h"
13 #include "src/unbound-queue-inl.h"
18 void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) {
19 code_map->AddCode(start, entry, size);
23 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
24 code_map->MoveCode(from, to);
28 void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) {
29 CodeEntry* entry = code_map->FindEntry(start);
31 entry->set_bailout_reason(bailout_reason);
36 void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) {
37 CodeEntry* entry = code_map->FindEntry(start);
38 if (entry != NULL) entry->set_deopt_info(deopt_reason, position, pc_offset);
42 void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) {
43 CodeEntry* entry = code_map->FindEntry(start);
45 // Code objects for builtins should already have been added to the map but
46 // some of them have been filtered out by CpuProfiler.
49 entry->SetBuiltinId(builtin_id);
53 TickSample* CpuProfiler::StartTickSample() {
54 if (is_profiling_) return processor_->StartTickSample();
59 void CpuProfiler::FinishTickSample() {
60 processor_->FinishTickSample();
64 TickSample* ProfilerEventsProcessor::StartTickSample() {
65 void* address = ticks_buffer_.StartEnqueue();
66 if (address == NULL) return NULL;
67 TickSampleEventRecord* evt =
68 new(address) TickSampleEventRecord(last_code_event_id_);
73 void ProfilerEventsProcessor::FinishTickSample() {
74 ticks_buffer_.FinishEnqueue();
77 } } // namespace v8::internal
79 #endif // V8_CPU_PROFILER_INL_H_