CpuProfiler: collect deopt pc offset for further usage in the inlined functions stack...
authorloislo <loislo@chromium.org>
Tue, 17 Mar 2015 18:50:02 +0000 (11:50 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 17 Mar 2015 18:50:10 +0000 (18:50 +0000)
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}

src/cpu-profiler-inl.h
src/cpu-profiler.cc
src/cpu-profiler.h
src/profile-generator.h

index 12f57c2..075f285 100644 (file)
@@ -35,7 +35,7 @@ void CodeDisableOptEventRecord::UpdateCodeMap(CodeMap* code_map) {
 
 void CodeDeoptEventRecord::UpdateCodeMap(CodeMap* code_map) {
   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);
 }
 
 
index 5f7e865..89c975d 100644 (file)
@@ -336,6 +336,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->pc_offset = pc - code->instruction_start();
   processor_->Enqueue(evt_rec);
   processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta);
 }
index 94cc251..26ec7f9 100644 (file)
@@ -80,6 +80,7 @@ class CodeDeoptEventRecord : public CodeEventRecord {
   Address start;
   const char* deopt_reason;
   SourcePosition position;
+  size_t pc_offset;
 
   INLINE(void UpdateCodeMap(CodeMap* code_map));
 };
index 7ea168b..4f44c4c 100644 (file)
@@ -65,10 +65,12 @@ class CodeEntry {
   }
   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());
     deopt_reason_ = deopt_reason;
     deopt_position_ = position;
+    pc_offset_ = pc_offset;
   }
   const char* deopt_reason() const { return deopt_reason_; }
   SourcePosition deopt_position() const { return deopt_position_; }
@@ -121,6 +123,7 @@ class CodeEntry {
   const char* bailout_reason_;
   const char* deopt_reason_;
   SourcePosition deopt_position_;
+  size_t pc_offset_;
   JITLineInfoTable* line_info_;
   Address instruction_start_;