Kaynağa Gözat

Allow for the possibility of no profile info for a given call target

Kevin Smith 6 yıl önce
ebeveyn
işleme
25b4303c4f

+ 3 - 1
lib/Backend/JITTimeFunctionBody.cpp

@@ -1080,7 +1080,9 @@ JITTimeFunctionBody::GetCallApplyCallSiteIdForCallSiteId(Js::ProfileId callSiteI
     if (m_bodyData.callSiteToCallApplyCallSiteArray)
     {
         callApplyId = m_bodyData.callSiteToCallApplyCallSiteArray[callSiteId];
-        AssertOrFailFast(callApplyId < m_bodyData.profiledCallApplyCallSiteCount);
+        AssertOrFailFast(
+            callApplyId == Js::Constants::NoProfileId || 
+            callApplyId < m_bodyData.profiledCallApplyCallSiteCount);
     }
     
     return callApplyId;

+ 12 - 0
test/inlining/bug_gh6303.js

@@ -0,0 +1,12 @@
+let i = 0;
+
+function main() {
+  if (i++ > 2) return;
+  Array.prototype.sort.call(main, ()=>{})()++; // throws ref error
+	Array.prototype.sort.call(main, ()=>{});
+}
+
+try { main(); }
+catch {}
+
+print('PASSED');

+ 6 - 0
test/inlining/rlexe.xml

@@ -341,4 +341,10 @@
       <compile-flags>-mic:1 -bgjit- -off:simplejit</compile-flags>
     </default>
   </test>
+  <test>
+    <default>
+      <files>bug_gh6303.js</files>
+      <flags>exclude_nonative</flags>
+    </default>
+  </test>
 </regress-exe>