Reviewers: yurys, alph,

Message:
PTAL

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

this is a forth 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

Please review this at https://codereview.chromium.org/1013753007/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+7, -2 lines):
  M src/cpu-profiler.h
  M src/cpu-profiler.cc
  M src/cpu-profiler-inl.h
  M src/profile-generator.h


Index: src/cpu-profiler-inl.h
diff --git a/src/cpu-profiler-inl.h b/src/cpu-profiler-inl.h
index 12f57c22d29b37976b490b18c16b20b21a869eed..075f2854897dc8bffb2a53a9070ff5a1abfaee87 100644
--- a/src/cpu-profiler-inl.h
+++ b/src/cpu-profiler-inl.h
@@ -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: src/cpu-profiler.cc
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc
index 5f7e86510ab99bd344328ca7563ca81a83ddf6f7..e047a750f7c96c32a45a6550d9a5bc50443d49bf 100644
--- a/src/cpu-profiler.cc
+++ b/src/cpu-profiler.cc
@@ -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 = static_cast<int>(pc - code->instruction_start());
   processor_->Enqueue(evt_rec);
   processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta);
 }
Index: src/cpu-profiler.h
diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h
index 94cc25126dca8e48ff7ef5726d6456a0d1306f9c..d1fe027ea157c904fdfc57dc7d67b3f022a70159 100644
--- a/src/cpu-profiler.h
+++ b/src/cpu-profiler.h
@@ -80,6 +80,7 @@ class CodeDeoptEventRecord : public CodeEventRecord {
   Address start;
   const char* deopt_reason;
   SourcePosition position;
+  int pc_offset;

   INLINE(void UpdateCodeMap(CodeMap* code_map));
 };
Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index 7ea168bcdafbb3f1994dfc16e9d4eaf8f11698c7..c3e0adc1010d9ca5642c5470e713b7479d6fd8dd 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -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,
+                      int 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_;
+  int pc_offset_;
   JITLineInfoTable* line_info_;
   Address instruction_start_;



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to