ProfilerEventsProcessor::ProfilerEventsProcessor(
ProfileGenerator* generator,
Sampler* sampler,
- TimeDelta period)
+ base::TimeDelta period)
: Thread(Thread::Options("v8:ProfEvntProc", kProfilerStackSize)),
generator_(generator),
sampler_(sampler),
void ProfilerEventsProcessor::Run() {
while (running_) {
- ElapsedTimer timer;
+ base::ElapsedTimer timer;
timer.Start();
// Keep processing existing events until we need to do next sample.
do {
}
-void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code,
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
SharedFunctionInfo* shared,
- CompilationInfo* info,
- Name* name) {
+ CompilationInfo* info, Name* script_name) {
if (FilterOutCodeCreateEvent(tag)) return;
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->start = code->address();
- rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name));
+ rec->entry = profiles_->NewCodeEntry(
+ tag, profiles_->GetFunctionName(shared->DebugName()),
+ CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name));
if (info) {
rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
}
if (shared->script()->IsScript()) {
- ASSERT(Script::cast(shared->script()));
+ DCHECK(Script::cast(shared->script()));
Script* script = Script::cast(shared->script());
rec->entry->set_script_id(script->id()->value());
rec->entry->set_bailout_reason(
}
-void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code,
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code,
SharedFunctionInfo* shared,
- CompilationInfo* info,
- Name* source, int line, int column) {
+ CompilationInfo* info, Name* script_name,
+ int line, int column) {
if (FilterOutCodeCreateEvent(tag)) return;
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->start = code->address();
- // Get line info from the relocation information.
- ASSERT(Script::cast(shared->script()));
- JITLineInfoTable line_table;
- if (line > 0) {
- for (RelocIterator it(code); !it.done(); it.next()) {
- RelocInfo::Mode mode = it.rinfo()->rmode();
- if (RelocInfo::IsPosition(mode)) {
- int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address());
- int position = static_cast<int>(it.rinfo()->data());
- int lineno =
- Script::cast(shared->script())->GetLineNumber(position) + 1;
- if (position >= 0 && lineno > 0) {
- line_table.SetPosition(pc_offset, lineno);
- }
- }
- }
- }
rec->entry = profiles_->NewCodeEntry(
- tag,
- profiles_->GetFunctionName(shared->DebugName()),
- CodeEntry::kEmptyNamePrefix,
- profiles_->GetName(source),
- line,
- column,
- line_table.entries()->length() ? &line_table : NULL);
+ tag, profiles_->GetFunctionName(shared->DebugName()),
+ CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line,
+ column);
if (info) {
rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
}
+ DCHECK(Script::cast(shared->script()));
Script* script = Script::cast(shared->script());
rec->entry->set_script_id(script->id()->value());
rec->size = code->ExecutableSize();
CpuProfiler::CpuProfiler(Isolate* isolate)
: isolate_(isolate),
- sampling_interval_(TimeDelta::FromMicroseconds(
+ sampling_interval_(base::TimeDelta::FromMicroseconds(
FLAG_cpu_profiler_sampling_interval)),
profiles_(new CpuProfilesCollection(isolate->heap())),
generator_(NULL),
ProfileGenerator* test_generator,
ProfilerEventsProcessor* test_processor)
: isolate_(isolate),
- sampling_interval_(TimeDelta::FromMicroseconds(
+ sampling_interval_(base::TimeDelta::FromMicroseconds(
FLAG_cpu_profiler_sampling_interval)),
profiles_(test_profiles),
generator_(test_generator),
CpuProfiler::~CpuProfiler() {
- ASSERT(!is_profiling_);
+ DCHECK(!is_profiling_);
delete profiles_;
}
-void CpuProfiler::set_sampling_interval(TimeDelta value) {
- ASSERT(!is_profiling_);
+void CpuProfiler::set_sampling_interval(base::TimeDelta value) {
+ DCHECK(!is_profiling_);
sampling_interval_ = value;
}
generator_, sampler, sampling_interval_);
is_profiling_ = true;
// Enumerate stuff we already have in the heap.
- ASSERT(isolate_->heap()->HasBeenSetUp());
+ DCHECK(isolate_->heap()->HasBeenSetUp());
if (!FLAG_prof_browser_mode) {
logger->LogCodeObjects();
}
void CpuProfiler::LogBuiltins() {
Builtins* builtins = isolate_->builtins();
- ASSERT(builtins->is_initialized());
+ DCHECK(builtins->is_initialized());
for (int i = 0; i < Builtins::builtin_count; i++) {
CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN);
ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;