Skip to content

Commit 2b36a31

Browse files
authored
Check for ByteCodeRegSlot before using in Inline (chakra-core#6741)
1 parent 4841a76 commit 2b36a31

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/Backend/Inline.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ Inline::InlineBuiltInFunction(
22032203
if (OpCodeAttr::BailOutRec(inlineCallOpCode))
22042204
{
22052205
StackSym * sym = argInstr->GetSrc1()->GetStackSym();
2206-
if (!sym->m_isSingleDef || !sym->m_instrDef->GetSrc1() || !sym->m_instrDef->GetSrc1()->IsConstOpnd())
2206+
if (sym->HasByteCodeRegSlot() && (!sym->m_isSingleDef || !sym->m_instrDef->GetSrc1() || !sym->m_instrDef->GetSrc1()->IsConstOpnd()))
22072207
{
22082208
if (!sym->IsFromByteCodeConstantTable() && sym->GetByteCodeRegSlot() != callInstrDst->GetStackSym()->GetByteCodeRegSlot())
22092209
{

test/Function/bug6738.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
3+
// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
4+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
5+
//-------------------------------------------------------------------------------------------------------
6+
7+
function jit() {
8+
let x = Math.round.call({}, 3133.7);
9+
}
10+
11+
for (var i = 0; i < 0x1000; i++) {
12+
jit();
13+
}
14+
15+
print("pass");

test/Function/rlexe.xml

+5
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,11 @@
483483
<files>bug542360.js</files>
484484
</default>
485485
</test>
486+
<test>
487+
<default>
488+
<files>bug6738.js</files>
489+
</default>
490+
</test>
486491
<test>
487492
<default>
488493
<files>crosssite_bind_main.js</files>

0 commit comments

Comments
 (0)