@@ -747,6 +747,7 @@ namespace Js
747747 Var value;
748748 if (pThis->GetItemAt (idxPosition, &value))
749749 {
750+ value = BreakSpeculation (value);
750751 return value;
751752 }
752753 else
@@ -795,7 +796,7 @@ namespace Js
795796 return scriptContext->GetLibrary ()->GetNaN ();
796797 }
797798
798- return TaggedInt::ToVarUnchecked (pThis->GetItem (idxPosition));
799+ return BreakSpeculation ( TaggedInt::ToVarUnchecked (pThis->GetItem (idxPosition) ));
799800 }
800801
801802 Var JavascriptString::EntryCodePointAt (RecyclableObject* function, CallInfo callInfo, ...)
@@ -1849,6 +1850,9 @@ namespace Js
18491850 {
18501851 idxEnd = idxStart;
18511852 }
1853+
1854+ pThis = (JavascriptString*)BreakSpeculation (pThis);
1855+
18521856 return SubstringCore (pThis, idxStart, idxEnd - idxStart, scriptContext);
18531857 }
18541858
@@ -1968,6 +1972,8 @@ namespace Js
19681972 return pThis;
19691973 }
19701974
1975+ pThis = (JavascriptString*)BreakSpeculation (pThis);
1976+
19711977 return SubstringCore (pThis, idxStart, idxEnd - idxStart, scriptContext);
19721978 }
19731979
@@ -2024,6 +2030,8 @@ namespace Js
20242030 return pThis;
20252031 }
20262032
2033+ pThis = (JavascriptString*)BreakSpeculation (pThis);
2034+
20272035 Assert (0 <= idxStart && idxStart <= idxEnd && idxEnd <= len);
20282036 return SubstringCore (pThis, idxStart, idxEnd - idxStart, scriptContext);
20292037 }
0 commit comments