Skip to content

Commit

Permalink
[MERGE #4660 @sigatrev] OS#14057294: don't use param scope for jit lo…
Browse files Browse the repository at this point in the history
…op bodies

Merge pull request #4660 from sigatrev:loopScope

jit loop bodies start past the instruction that ends param scope when param and body scopes are split, leading to a Throw::FatalInternalError when there are more scope slots than param scope slots
  • Loading branch information
sigatrev committed Feb 8, 2018
2 parents dc3f1d2 + d8d4dd2 commit 3b8a6eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Backend/IRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ IRBuilder::Build()
m_func->m_tailInstr = m_func->m_exitInstr;
m_func->m_headInstr->InsertAfter(m_func->m_tailInstr);

if (m_func->GetJITFunctionBody()->IsParamAndBodyScopeMerged())
if (m_func->GetJITFunctionBody()->IsParamAndBodyScopeMerged() || this->IsLoopBody())
{
this->SetParamScopeDone();
}
Expand Down
22 changes: 22 additions & 0 deletions test/Bugs/bug14057294.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

function foo(a, b = (function() {a;})())
{
for (var ii = 0; ii < 200; ++ii)
{
var c, d = null;
function bar()
{
c;
d;
};
bar();
}
};

foo();

WScript.Echo("Pass")
5 changes: 5 additions & 0 deletions test/Bugs/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,9 @@
<compile-flags>-args summary -endargs</compile-flags>
</default>
</test>
<test>
<default>
<files>bug14057294.js</files>
</default>
</test>
</regress-exe>

0 comments on commit 3b8a6eb

Please sign in to comment.