@@ -1212,10 +1212,10 @@ IRBuilder::BuildIndirOpnd(IR::RegOpnd *baseReg, uint32 offset, const char16 *des
12121212#endif
12131213
12141214IR::SymOpnd *
1215- IRBuilder::BuildFieldOpnd (Js::OpCode newOpcode, Js::RegSlot reg, Js::PropertyId propertyId, Js::PropertyIdIndexType propertyIdIndex, PropertyKind propertyKind, uint inlineCacheIndex)
1215+ IRBuilder::BuildFieldOpnd (Js::OpCode newOpcode, Js::RegSlot reg, Js::PropertyId propertyId, Js::PropertyIdIndexType propertyIdIndex, PropertyKind propertyKind, uint inlineCacheIndex, bool stableSlotSym )
12161216{
12171217 AssertOrFailFast (inlineCacheIndex < m_func->GetJITFunctionBody ()->GetInlineCacheCount () || inlineCacheIndex == Js::Constants::NoInlineCacheIndex);
1218- PropertySym * propertySym = BuildFieldSym (reg, propertyId, propertyIdIndex, inlineCacheIndex, propertyKind);
1218+ PropertySym * propertySym = BuildFieldSym (reg, propertyId, propertyIdIndex, inlineCacheIndex, propertyKind, stableSlotSym );
12191219 IR::SymOpnd * symOpnd;
12201220
12211221 // If we plan to apply object type optimization to this instruction or if we intend to emit a fast path using an inline
@@ -1243,14 +1243,14 @@ IRBuilder::BuildFieldOpnd(Js::OpCode newOpcode, Js::RegSlot reg, Js::PropertyId
12431243}
12441244
12451245PropertySym *
1246- IRBuilder::BuildFieldSym (Js::RegSlot reg, Js::PropertyId propertyId, Js::PropertyIdIndexType propertyIdIndex, uint inlineCacheIndex, PropertyKind propertyKind)
1246+ IRBuilder::BuildFieldSym (Js::RegSlot reg, Js::PropertyId propertyId, Js::PropertyIdIndexType propertyIdIndex, uint inlineCacheIndex, PropertyKind propertyKind, bool stableSlotSym )
12471247{
12481248 PropertySym * propertySym;
12491249 SymID symId = this ->BuildSrcStackSymID (reg);
12501250
12511251 AssertMsg (m_func->m_symTable ->FindStackSym (symId), " Tried to use an undefined stacksym?" );
12521252
1253- propertySym = PropertySym::FindOrCreate (symId, propertyId, propertyIdIndex, inlineCacheIndex, propertyKind, m_func);
1253+ propertySym = PropertySym::FindOrCreate (symId, propertyId, propertyIdIndex, inlineCacheIndex, propertyKind, m_func, stableSlotSym );
12541254
12551255 return propertySym;
12561256}
@@ -3882,6 +3882,7 @@ IRBuilder::BuildElementSlotI2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
38823882 IR::Instr *instr;
38833883 PropertySym *fieldSym;
38843884 bool isLdSlotThatWasNotProfiled = false ;
3885+ bool stableSlots = false ;
38853886
38863887 switch (newOpcode)
38873888 {
@@ -3916,13 +3917,18 @@ IRBuilder::BuildElementSlotI2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot r
39163917 }
39173918
39183919 case Js::OpCode::LdEnvSlot:
3919- case Js::OpCode::LdEnvObjSlot:
39203920 case Js::OpCode::StEnvSlot:
39213921 case Js::OpCode::StEnvSlotChkUndecl:
3922+ stableSlots = true ;
3923+ goto SlotsCommon;
3924+
3925+ case Js::OpCode::LdEnvObjSlot:
39223926 case Js::OpCode::StEnvObjSlot:
39233927 case Js::OpCode::StEnvObjSlotChkUndecl:
3928+ stableSlots = false ;
39243929
3925- fieldOpnd = this ->BuildFieldOpnd (Js::OpCode::LdSlotArr, this ->GetEnvReg (), slotId1, (Js::PropertyIdIndexType)-1 , PropertyKindSlotArray);
3930+ SlotsCommon:
3931+ fieldOpnd = this ->BuildFieldOpnd (Js::OpCode::LdSlotArr, this ->GetEnvReg (), slotId1, (Js::PropertyIdIndexType)-1 , PropertyKindSlotArray, (uint)-1 , stableSlots);
39263932 regOpnd = IR::RegOpnd::New (TyVar, m_func);
39273933 instr = IR::Instr::New (Js::OpCode::LdSlotArr, regOpnd, fieldOpnd, m_func);
39283934 this ->AddInstr (instr, offset);
0 commit comments