CpuProfiler: extract DeoptInfo fill in code into a static function.
the third part of the patch https://codereview.chromium.org/1012633002 this patch 1) moves DeoptInfo builder code to platform independent file lithium-codegen.cc 2) adds inlining_id property to HEnterInlined so we can use it on lithium level. BUG=chromium:452067 LOG=n Review URL: https://codereview.chromium.org/1011733005 Cr-Commit-Position: refs/heads/master@{#27231}
This commit is contained in:
parent
773f297738
commit
55d05404b7
@ -878,8 +878,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
__ stop("trap_on_deopt", condition);
|
__ stop("trap_on_deopt", condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
// Go through jump table if we need to handle condition, build frame, or
|
// Go through jump table if we need to handle condition, build frame, or
|
||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
|
@ -1053,8 +1053,8 @@ void LCodeGen::DeoptimizeBranch(
|
|||||||
__ Bind(&dont_trap);
|
__ Bind(&dont_trap);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
// Go through jump table if we need to build frame, or restore caller doubles.
|
// Go through jump table if we need to build frame, or restore caller doubles.
|
||||||
if (branch_type == always &&
|
if (branch_type == always &&
|
||||||
|
@ -184,11 +184,12 @@ class Deoptimizer : public Malloced {
|
|||||||
|
|
||||||
struct DeoptInfo {
|
struct DeoptInfo {
|
||||||
DeoptInfo(SourcePosition position, const char* m, DeoptReason d)
|
DeoptInfo(SourcePosition position, const char* m, DeoptReason d)
|
||||||
: position(position), mnemonic(m), deopt_reason(d) {}
|
: position(position), mnemonic(m), deopt_reason(d), inlining_id(0) {}
|
||||||
|
|
||||||
SourcePosition position;
|
SourcePosition position;
|
||||||
const char* mnemonic;
|
const char* mnemonic;
|
||||||
DeoptReason deopt_reason;
|
DeoptReason deopt_reason;
|
||||||
|
int inlining_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
static DeoptInfo GetDeoptInfo(Code* code, byte* from);
|
static DeoptInfo GetDeoptInfo(Code* code, byte* from);
|
||||||
|
@ -1961,6 +1961,8 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
|
|||||||
FunctionLiteral* function() const { return function_; }
|
FunctionLiteral* function() const { return function_; }
|
||||||
InliningKind inlining_kind() const { return inlining_kind_; }
|
InliningKind inlining_kind() const { return inlining_kind_; }
|
||||||
BailoutId ReturnId() const { return return_id_; }
|
BailoutId ReturnId() const { return return_id_; }
|
||||||
|
int inlining_id() const { return inlining_id_; }
|
||||||
|
void set_inlining_id(int inlining_id) { inlining_id_ = inlining_id; }
|
||||||
|
|
||||||
Representation RequiredInputRepresentation(int index) OVERRIDE {
|
Representation RequiredInputRepresentation(int index) OVERRIDE {
|
||||||
return Representation::None();
|
return Representation::None();
|
||||||
@ -1984,6 +1986,7 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
|
|||||||
arguments_pushed_(false),
|
arguments_pushed_(false),
|
||||||
function_(function),
|
function_(function),
|
||||||
inlining_kind_(inlining_kind),
|
inlining_kind_(inlining_kind),
|
||||||
|
inlining_id_(0),
|
||||||
arguments_var_(arguments_var),
|
arguments_var_(arguments_var),
|
||||||
arguments_object_(arguments_object),
|
arguments_object_(arguments_object),
|
||||||
return_targets_(2, zone) {}
|
return_targets_(2, zone) {}
|
||||||
@ -1995,6 +1998,7 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
|
|||||||
bool arguments_pushed_;
|
bool arguments_pushed_;
|
||||||
FunctionLiteral* function_;
|
FunctionLiteral* function_;
|
||||||
InliningKind inlining_kind_;
|
InliningKind inlining_kind_;
|
||||||
|
int inlining_id_;
|
||||||
Variable* arguments_var_;
|
Variable* arguments_var_;
|
||||||
HArgumentsObject* arguments_object_;
|
HArgumentsObject* arguments_object_;
|
||||||
ZoneList<HBasicBlock*> return_targets_;
|
ZoneList<HBasicBlock*> return_targets_;
|
||||||
|
@ -7979,6 +7979,9 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
|||||||
Add<HEnterInlined>(return_id, target, context, arguments_count, function,
|
Add<HEnterInlined>(return_id, target, context, arguments_count, function,
|
||||||
function_state()->inlining_kind(),
|
function_state()->inlining_kind(),
|
||||||
function->scope()->arguments(), arguments_object);
|
function->scope()->arguments(), arguments_object);
|
||||||
|
if (top_info()->is_tracking_positions()) {
|
||||||
|
enter_inlined->set_inlining_id(inlining_id);
|
||||||
|
}
|
||||||
function_state()->set_entry(enter_inlined);
|
function_state()->set_entry(enter_inlined);
|
||||||
|
|
||||||
VisitDeclarations(target_info.scope()->declarations());
|
VisitDeclarations(target_info.scope()->declarations());
|
||||||
|
@ -862,8 +862,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
if (cc == no_condition && frame_is_built_) {
|
if (cc == no_condition && frame_is_built_) {
|
||||||
DeoptComment(deopt_info);
|
DeoptComment(deopt_info);
|
||||||
|
@ -189,4 +189,13 @@ void LCodeGenBase::AddStabilityDependency(Handle<Map> map) {
|
|||||||
chunk_->AddStabilityDependency(map);
|
chunk_->AddStabilityDependency(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Deoptimizer::DeoptInfo LCodeGenBase::MakeDeoptInfo(
|
||||||
|
LInstruction* instr, Deoptimizer::DeoptReason deopt_reason) {
|
||||||
|
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
||||||
|
instr->Mnemonic(), deopt_reason);
|
||||||
|
HEnterInlined* enter_inlined = instr->environment()->entry();
|
||||||
|
deopt_info.inlining_id = enter_inlined ? enter_inlined->inlining_id() : 0;
|
||||||
|
return deopt_info;
|
||||||
|
}
|
||||||
} } // namespace v8::internal
|
} } // namespace v8::internal
|
||||||
|
@ -36,6 +36,8 @@ class LCodeGenBase BASE_EMBEDDED {
|
|||||||
|
|
||||||
void FPRINTF_CHECKING Comment(const char* format, ...);
|
void FPRINTF_CHECKING Comment(const char* format, ...);
|
||||||
void DeoptComment(const Deoptimizer::DeoptInfo& deopt_info);
|
void DeoptComment(const Deoptimizer::DeoptInfo& deopt_info);
|
||||||
|
static Deoptimizer::DeoptInfo MakeDeoptInfo(
|
||||||
|
LInstruction* instr, Deoptimizer::DeoptReason deopt_reason);
|
||||||
|
|
||||||
bool GenerateBody();
|
bool GenerateBody();
|
||||||
virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
|
virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
|
||||||
|
@ -844,8 +844,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
__ bind(&skip);
|
__ bind(&skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
// Go through jump table if we need to handle condition, build frame, or
|
// Go through jump table if we need to handle condition, build frame, or
|
||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
|
@ -811,8 +811,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
__ bind(&skip);
|
__ bind(&skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
// Go through jump table if we need to handle condition, build frame, or
|
// Go through jump table if we need to handle condition, build frame, or
|
||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
|
@ -801,8 +801,8 @@ void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr,
|
|||||||
__ stop("trap_on_deopt", cond, kDefaultStopCode, cr);
|
__ stop("trap_on_deopt", cond, kDefaultStopCode, cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
// Go through jump table if we need to handle condition, build frame, or
|
// Go through jump table if we need to handle condition, build frame, or
|
||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
|
@ -769,8 +769,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
// Go through jump table if we need to handle condition, build frame, or
|
// Go through jump table if we need to handle condition, build frame, or
|
||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
|
@ -1144,8 +1144,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
__ bind(&done);
|
__ bind(&done);
|
||||||
}
|
}
|
||||||
|
|
||||||
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
|
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
|
||||||
instr->Mnemonic(), deopt_reason);
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
if (cc == no_condition && frame_is_built_) {
|
if (cc == no_condition && frame_is_built_) {
|
||||||
DeoptComment(deopt_info);
|
DeoptComment(deopt_info);
|
||||||
|
Loading…
Reference in New Issue
Block a user