Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: src/profiler/cpu-profiler.cc

Issue 1973993002: [compiler] Profiler reconstructs inlined frames for deopts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix build. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profiler/cpu-profiler.h ('k') | src/profiler/cpu-profiler-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/cpu-profiler.cc
diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc
index 05a1bad445cb7b27e06cd71c5ca26406cbd306ee..98e79263e75c194c0150ea470d3ed7e2b73a4b4b 100644
--- a/src/profiler/cpu-profiler.cc
+++ b/src/profiler/cpu-profiler.cc
@@ -307,9 +307,7 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag,
profiles_->GetName(InferScriptName(script_name, shared)), line, column,
line_table, abstract_code->instruction_start());
RecordInliningInfo(rec->entry, abstract_code);
- if (info) {
- rec->entry->set_inlined_function_infos(info->inlined_function_infos());
- }
+ RecordDeoptInlinedFrames(rec->entry, abstract_code);
rec->entry->FillFunctionInfo(shared);
rec->size = abstract_code->ExecutableSize();
processor_->Enqueue(evt_rec);
@@ -353,7 +351,7 @@ void CpuProfiler::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) {
rec->start = code->address();
rec->deopt_reason = Deoptimizer::GetDeoptReason(info.deopt_reason);
rec->position = info.position;
- rec->inlining_id = info.inlining_id;
+ rec->deopt_id = info.deopt_id;
processor_->Enqueue(evt_rec);
processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta);
}
@@ -450,6 +448,54 @@ void CpuProfiler::RecordInliningInfo(CodeEntry* entry,
}
}
+void CpuProfiler::RecordDeoptInlinedFrames(CodeEntry* entry,
+ AbstractCode* abstract_code) {
+ if (abstract_code->kind() != AbstractCode::OPTIMIZED_FUNCTION) return;
+ Code* code = abstract_code->GetCode();
+ DeoptimizationInputData* deopt_input_data =
+ DeoptimizationInputData::cast(code->deoptimization_data());
+ int const mask = RelocInfo::ModeMask(RelocInfo::DEOPT_ID);
+ for (RelocIterator rit(code, mask); !rit.done(); rit.next()) {
+ RelocInfo* reloc_info = rit.rinfo();
+ DCHECK(RelocInfo::IsDeoptId(reloc_info->rmode()));
+ int deopt_id = static_cast<int>(reloc_info->data());
+ int translation_index =
+ deopt_input_data->TranslationIndex(deopt_id)->value();
+ TranslationIterator it(deopt_input_data->TranslationByteArray(),
+ translation_index);
+ Translation::Opcode opcode = static_cast<Translation::Opcode>(it.Next());
+ DCHECK_EQ(Translation::BEGIN, opcode);
+ it.Skip(Translation::NumberOfOperandsFor(opcode));
+ std::vector<CodeEntry::DeoptInlinedFrame> inlined_frames;
+ while (it.HasNext() &&
+ Translation::BEGIN !=
+ (opcode = static_cast<Translation::Opcode>(it.Next()))) {
+ if (opcode != Translation::JS_FRAME &&
+ opcode != Translation::INTERPRETED_FRAME) {
+ it.Skip(Translation::NumberOfOperandsFor(opcode));
+ continue;
+ }
+ BailoutId ast_id = BailoutId(it.Next());
+ int shared_info_id = it.Next();
+ it.Next(); // Skip height
+ SharedFunctionInfo* shared = SharedFunctionInfo::cast(
+ deopt_input_data->LiteralArray()->get(shared_info_id));
+ int source_position = Deoptimizer::ComputeSourcePosition(shared, ast_id);
+ int script_id = v8::UnboundScript::kNoScriptId;
+ if (shared->script()->IsScript()) {
+ Script* script = Script::cast(shared->script());
+ script_id = script->id();
+ }
+ CodeEntry::DeoptInlinedFrame frame = {source_position, script_id};
+ inlined_frames.push_back(frame);
+ }
+ if (!inlined_frames.empty() && !entry->HasDeoptInlinedFramesFor(deopt_id)) {
+ entry->AddDeoptInlinedFrames(deopt_id, inlined_frames);
+ DCHECK(inlined_frames.empty());
+ }
+ }
+}
+
CpuProfiler::CpuProfiler(Isolate* isolate)
: isolate_(isolate),
sampling_interval_(base::TimeDelta::FromMicroseconds(
« no previous file with comments | « src/profiler/cpu-profiler.h ('k') | src/profiler/cpu-profiler-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698