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:
loislo 2015-03-17 02:37:26 -07:00 committed by Commit bot
parent 773f297738
commit 55d05404b7
13 changed files with 36 additions and 17 deletions

View File

@ -878,8 +878,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
__ stop("trap_on_deopt", condition);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to handle condition, build frame, or
// restore caller doubles.

View File

@ -1053,8 +1053,8 @@ void LCodeGen::DeoptimizeBranch(
__ Bind(&dont_trap);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to build frame, or restore caller doubles.
if (branch_type == always &&

View File

@ -184,11 +184,12 @@ class Deoptimizer : public Malloced {
struct DeoptInfo {
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;
const char* mnemonic;
DeoptReason deopt_reason;
int inlining_id;
};
static DeoptInfo GetDeoptInfo(Code* code, byte* from);

View File

@ -1961,6 +1961,8 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
FunctionLiteral* function() const { return function_; }
InliningKind inlining_kind() const { return inlining_kind_; }
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 {
return Representation::None();
@ -1984,6 +1986,7 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
arguments_pushed_(false),
function_(function),
inlining_kind_(inlining_kind),
inlining_id_(0),
arguments_var_(arguments_var),
arguments_object_(arguments_object),
return_targets_(2, zone) {}
@ -1995,6 +1998,7 @@ class HEnterInlined FINAL : public HTemplateInstruction<0> {
bool arguments_pushed_;
FunctionLiteral* function_;
InliningKind inlining_kind_;
int inlining_id_;
Variable* arguments_var_;
HArgumentsObject* arguments_object_;
ZoneList<HBasicBlock*> return_targets_;

View File

@ -7979,6 +7979,9 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
Add<HEnterInlined>(return_id, target, context, arguments_count, function,
function_state()->inlining_kind(),
function->scope()->arguments(), arguments_object);
if (top_info()->is_tracking_positions()) {
enter_inlined->set_inlining_id(inlining_id);
}
function_state()->set_entry(enter_inlined);
VisitDeclarations(target_info.scope()->declarations());

View File

@ -862,8 +862,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
__ bind(&done);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
if (cc == no_condition && frame_is_built_) {
DeoptComment(deopt_info);

View File

@ -189,4 +189,13 @@ void LCodeGenBase::AddStabilityDependency(Handle<Map> 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

View File

@ -36,6 +36,8 @@ class LCodeGenBase BASE_EMBEDDED {
void FPRINTF_CHECKING Comment(const char* format, ...);
void DeoptComment(const Deoptimizer::DeoptInfo& deopt_info);
static Deoptimizer::DeoptInfo MakeDeoptInfo(
LInstruction* instr, Deoptimizer::DeoptReason deopt_reason);
bool GenerateBody();
virtual void GenerateBodyInstructionPre(LInstruction* instr) {}

View File

@ -844,8 +844,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
__ bind(&skip);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to handle condition, build frame, or
// restore caller doubles.

View File

@ -811,8 +811,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
__ bind(&skip);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to handle condition, build frame, or
// restore caller doubles.

View File

@ -801,8 +801,8 @@ void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr,
__ stop("trap_on_deopt", cond, kDefaultStopCode, cr);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to handle condition, build frame, or
// restore caller doubles.

View File

@ -769,8 +769,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
__ bind(&done);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to handle condition, build frame, or
// restore caller doubles.

View File

@ -1144,8 +1144,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
__ bind(&done);
}
Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(),
instr->Mnemonic(), deopt_reason);
Deoptimizer::DeoptInfo deopt_info = MakeDeoptInfo(instr, deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
if (cc == no_condition && frame_is_built_) {
DeoptComment(deopt_info);