2010-03-19 09:46:53 +00:00
|
|
|
// Copyright 2010 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2010-03-19 09:46:53 +00:00
|
|
|
|
|
|
|
#ifndef V8_CPU_PROFILER_INL_H_
|
|
|
|
#define V8_CPU_PROFILER_INL_H_
|
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/cpu-profiler.h"
|
2010-04-06 10:36:38 +00:00
|
|
|
|
2011-06-22 13:54:35 +00:00
|
|
|
#include <new>
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/circular-queue-inl.h"
|
|
|
|
#include "src/profile-generator-inl.h"
|
|
|
|
#include "src/unbound-queue-inl.h"
|
2010-03-19 09:46:53 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2010-04-06 10:36:38 +00:00
|
|
|
void CodeCreateEventRecord::UpdateCodeMap(CodeMap* code_map) {
|
2010-04-12 07:23:43 +00:00
|
|
|
code_map->AddCode(start, entry, size);
|
2011-03-10 12:00:27 +00:00
|
|
|
if (shared != NULL) {
|
|
|
|
entry->set_shared_id(code_map->GetSharedId(shared));
|
2011-02-22 16:31:24 +00:00
|
|
|
}
|
2010-04-06 10:36:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CodeMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
|
2010-04-12 07:23:43 +00:00
|
|
|
code_map->MoveCode(from, to);
|
2010-04-06 10:36:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-22 05:36:27 +00:00
|
|
|
void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) {
|
|
|
|
CodeEntry* entry = code_map->FindEntry(start);
|
|
|
|
if (entry != NULL) {
|
|
|
|
entry->set_bailout_reason(bailout_reason);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-10 12:00:27 +00:00
|
|
|
void SharedFunctionInfoMoveEventRecord::UpdateCodeMap(CodeMap* code_map) {
|
2011-02-22 16:31:24 +00:00
|
|
|
code_map->MoveCode(from, to);
|
2010-04-12 07:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-02 07:51:09 +00:00
|
|
|
void ReportBuiltinEventRecord::UpdateCodeMap(CodeMap* code_map) {
|
|
|
|
CodeEntry* entry = code_map->FindEntry(start);
|
|
|
|
if (!entry) {
|
|
|
|
// Code objects for builtins should already have been added to the map but
|
|
|
|
// some of them have been filtered out by CpuProfiler.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
entry->SetBuiltinId(builtin_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-23 08:22:07 +00:00
|
|
|
TickSample* CpuProfiler::StartTickSample() {
|
|
|
|
if (is_profiling_) return processor_->StartTickSample();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CpuProfiler::FinishTickSample() {
|
|
|
|
processor_->FinishTickSample();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TickSample* ProfilerEventsProcessor::StartTickSample() {
|
|
|
|
void* address = ticks_buffer_.StartEnqueue();
|
|
|
|
if (address == NULL) return NULL;
|
2012-11-30 10:26:21 +00:00
|
|
|
TickSampleEventRecord* evt =
|
2013-08-23 08:22:07 +00:00
|
|
|
new(address) TickSampleEventRecord(last_code_event_id_);
|
2012-11-30 10:26:21 +00:00
|
|
|
return &evt->sample;
|
2010-03-19 09:46:53 +00:00
|
|
|
}
|
|
|
|
|
2010-04-07 14:18:26 +00:00
|
|
|
|
2013-08-23 08:22:07 +00:00
|
|
|
void ProfilerEventsProcessor::FinishTickSample() {
|
|
|
|
ticks_buffer_.FinishEnqueue();
|
|
|
|
}
|
|
|
|
|
2010-03-19 09:46:53 +00:00
|
|
|
} } // namespace v8::internal
|
|
|
|
|
|
|
|
#endif // V8_CPU_PROFILER_INL_H_
|