|
1 | 1 | //-------------------------------------------------------------------------------------------------------
|
2 | 2 | // Copyright (C) Microsoft. All rights reserved.
|
3 |
| -// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved. |
| 3 | +// Copyright (c) ChakraCore Project Contributors. All rights reserved. |
4 | 4 | // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
|
5 | 5 | //-------------------------------------------------------------------------------------------------------
|
6 | 6 | #include "Backend.h"
|
@@ -118,7 +118,7 @@ IRBuilder::DoBailOnNoProfile()
|
118 | 118 | return false;
|
119 | 119 | }
|
120 | 120 |
|
121 |
| - if (m_func->GetTopFunc()->GetJITFunctionBody()->IsCoroutine()) |
| 121 | + if (m_func->GetTopFunc()->GetJITFunctionBody()->IsCoroutine() && !m_func->IsLoopBody()) |
122 | 122 | {
|
123 | 123 | return false;
|
124 | 124 | }
|
@@ -441,7 +441,7 @@ IRBuilder::Build()
|
441 | 441 | // Note that for generators, we insert the bailout after the jump table to allow
|
442 | 442 | // the generator's execution to proceed before bailing out. Otherwise, we would always
|
443 | 443 | // bail to the beginning of the function in the interpreter, creating an infinite loop.
|
444 |
| - if (m_func->IsJitInDebugMode() && !this->m_func->GetJITFunctionBody()->IsCoroutine()) |
| 444 | + if (m_func->IsJitInDebugMode() && (!this->m_func->GetJITFunctionBody()->IsCoroutine() || this->IsLoopBody())) |
445 | 445 | {
|
446 | 446 | this->InsertBailOutForDebugger(m_functionStartOffset, IR::BailOutForceByFlag | IR::BailOutBreakPointInFunction | IR::BailOutStep, nullptr);
|
447 | 447 | }
|
@@ -1880,6 +1880,9 @@ IRBuilder::BuildReg2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot R0, Js::Re
|
1880 | 1880 | break;
|
1881 | 1881 |
|
1882 | 1882 | case Js::OpCode::Yield:
|
| 1883 | + // Jitting Loop Bodies containing Yield is not possible, blocked at callsites of GenerateLoopBody |
| 1884 | + AssertMsg(!this->IsLoopBody(), "Attempting to JIT loop body containing Yield"); |
| 1885 | + |
1883 | 1886 | instr = IR::Instr::New(newOpcode, dstOpnd, src1Opnd, m_func);
|
1884 | 1887 | this->AddInstr(instr, offset);
|
1885 | 1888 | IR::Instr* yieldInstr = instr->ConvertToBailOutInstr(instr, IR::BailOutForGeneratorYield);
|
@@ -7849,6 +7852,7 @@ IRBuilder::GeneratorJumpTable::GeneratorJumpTable(Func* func, IRBuilder* irBuild
|
7849 | 7852 | IR::Instr*
|
7850 | 7853 | IRBuilder::GeneratorJumpTable::BuildJumpTable()
|
7851 | 7854 | {
|
| 7855 | + AssertMsg(!this->m_func->IsLoopBody(), "Coroutine Loop Bodies can be jitted but should follow a different path"); |
7852 | 7856 | if (!this->m_func->GetJITFunctionBody()->IsCoroutine())
|
7853 | 7857 | {
|
7854 | 7858 | return this->m_irBuilder->m_lastInstr;
|
|
0 commit comments