Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
meg-gupta committed Oct 10, 2017
1 parent 10f22e9 commit c17aa6b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3675,11 +3675,15 @@ GlobOpt::CopyProp(IR::Opnd *opnd, IR::Instr *instr, Value *val, IR::IndirOpnd *p
ValueInfo *valueInfo = val->GetValueInfo();


if (instr->m_opcode == Js::OpCode::ArgOut_A_Inline && valueInfo->GetSymStore() &&
valueInfo->GetSymStore()->m_id == 0)
if (this->func->HasFinally())
{
// We don't want to copy-prop s0 (return symbol) into inlinee code
return opnd;
// s0 = undefined was added on functions with early exit in try-finally functions, that can get copy-proped and case incorrect results
if (instr->m_opcode == Js::OpCode::ArgOut_A_Inline && valueInfo->GetSymStore() &&
valueInfo->GetSymStore()->m_id == 0)
{
// We don't want to copy-prop s0 (return symbol) into inlinee code
return opnd;
}
}

// Constant prop?
Expand Down
1 change: 1 addition & 0 deletions lib/Backend/Lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19999,6 +19999,7 @@ Lowerer::EHBailoutPatchUp()
{
// We dont set this bit for inlined code, if there was a bailout in the inlined code,
// and an exception was thrown, we want the caller's handler to handle the exception accordingly.
// TODO : Revisit when we start inlining functions with try-catch/try-finally
this->SetHasBailedOut(instr);
}
tmpInstr = this->EmitEHBailoutStackRestore(instr);
Expand Down
2 changes: 1 addition & 1 deletion lib/Runtime/Language/JavascriptExceptionOperators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ namespace Js
#if ENABLE_NATIVE_CODEGEN
void JavascriptExceptionOperators::WalkStackForCleaningUpInlineeInfo(ScriptContext *scriptContext, PVOID returnAddress)
{
JavascriptStackWalker walker(scriptContext, true, returnAddress);
JavascriptStackWalker walker(scriptContext, /*useEERContext*/ true, returnAddress);

// We have to walk the inlinee frames and clear callinfo count on them on an exception
// At this point inlinedFrameWalker is closed, so we should build it again by calling InlinedFrameWalker::FromPhysicalFrame
Expand Down
1 change: 1 addition & 0 deletions lib/Runtime/Language/JavascriptStackWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ namespace Js
{
// Walk the stack and when we find the first JavascriptFrame, we clear the inlinee's callinfo for this frame
// It is sufficient we stop at the first Javascript frame which had the enclosing try-catch
// TODO : Revisit when we start inlining functions with try-catch/try-finally
while (this->Walk(true))
{
if (this->IsJavascriptFrame())
Expand Down

0 comments on commit c17aa6b

Please sign in to comment.