Skip to content

Commit

Permalink
[1.6>1.7] [MERGE #3417 @MikeHolman] abort inlining dom fastpath if it…
Browse files Browse the repository at this point in the history
… didn't get registered

Merge pull request #3417 from MikeHolman:domgetterfail

OS: 12599786
  • Loading branch information
MikeHolman committed Jul 24, 2017
2 parents 2266f2e + aef20c9 commit b5ebc92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 6 additions & 4 deletions lib/Backend/Inline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ Inline::InlineFunctionCommon(IR::Instr *callInstr, bool originalCallTargetOpndIs
// A functionInfo->Index# table is created in scriptContext (and potentially movable to threadContext if WS is not a concern).
// we use the table to identify the helper that needs to be lowered.
// At lower time we create the call to helper, which is function entrypoint at this time.
IR::Instr * Inline::InlineDOMGetterSetterFunction(IR::Instr *ldFldInstr, const FunctionJITTimeInfo *const inlineeData, const FunctionJITTimeInfo *const inlinerData)
void Inline::InlineDOMGetterSetterFunction(IR::Instr *ldFldInstr, const FunctionJITTimeInfo *const inlineeData, const FunctionJITTimeInfo *const inlinerData)
{
intptr_t functionInfo = inlineeData->GetFunctionInfoAddr();

Expand All @@ -3719,7 +3719,11 @@ IR::Instr * Inline::InlineDOMGetterSetterFunction(IR::Instr *ldFldInstr, const F

// Find the helper routine for this functionInfo.
IR::JnHelperMethod helperMethod = this->topFunc->GetScriptContextInfo()->GetDOMFastPathHelper(functionInfo);

if (helperMethod == IR::HelperInvalid)
{
// abort inlining if helper isn't found
return;
}
// Find the instance object (External object).
PropertySym * fieldSym = ldFldInstr->GetSrc1()->AsSymOpnd()->m_sym->AsPropertySym();
IR::RegOpnd * instanceOpnd = IR::RegOpnd::New(fieldSym->m_stackSym, TyMachPtr, ldFldInstr->m_func);
Expand Down Expand Up @@ -3761,8 +3765,6 @@ IR::Instr * Inline::InlineDOMGetterSetterFunction(IR::Instr *ldFldInstr, const F
this->topFunc->SetHasInlinee();

InsertStatementBoundary(ldInstr->m_next);

return ldInstr->m_next;
}
#endif
void
Expand Down
2 changes: 1 addition & 1 deletion lib/Backend/Inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Inline
intptr_t TryOptimizeInstrWithFixedDataProperty(IR::Instr *&instr);
IR::Instr * InlineScriptFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *const inlineeData, const StackSym *symThis, const Js::ProfileId profileId, bool* pIsInlined, uint recursiveInlineDepth);
#ifdef ENABLE_DOM_FAST_PATH
IR::Instr * InlineDOMGetterSetterFunction(IR::Instr *ldFldInstr, const FunctionJITTimeInfo *const inlineeData, const FunctionJITTimeInfo *const inlinerData);
void InlineDOMGetterSetterFunction(IR::Instr *ldFldInstr, const FunctionJITTimeInfo *const inlineeData, const FunctionJITTimeInfo *const inlinerData);
#endif
IR::Instr * InlineGetterSetterFunction(IR::Instr *accessorInstr, const FunctionJITTimeInfo *const inlineeData, const StackSym *symCallerThis, const uint inlineCacheIndex, bool isGetter, bool *pIsInlined, uint recursiveInlineDepth);
IR::Instr * InlineFunctionCommon(IR::Instr *callInstr, bool originalCallTargetOpndIsJITOpt, StackSym* originalCallTargetStackSym, const FunctionJITTimeInfo *funcInfo, Func *inlinee, IR::Instr *instrNext,
Expand Down
5 changes: 2 additions & 3 deletions lib/Backend/ServerScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,12 @@ ServerScriptContext::GetEmitBufferManager(bool asmJsManager)
IR::JnHelperMethod
ServerScriptContext::GetDOMFastPathHelper(intptr_t funcInfoAddr)
{
IR::JnHelperMethod helper;
IR::JnHelperMethod helper = IR::HelperInvalid;

m_domFastPathHelperMap->LockResize();
bool found = m_domFastPathHelperMap->TryGetValue(funcInfoAddr, &helper);
m_domFastPathHelperMap->TryGetValue(funcInfoAddr, &helper);
m_domFastPathHelperMap->UnlockResize();

Assert(found);
return helper;
}

Expand Down
5 changes: 2 additions & 3 deletions lib/Runtime/Base/ScriptContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4969,13 +4969,12 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie

IR::JnHelperMethod ScriptContext::GetDOMFastPathHelper(intptr_t funcInfoAddr)
{
IR::JnHelperMethod helper;
IR::JnHelperMethod helper = IR::HelperInvalid;

m_domFastPathHelperMap->LockResize();
bool found = m_domFastPathHelperMap->TryGetValue(funcInfoAddr, &helper);
m_domFastPathHelperMap->TryGetValue(funcInfoAddr, &helper);
m_domFastPathHelperMap->UnlockResize();

Assert(found);
return helper;
}
#endif
Expand Down

0 comments on commit b5ebc92

Please sign in to comment.