Commit 74dc9e17 authored by machenbach's avatar machenbach Committed by Commit bot

Revert of CpuProfiler: public API for deopt info in cpu profiler. (patchset #6...

Revert of CpuProfiler: public API for deopt info in cpu profiler. (patchset #6 id:150001 of https://codereview.chromium.org/1045753002/)

Reason for revert:
[Sheriff] Breaks compile here:
http://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20nosnap%20-%20shared/builds/6115

Original issue's description:
> CpuProfiler: public API for deopt info in cpu profiler.
>
> BUG=chromium:452067
> LOG=n
>
> Committed: https://crrev.com/baf927ff5115ec62a6dad684b9232ed9d3960e3a
> Cr-Commit-Position: refs/heads/master@{#27626}

TBR=alph@chromium.org,jkummerow@chromium.org,svenpanne@chromium.org,yurys@chromium.org,loislo@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:452067

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

Cr-Commit-Position: refs/heads/master@{#27628}
parent 46f761e1
......@@ -5,7 +5,6 @@
#ifndef V8_V8_PROFILER_H_
#define V8_V8_PROFILER_H_
#include <vector>
#include "v8.h"
/**
......@@ -18,18 +17,6 @@ struct HeapStatsUpdate;
typedef uint32_t SnapshotObjectId;
struct V8_EXPORT CpuProfileDeoptInfo {
struct Frame {
int script_id;
size_t position;
};
/** A pointer to a static string owned by v8. */
const char* deopt_reason;
std::vector<Frame> stack;
};
/**
* CpuProfileNode represents a node in a call graph.
*/
......@@ -98,9 +85,6 @@ class V8_EXPORT CpuProfileNode {
/** Retrieves a child node by index. */
const CpuProfileNode* GetChild(int index) const;
/** Retrieves deopt infos for the node. */
const std::vector<CpuProfileDeoptInfo>& GetDeoptInfos() const;
static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
};
......
......@@ -7535,12 +7535,6 @@ const CpuProfileNode* CpuProfileNode::GetChild(int index) const {
}
const std::vector<CpuProfileDeoptInfo>& CpuProfileNode::GetDeoptInfos() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
return node->deopt_infos();
}
void CpuProfile::Delete() {
i::Isolate* isolate = i::Isolate::Current();
i::CpuProfiler* profiler = isolate->cpu_profiler();
......
......@@ -112,14 +112,15 @@ void CodeEntry::FillFunctionInfo(SharedFunctionInfo* shared) {
}
CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() {
DeoptInfo CodeEntry::GetDeoptInfo() {
DCHECK(has_deopt_info());
CpuProfileDeoptInfo info;
DeoptInfo info;
info.deopt_reason = deopt_reason_;
if (inlined_function_infos_.empty()) {
info.stack.push_back(CpuProfileDeoptInfo::Frame(
{script_id_, position_ + deopt_position_.position()}));
info.stack.push_back(DeoptInfo::Frame(
{script_id_,
static_cast<int>(position_ + deopt_position_.position())}));
return info;
}
// Copy the only branch from the inlining tree where the deopt happened.
......@@ -135,9 +136,9 @@ CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() {
}
while (inlining_id != InlinedFunctionInfo::kNoParentId) {
InlinedFunctionInfo& inlined_info = inlined_function_infos_.at(inlining_id);
info.stack.push_back(CpuProfileDeoptInfo::Frame(
info.stack.push_back(DeoptInfo::Frame(
{inlined_info.script_id,
inlined_info.start_position + position.raw()}));
static_cast<int>(inlined_info.start_position + position.raw())}));
position = inlined_info.inline_position;
inlining_id = inlined_info.parent_id;
}
......@@ -215,7 +216,7 @@ void ProfileNode::Print(int indent) {
base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number());
base::OS::Print("\n");
for (size_t i = 0; i < deopt_infos_.size(); ++i) {
CpuProfileDeoptInfo& info = deopt_infos_[i];
DeoptInfo& info = deopt_infos_[i];
base::OS::Print(
"%*s;;; deopted at script_id: %d position: %d with reason '%s'.\n",
indent + 10, "", info.stack[0].script_id, info.stack[0].position,
......
......@@ -37,6 +37,16 @@ class JITLineInfoTable : public Malloced {
};
struct DeoptInfo {
const char* deopt_reason;
struct Frame {
int script_id;
int position;
};
std::vector<Frame> stack;
};
class CodeEntry {
public:
// CodeEntry doesn't own name strings, just references them.
......@@ -73,7 +83,7 @@ class CodeEntry {
deopt_position_ = position;
pc_offset_ = pc_offset;
}
CpuProfileDeoptInfo GetDeoptInfo();
DeoptInfo GetDeoptInfo();
const char* deopt_reason() const { return deopt_reason_; }
SourcePosition deopt_position() const { return deopt_position_; }
bool has_deopt_info() const { return !deopt_position_.IsUnknown(); }
......@@ -163,9 +173,7 @@ class ProfileNode {
bool GetLineTicks(v8::CpuProfileNode::LineTick* entries,
unsigned int length) const;
void CollectDeoptInfo(CodeEntry* entry);
const std::vector<CpuProfileDeoptInfo>& deopt_infos() const {
return deopt_infos_;
}
const std::vector<DeoptInfo>& deopt_infos() const { return deopt_infos_; }
void Print(int indent);
......@@ -188,7 +196,7 @@ class ProfileNode {
unsigned id_;
HashMap line_ticks_;
std::vector<CpuProfileDeoptInfo> deopt_infos_;
std::vector<DeoptInfo> deopt_infos_;
DISALLOW_COPY_AND_ASSIGN(ProfileNode);
};
......
......@@ -56,10 +56,8 @@ static v8::Local<v8::Function> GetFunction(v8::Context* env, const char* name) {
}
static size_t offset(const char* src, const char* substring) {
const char* it = strstr(src, substring);
CHECK(it);
return static_cast<size_t>(it - src);
static int offset(const char* src, const char* substring) {
return static_cast<int>(strstr(src, substring) - src);
}
......@@ -1900,11 +1898,10 @@ TEST(DeoptAtFirstLevelInlinedSource) {
const char* branch[] = {"", "test"};
const ProfileNode* itest_node =
GetSimpleBranch(profile, branch, arraysize(branch));
const std::vector<v8::CpuProfileDeoptInfo>& deopt_infos =
itest_node->deopt_infos();
const std::vector<i::DeoptInfo>& deopt_infos = itest_node->deopt_infos();
CHECK_EQ(1, deopt_infos.size());
const v8::CpuProfileDeoptInfo& info = deopt_infos[0];
const i::DeoptInfo& info = deopt_infos[0];
CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason);
CHECK_EQ(2, info.stack.size());
CHECK_EQ(inlined_script_id, info.stack[0].script_id);
......@@ -1973,11 +1970,10 @@ TEST(DeoptAtSecondLevelInlinedSource) {
const char* branch[] = {"", "test1"};
const ProfileNode* itest_node =
GetSimpleBranch(profile, branch, arraysize(branch));
const std::vector<v8::CpuProfileDeoptInfo>& deopt_infos =
itest_node->deopt_infos();
const std::vector<i::DeoptInfo>& deopt_infos = itest_node->deopt_infos();
CHECK_EQ(1, deopt_infos.size());
const v8::CpuProfileDeoptInfo info = deopt_infos[0];
const i::DeoptInfo info = deopt_infos[0];
CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), info.deopt_reason);
CHECK_EQ(3, info.stack.size());
CHECK_EQ(inlined_script_id, info.stack[0].script_id);
......
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