Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatd committed May 10, 2016
1 parent a596859 commit cb0ae86
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 54 deletions.
7 changes: 2 additions & 5 deletions lib/Backend/Lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12174,14 +12174,11 @@ Lowerer::GenerateBailOut(IR::Instr * instr, IR::BranchInstr * branchInstr, IR::L
}

// Add helper label to trigger layout.
if (collectRuntimeStatsLabel)
{
collectRuntimeStatsLabel->Unlink();
}
else
if (!collectRuntimeStatsLabel)
{
collectRuntimeStatsLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, true);
}
Assert(!collectRuntimeStatsLabel->IsLinked());
instr->InsertBefore(collectRuntimeStatsLabel);

if (bailOutInstr != instr)
Expand Down
15 changes: 4 additions & 11 deletions lib/Backend/LowerMDShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8849,17 +8849,7 @@ void LowererMD::GenerateFastInlineBuiltInCall(IR::Instr* instr, IR::JnHelperMeth
if (instr->GetDst()->IsInt32())
{
sharedBailout = (instr->GetBailOutInfo()->bailOutInstr != instr) ? true : false;
if (sharedBailout)
{
// In case of a shared bailout, we should jump to the code that sets some data on the
// bailout record which is specific to this bailout.
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);
instr->GetBailOutInfo()->bailOutInstr->AsLabelInstr()->InsertBefore(bailoutLabel);
}
else
{
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);
}
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);
}

IR::Opnd * zero;
Expand Down Expand Up @@ -9074,6 +9064,9 @@ void LowererMD::GenerateFastInlineBuiltInCall(IR::Instr* instr, IR::JnHelperMeth
{
instr->InsertBefore(bailoutLabel);
}

// In case of a shared bailout, we should jump to the code that sets some data on the bailout record which is specific
// to this bailout. Pass the bailoutLabel to GenerateFunction so that it may use the label as the collectRuntimeStatsLabel.
this->m_lowerer->GenerateBailOut(instr, nullptr, nullptr, sharedBailout ? bailoutLabel : nullptr);
}
else
Expand Down
52 changes: 14 additions & 38 deletions lib/Backend/arm/LowerMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8399,20 +8399,9 @@ LowererMD::GenerateFastInlineBuiltInMathFloor(IR::Instr* instr)
IR::RegOpnd* floatOpnd = IR::RegOpnd::New(TyFloat64, this->m_func);
this->m_lowerer->InsertMove(floatOpnd, src, instr);

IR::LabelInstr * bailoutLabel;
IR::LabelInstr * bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);;
bool sharedBailout = (instr->GetBailOutInfo()->bailOutInstr != instr) ? true : false;
if(sharedBailout)
{
// In case of a shared bailout, we should jump to the code that sets some data on the
// bailout record which is specific to this bailout.
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);
instr->GetBailOutInfo()->bailOutInstr->AsLabelInstr()->InsertBefore(bailoutLabel);
}
else
{
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, true);
}


// NaN check
IR::Instr *instrCmp = IR::Instr::New(Js::OpCode::VCMPF64, this->m_func);
instrCmp->SetSrc1(floatOpnd);
Expand Down Expand Up @@ -8484,6 +8473,9 @@ LowererMD::GenerateFastInlineBuiltInMathFloor(IR::Instr* instr)
{
instr->InsertBefore(bailoutLabel);
}

// In case of a shared bailout, we should jump to the code that sets some data on the bailout record which is specific
// to this bailout. Pass the bailoutLabel to GenerateFunction so that it may use the label as the collectRuntimeStatsLabel.
this->m_lowerer->GenerateBailOut(instr, nullptr, nullptr, sharedBailout ? bailoutLabel : nullptr);

// MOV dst, intOpnd
Expand All @@ -8505,19 +8497,8 @@ LowererMD::GenerateFastInlineBuiltInMathCeil(IR::Instr* instr)
IR::RegOpnd* floatOpnd = IR::RegOpnd::New(TyFloat64, this->m_func);
this->m_lowerer->InsertMove(floatOpnd, src, instr);

IR::LabelInstr * bailoutLabel;
IR::LabelInstr * bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);;
bool sharedBailout = (instr->GetBailOutInfo()->bailOutInstr != instr) ? true : false;
if(sharedBailout)
{
// In case of a shared bailout, we should jump to the code that sets some data on the
// bailout record which is specific to this bailout.
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);
instr->GetBailOutInfo()->bailOutInstr->AsLabelInstr()->InsertBefore(bailoutLabel);
}
else
{
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, true);
}

// NaN check
IR::Instr *instrCmp = IR::Instr::New(Js::OpCode::VCMPF64, this->m_func);
Expand Down Expand Up @@ -8595,6 +8576,9 @@ LowererMD::GenerateFastInlineBuiltInMathCeil(IR::Instr* instr)
{
instr->InsertBefore(bailoutLabel);
}

// In case of a shared bailout, we should jump to the code that sets some data on the bailout record which is specific
// to this bailout. Pass the bailoutLabel to GenerateFunction so that it may use the label as the collectRuntimeStatsLabel.
this->m_lowerer->GenerateBailOut(instr, nullptr, nullptr, sharedBailout ? bailoutLabel : nullptr);

// MOV dst, intOpnd
Expand All @@ -8616,20 +8600,9 @@ LowererMD::GenerateFastInlineBuiltInMathRound(IR::Instr* instr)
IR::RegOpnd* floatOpnd = IR::RegOpnd::New(TyFloat64, this->m_func);
this->m_lowerer->InsertMove(floatOpnd, src, instr);

IR::LabelInstr * bailoutLabel;
IR::LabelInstr * bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);;
bool sharedBailout = (instr->GetBailOutInfo()->bailOutInstr != instr) ? true : false;
if(sharedBailout)
{
// In case of a shared bailout, we should jump to the code that sets some data on the
// bailout record which is specific to this bailout.
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, /*helperLabel*/true);
instr->GetBailOutInfo()->bailOutInstr->AsLabelInstr()->InsertBefore(bailoutLabel);
}
else
{
bailoutLabel = IR::LabelInstr::New(Js::OpCode::Label, this->m_func, true);
}


// NaN check
IR::Instr *instrCmp = IR::Instr::New(Js::OpCode::VCMPF64, this->m_func);
instrCmp->SetSrc1(floatOpnd);
Expand Down Expand Up @@ -8710,6 +8683,9 @@ LowererMD::GenerateFastInlineBuiltInMathRound(IR::Instr* instr)
{
instr->InsertBefore(bailoutLabel);
}

// In case of a shared bailout, we should jump to the code that sets some data on the bailout record which is specific
// to this bailout. Pass the bailoutLabel to GenerateFunction so that it may use the label as the collectRuntimeStatsLabel.
this->m_lowerer->GenerateBailOut(instr, nullptr, nullptr, sharedBailout ? bailoutLabel : nullptr);

// MOV dst, intOpnd
Expand Down

0 comments on commit cb0ae86

Please sign in to comment.