From 0c15d3898abd40ae9eb87dcc33213c41ad8cb67a Mon Sep 17 00:00:00 2001 From: Rajat Dua Date: Fri, 11 May 2018 11:03:35 -0700 Subject: [PATCH] Field PRE for multi-level field loads involving LdSlot/LdSlotArr --- lib/Backend/GlobOpt.cpp | 7 ++++--- lib/Runtime/Library/JavascriptArray.inl | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Backend/GlobOpt.cpp b/lib/Backend/GlobOpt.cpp index 1389307b7b9..7271a1ca0ad 100644 --- a/lib/Backend/GlobOpt.cpp +++ b/lib/Backend/GlobOpt.cpp @@ -3112,7 +3112,7 @@ GlobOpt::SetLoopFieldInitialValue(Loop *loop, IR::Instr *instr, PropertySym *pro } IR::Instr * defInstr = objectSym->GetInstrDef(); IR::Opnd * src1 = defInstr->GetSrc1(); - while (!(src1 && src1->IsSymOpnd() && src1->AsSymOpnd()->IsPropertySymOpnd())) + while (!(src1 && src1->IsSymOpnd() && src1->AsSymOpnd()->m_sym->IsPropertySym())) { if (src1 && src1->IsRegOpnd() && src1->AsRegOpnd()->GetStackSym()->IsSingleDef()) { @@ -17131,8 +17131,9 @@ GlobOpt::PRE::InsertSymDefinitionInLandingPad(StackSym * sym, Loop * loop, Sym * } IR::Opnd * symDefInstrSrc1 = symDefInstr->GetSrc1(); - if (symDefInstrSrc1->IsSymOpnd() && symDefInstrSrc1->AsSymOpnd()->IsPropertySymOpnd()) + if (symDefInstrSrc1->IsSymOpnd()) { + Assert(symDefInstrSrc1->AsSymOpnd()->m_sym->IsPropertySym()); // $L1 // T1 = o.x (v1|T3) // T2 = T1.y (v2|T4) <-- T1 is not live in the loop landing pad @@ -17141,7 +17142,7 @@ GlobOpt::PRE::InsertSymDefinitionInLandingPad(StackSym * sym, Loop * loop, Sym * // Trying to make T1 live in the landing pad // o.x - PropertySym* propSym = symDefInstrSrc1->AsSymOpnd()->AsPropertySymOpnd()->GetPropertySym(); + PropertySym* propSym = symDefInstrSrc1->AsSymOpnd()->m_sym->AsPropertySym(); if (candidates->candidatesBv->Test(propSym->m_id)) { diff --git a/lib/Runtime/Library/JavascriptArray.inl b/lib/Runtime/Library/JavascriptArray.inl index 953182c792d..6aaacf7e9aa 100644 --- a/lib/Runtime/Library/JavascriptArray.inl +++ b/lib/Runtime/Library/JavascriptArray.inl @@ -974,12 +974,12 @@ SECOND_PASS: LinkSegments((Js::SparseArraySegment*)startPrev, current); current->length = startOffset + length + growby; current->CheckLengthvsSize(); - } - if (current == head && HasNoMissingValues()) - { - if (ScanForMissingValues(startOffset + length, current->length)) + if (current == head && HasNoMissingValues()) { - SetHasNoMissingValues(false); + if (ScanForMissingValues(startOffset + length, current->length)) + { + SetHasNoMissingValues(false); + } } } }