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);
21 entry->set_shared_id(code_map->GetSharedId(shared));
26 void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
27 code_map->MoveCode(from, to);
31 void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) {
32 CodeEntry* entry = code_map->FindEntry(start);
34 entry->set_bailout_reason(bailout_reason);
39 void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
40 code_map->MoveCode(from, to);
44 void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) {
45 CodeEntry* entry = code_map->FindEntry(start);
47 // Code objects for builtins should already have been added to the map but
48 // some of them have been filtered out by CpuProfiler.
51 entry->SetBuiltinId(builtin_id);
55 TickSample* CpuProfiler::StartTickSample() {
56 if (is_profiling_) return processor_->StartTickSample();
61 void CpuProfiler::FinishTickSample() {
62 processor_->FinishTickSample();
66 TickSample* ProfilerEventsProcessor::StartTickSample() {
67 void* address = ticks_buffer_.StartEnqueue();
68 if (address == NULL) return NULL;
69 TickSampleEventRecord* evt =
70 new(address) TickSampleEventRecord(last_code_event_id_);
75 void ProfilerEventsProcessor::FinishTickSample() {
76 ticks_buffer_.FinishEnqueue();
79 } } // namespace v8::internal
81 #endif // V8_CPU_PROFILER_INL_H_