Commit 29ea4d1e authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cpu-profiler] Move bailout reason into rare_info struct

This was set very regularly in FillFunctionInfo, but it was almost
always set to kNoReason, because the associated SFI had no bailout
reason. Given that having a bailout reason is the rare case, we
just assume an empty bailout reason, and use the rare_data_ struct
to store the string pointer if we do need it.

This saves another pointer of space on the CodeEntry object (approx
1.4 MiB on the node server example).

Bug: v8:7719
Change-Id: I8e2272b572285ddf353ba0b303e6da095b7d5272
Reviewed-on: https://chromium-review.googlesource.com/1064370
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarAlexei Filippov <alph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53244}
parent 667e13e2
......@@ -23,7 +23,6 @@ CodeEntry::CodeEntry(CodeEventListener::LogEventsAndTags tag, const char* name,
column_number_(column_number),
script_id_(v8::UnboundScript::kNoScriptId),
position_(0),
bailout_reason_(kEmptyBailoutReason),
line_info_(std::move(line_info)),
instruction_start_(instruction_start) {}
......
......@@ -145,7 +145,9 @@ void CodeEntry::FillFunctionInfo(SharedFunctionInfo* shared) {
Script* script = Script::cast(shared->script());
set_script_id(script->id());
set_position(shared->StartPosition());
set_bailout_reason(GetBailoutReason(shared->disable_optimization_reason()));
if (shared->optimization_disabled()) {
set_bailout_reason(GetBailoutReason(shared->disable_optimization_reason()));
}
}
CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() {
......
......@@ -56,9 +56,11 @@ class CodeEntry {
int position() const { return position_; }
void set_position(int position) { position_ = position; }
void set_bailout_reason(const char* bailout_reason) {
bailout_reason_ = bailout_reason;
EnsureRareData()->bailout_reason_ = bailout_reason;
}
const char* bailout_reason() const {
return rare_data_ ? rare_data_->bailout_reason_ : kEmptyBailoutReason;
}
const char* bailout_reason() const { return bailout_reason_; }
void set_deopt_info(const char* deopt_reason, int deopt_id) {
DCHECK(!has_deopt_info());
......@@ -127,6 +129,7 @@ class CodeEntry {
private:
struct RareData {
const char* deopt_reason_ = kNoDeoptReason;
const char* bailout_reason_ = kEmptyBailoutReason;
int deopt_id_ = kNoDeoptimizationId;
std::unordered_map<int, std::vector<std::unique_ptr<CodeEntry>>>
inline_locations_;
......@@ -169,7 +172,6 @@ class CodeEntry {
int column_number_;
int script_id_;
int position_;
const char* bailout_reason_;
std::unique_ptr<SourcePositionTable> line_info_;
Address instruction_start_;
std::unique_ptr<RareData> rare_data_;
......
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