Explorar o código

Fix lowering bug for arm when jitloopbodies for tryfinally is enabled

Meghana Gupta %!s(int64=8) %!d(string=hai) anos
pai
achega
086daddaae

+ 1 - 1
lib/Backend/arm/LowerMD.cpp

@@ -1710,7 +1710,7 @@ LowererMD::LowerTry(IR::Instr * tryInstr, IR::JnHelperMethod helperMethod)
     // Arg 7: ScriptContext
     this->m_lowerer->LoadScriptContext(tryAddr);
 
-    if (tryInstr->m_opcode == Js::OpCode::TryCatch || this->m_func->DoOptimizeTry())
+    if (tryInstr->m_opcode == Js::OpCode::TryCatch || this->m_func->DoOptimizeTry() || (this->m_func->IsSimpleJit() && this->m_func->hasBailout))
     {
         // Arg 6 : hasBailedOutOffset
         IR::Opnd * hasBailedOutOffset = IR::IntConstOpnd::New(this->m_func->m_hasBailedOutSym->m_offset + tryInstr->m_func->GetInlineeArgumentStackSize(), TyInt32, this->m_func);

+ 1 - 1
lib/Backend/arm64/LowerMD.cpp

@@ -1504,7 +1504,7 @@ LowererMD::LowerTry(IR::Instr * tryInstr, IR::JnHelperMethod helperMethod)
     // Arg 7: ScriptContext
     this->m_lowerer->LoadScriptContext(tryAddr);
 
-    if (tryInstr->m_opcode == Js::OpCode::TryCatch || this->m_func->DoOptimizeTry())
+    if (tryInstr->m_opcode == Js::OpCode::TryCatch || this->m_func->DoOptimizeTry() || (this->m_func->IsSimpleJit() && this->m_func->hasBailout))
     {
         // Arg 6 : hasBailedOutOffset
         IR::Opnd * hasBailedOutOffset = IR::IntConstOpnd::New(this->m_func->m_hasBailedOutSym->m_offset + tryInstr->m_func->GetInlineeArgumentStackSize(), TyInt32, this->m_func);

+ 5 - 0
test/EH/rlexe.xml

@@ -183,4 +183,9 @@
        <baseline>hasBailedOutBug.baseline</baseline>
   </default>
   </test>
+  <test>
+    <default>
+       <files>tfjitlooparmbug.js</files>
+  </default>
+  </test>
 </regress-exe>

+ 15 - 0
test/EH/tfjitlooparmbug.js

@@ -0,0 +1,15 @@
+//-------------------------------------------------------------------------------------------------------
+// Copyright (C) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
+//-------------------------------------------------------------------------------------------------------
+
+function test3() {
+  try {
+  } finally {
+  }
+  for (var lypbbp = 0; 0; 0) {
+  }
+}
+test3();
+test3();
+print("Passed\n");