Commit 33514ec2 authored by loislo's avatar loislo Committed by Commit bot

CpuProfiler: collect deopt pc offset for further usage in the inlined functions stack resolver.

this is a fourth part of https://codereview.chromium.org/1012633002

In another patch I'll collect the inlining tree in cpu-profiler CodeEntry
Each leaf for an inlined function will have a list of deopts and their pc offsets.
So when deopt happens I'll be able to map the deopt pc_offset into
inlined function id and point the web developer to the exact place
where deopt has happened even if it was in the inlined function.

BUG=chromium:452067
LOG=n

Review URL: https://codereview.chromium.org/1013753007

Cr-Commit-Position: refs/heads/master@{#27247}
parent 434d1ad0
...@@ -35,7 +35,7 @@ void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) { ...@@ -35,7 +35,7 @@ void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) {
void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) { void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) {
CodeEntry* entry = code_map->FindEntry(start); CodeEntry* entry = code_map->FindEntry(start);
if (entry != NULL) entry->set_deopt_info(deopt_reason, position); if (entry != NULL) entry->set_deopt_info(deopt_reason, position, pc_offset);
} }
......
...@@ -336,6 +336,7 @@ void CpuProfiler::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) { ...@@ -336,6 +336,7 @@ void CpuProfiler::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) {
rec->start = code->address(); rec->start = code->address();
rec->deopt_reason = Deoptimizer::GetDeoptReason(info.deopt_reason); rec->deopt_reason = Deoptimizer::GetDeoptReason(info.deopt_reason);
rec->position = info.position; rec->position = info.position;
rec->pc_offset = pc - code->instruction_start();
processor_->Enqueue(evt_rec); processor_->Enqueue(evt_rec);
processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta); processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta);
} }
......
...@@ -80,6 +80,7 @@ class CodeDeoptEventRecord : public CodeEventRecord { ...@@ -80,6 +80,7 @@ class CodeDeoptEventRecord : public CodeEventRecord {
Address start; Address start;
const char* deopt_reason; const char* deopt_reason;
SourcePosition position; SourcePosition position;
size_t pc_offset;
INLINE(void UpdateCodeMap(CodeMap* code_map)); INLINE(void UpdateCodeMap(CodeMap* code_map));
}; };
......
...@@ -65,10 +65,12 @@ class CodeEntry { ...@@ -65,10 +65,12 @@ class CodeEntry {
} }
const char* bailout_reason() const { return bailout_reason_; } const char* bailout_reason() const { return bailout_reason_; }
void set_deopt_info(const char* deopt_reason, SourcePosition position) { void set_deopt_info(const char* deopt_reason, SourcePosition position,
size_t pc_offset) {
DCHECK(deopt_position_.IsUnknown()); DCHECK(deopt_position_.IsUnknown());
deopt_reason_ = deopt_reason; deopt_reason_ = deopt_reason;
deopt_position_ = position; deopt_position_ = position;
pc_offset_ = pc_offset;
} }
const char* deopt_reason() const { return deopt_reason_; } const char* deopt_reason() const { return deopt_reason_; }
SourcePosition deopt_position() const { return deopt_position_; } SourcePosition deopt_position() const { return deopt_position_; }
...@@ -121,6 +123,7 @@ class CodeEntry { ...@@ -121,6 +123,7 @@ class CodeEntry {
const char* bailout_reason_; const char* bailout_reason_;
const char* deopt_reason_; const char* deopt_reason_;
SourcePosition deopt_position_; SourcePosition deopt_position_;
size_t pc_offset_;
JITLineInfoTable* line_info_; JITLineInfoTable* line_info_;
Address instruction_start_; Address instruction_start_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment