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}
#ifndef V8_V8_PROFILER_H_
#define V8_V8_PROFILER_H_
-#include <vector>
#include "v8.h"
/**
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.
*/
/** 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;
};
}
-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();
}
-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.
}
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;
}
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,
};
+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.
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(); }
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);
unsigned id_;
HashMap line_ticks_;
- std::vector<CpuProfileDeoptInfo> deopt_infos_;
+ std::vector<DeoptInfo> deopt_infos_;
DISALLOW_COPY_AND_ASSIGN(ProfileNode);
};
}
-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);
}
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);
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);