[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: Alexei Filippov <alph@chromium.org> Cr-Commit-Position: refs/heads/master@{#53244}
This commit is contained in:
parent
667e13e2b7
commit
29ea4d1ef5
@ -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_;
|
||||
|
Loading…
Reference in New Issue
Block a user