@@ -7112,48 +7112,14 @@ Lowerer::LowerStFld(
71127112 if (dst->AsSymOpnd()->IsPropertySymOpnd())
71137113 {
71147114 propertySymOpnd = dst->AsPropertySymOpnd();
7115- if (stFldInstr->HasBailOutInfo() && !propertySymOpnd->IsTypeCheckSeqCandidate() && propertySymOpnd->TypeCheckRequired())
7115+ if (stFldInstr->HasBailOutInfo() && !propertySymOpnd->IsTypeCheckSeqCandidate() &&
7116+ (propertySymOpnd->CantChangeType() || propertySymOpnd->TypeCheckRequired()))
71167117 {
71177118 IR::Instr * instrBailTarget = stFldInstr->ShareBailOut();
71187119 LowerBailTarget(instrBailTarget);
71197120 doCheckLayout = true;
71207121 bailOutInfo = stFldInstr->GetBailOutInfo();
7121- switch (helperMethod)
7122- {
7123- case IR::HelperOp_PatchPutValue:
7124- helperMethod = IR::HelperOp_PatchPutValueCheckLayout;
7125- break;
7126- case IR::HelperOp_PatchPutValuePolymorphic:
7127- helperMethod = IR::HelperOp_PatchPutValuePolymorphicCheckLayout;
7128- break;
7129- case IR::HelperOp_PatchPutValueNoLocalFastPath:
7130- helperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathCheckLayout;
7131- break;
7132- case IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphic:
7133- helperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphicCheckLayout;
7134- break;
7135- case IR::HelperOp_PatchPutValueWithThisPtr:
7136- helperMethod = IR::HelperOp_PatchPutValueWithThisPtrCheckLayout;
7137- break;
7138- case IR::HelperOp_PatchPutValueWithThisPtrPolymorphic:
7139- helperMethod = IR::HelperOp_PatchPutValueWithThisPtrPolymorphicCheckLayout;
7140- break;
7141- case IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPath:
7142- helperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathCheckLayout;
7143- break;
7144- case IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphic:
7145- helperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphicCheckLayout;
7146- break;
7147- case IR::HelperOp_PatchInitValue:
7148- helperMethod = IR::HelperOp_PatchInitValueCheckLayout;
7149- break;
7150- case IR::HelperOp_PatchInitValuePolymorphic:
7151- helperMethod = IR::HelperOp_PatchInitValuePolymorphicCheckLayout;
7152- break;
7153- default:
7154- AssertOrFailFast(false);
7155- break;
7156- }
7122+ MapStFldHelper(propertySymOpnd, helperMethod, polymorphicHelperMethod);
71577123 }
71587124 }
71597125
@@ -7221,6 +7187,115 @@ Lowerer::LowerStFld(
72217187 return instrPrev;
72227188}
72237189
7190+ void
7191+ Lowerer::MapStFldHelper(IR::PropertySymOpnd * propertySymOpnd, IR::JnHelperMethod &helperMethod, IR::JnHelperMethod &polymorphicHelperMethod)
7192+ {
7193+ Assert(propertySymOpnd->CantChangeType() || propertySymOpnd->TypeCheckRequired());
7194+
7195+ if (propertySymOpnd->CantChangeType())
7196+ {
7197+ switch (helperMethod)
7198+ {
7199+ case IR::HelperOp_PatchPutValue:
7200+ helperMethod = IR::HelperOp_PatchPutValueCantChangeType;
7201+ polymorphicHelperMethod = IR::HelperOp_PatchPutValuePolymorphicCantChangeType;
7202+ break;
7203+ case IR::HelperOp_PatchPutValuePolymorphic:
7204+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValuePolymorphicCantChangeType;
7205+ break;
7206+ case IR::HelperOp_PatchPutValueNoLocalFastPath:
7207+ helperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathCantChangeType;
7208+ polymorphicHelperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphicCantChangeType;
7209+ break;
7210+ case IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphic:
7211+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphicCantChangeType;
7212+ break;
7213+ case IR::HelperOp_PatchPutValueWithThisPtr:
7214+ helperMethod = IR::HelperOp_PatchPutValueWithThisPtrCantChangeType;
7215+ polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrPolymorphicCantChangeType;
7216+ break;
7217+ case IR::HelperOp_PatchPutValueWithThisPtrPolymorphic:
7218+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrPolymorphicCantChangeType;
7219+ break;
7220+ case IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPath:
7221+ helperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathCantChangeType;
7222+ polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphicCantChangeType;
7223+ break;
7224+ case IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphic:
7225+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphicCantChangeType;
7226+ break;
7227+ case IR::HelperOp_PatchInitValue:
7228+ helperMethod = IR::HelperOp_PatchInitValueCantChangeType;
7229+ polymorphicHelperMethod = IR::HelperOp_PatchInitValuePolymorphicCantChangeType;
7230+ break;
7231+ case IR::HelperOp_PatchInitValuePolymorphic:
7232+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchInitValuePolymorphicCantChangeType;
7233+ break;
7234+ case IR::HelperOp_PatchPutRootValue:
7235+ case IR::HelperOp_PatchPutRootValuePolymorphic:
7236+ case IR::HelperOp_PatchPutRootValueNoLocalFastPath:
7237+ case IR::HelperOp_PatchPutRootValueNoLocalFastPathPolymorphic:
7238+ // No helper method change is needed here, because the global object doesn't participate in final type opt, so it can't alias
7239+ // an object that does.
7240+ break;
7241+ default:
7242+ AssertOrFailFast(false);
7243+ break;
7244+ }
7245+ }
7246+ else
7247+ {
7248+ switch (helperMethod)
7249+ {
7250+ case IR::HelperOp_PatchPutValue:
7251+ helperMethod = IR::HelperOp_PatchPutValueCheckLayout;
7252+ polymorphicHelperMethod = IR::HelperOp_PatchPutValuePolymorphicCheckLayout;
7253+ break;
7254+ case IR::HelperOp_PatchPutValuePolymorphic:
7255+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValuePolymorphicCheckLayout;
7256+ break;
7257+ case IR::HelperOp_PatchPutValueNoLocalFastPath:
7258+ helperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathCheckLayout;
7259+ polymorphicHelperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphicCheckLayout;
7260+ break;
7261+ case IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphic:
7262+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValueNoLocalFastPathPolymorphicCheckLayout;
7263+ break;
7264+ case IR::HelperOp_PatchPutValueWithThisPtr:
7265+ helperMethod = IR::HelperOp_PatchPutValueWithThisPtrCheckLayout;
7266+ polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrPolymorphicCheckLayout;
7267+ break;
7268+ case IR::HelperOp_PatchPutValueWithThisPtrPolymorphic:
7269+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrPolymorphicCheckLayout;
7270+ break;
7271+ case IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPath:
7272+ helperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathCheckLayout;
7273+ polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphicCheckLayout;
7274+ break;
7275+ case IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphic:
7276+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchPutValueWithThisPtrNoLocalFastPathPolymorphicCheckLayout;
7277+ break;
7278+ case IR::HelperOp_PatchInitValue:
7279+ helperMethod = IR::HelperOp_PatchInitValueCheckLayout;
7280+ polymorphicHelperMethod = IR::HelperOp_PatchInitValuePolymorphicCheckLayout;
7281+ break;
7282+ case IR::HelperOp_PatchInitValuePolymorphic:
7283+ helperMethod = polymorphicHelperMethod = IR::HelperOp_PatchInitValuePolymorphicCheckLayout;
7284+ break;
7285+ case IR::HelperOp_PatchPutRootValue:
7286+ case IR::HelperOp_PatchPutRootValuePolymorphic:
7287+ case IR::HelperOp_PatchPutRootValueNoLocalFastPath:
7288+ case IR::HelperOp_PatchPutRootValueNoLocalFastPathPolymorphic:
7289+ // No helper method change is needed here, because the global object doesn't participate in final type opt, so it can't alias
7290+ // an object that does.
7291+ break;
7292+ default:
7293+ AssertOrFailFast(false);
7294+ break;
7295+ }
7296+ }
7297+ }
7298+
72247299IR::Instr* Lowerer::GenerateCompleteStFld(IR::Instr* instr, bool emitFastPath, IR::JnHelperMethod monoHelperAfterFastPath, IR::JnHelperMethod polyHelperAfterFastPath,
72257300 IR::JnHelperMethod monoHelperWithoutFastPath, IR::JnHelperMethod polyHelperWithoutFastPath, bool withPutFlags, Js::PropertyOperationFlags flags)
72267301{
0 commit comments