@@ -2956,10 +2956,6 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
29562956 break;
29572957 }
29582958
2959- case Js::OpCode::AsyncSpawn:
2960- this->LowerBinaryHelperMem(instr, IR::HelperAsyncSpawn);
2961- break;
2962-
29632959 case Js::OpCode::FrameDisplayCheck:
29642960 instrPrev = this->LowerFrameDisplayCheck(instr);
29652961 break;
@@ -5088,7 +5084,7 @@ Lowerer::LowerNewScObjArrayNoArg(IR::Instr *newObjInstr)
50885084void
50895085Lowerer::LowerPrologEpilog()
50905086{
5091- if (m_func->GetJnFunction()->IsGenerator ())
5087+ if (m_func->GetJnFunction()->IsCoroutine ())
50925088 {
50935089 LowerGeneratorResumeJumpTable();
50945090 }
@@ -5125,7 +5121,7 @@ Lowerer::LowerPrologEpilogAsmJs()
51255121void
51265122Lowerer::LowerGeneratorResumeJumpTable()
51275123{
5128- Assert(m_func->GetJnFunction()->IsGenerator ());
5124+ Assert(m_func->GetJnFunction()->IsCoroutine ());
51295125
51305126 IR::Instr * jumpTableInstr = m_func->m_headInstr;
51315127 AssertMsg(jumpTableInstr->IsEntryInstr(), "First instr isn't an EntryInstr...");
@@ -7572,7 +7568,7 @@ Lowerer::LoadArgumentCount(IR::Instr *const instr)
75727568 instr->SetSrc1(IR::IntConstOpnd::New(instr->m_func->actualCount, TyUint32, instr->m_func, true));
75737569 LowererMD::ChangeToAssign(instr);
75747570 }
7575- else if (instr->m_func->GetJnFunction()->IsGenerator ())
7571+ else if (instr->m_func->GetJnFunction()->IsCoroutine ())
75767572 {
75777573 IR::SymOpnd* symOpnd = LoadCallInfo(instr);
75787574 instr->SetSrc1(symOpnd);
@@ -9611,7 +9607,7 @@ IR::Instr *Lowerer::LowerRestParameter(IR::Opnd *formalsOpnd, IR::Opnd *dstOpnd,
96119607
96129608 LoadScriptContext(helperCallInstr);
96139609
9614- BOOL isGenerator = this->m_func->GetJnFunction()->IsGenerator ();
9610+ BOOL isGenerator = this->m_func->GetJnFunction()->IsCoroutine ();
96159611
96169612 // Elements pointer = ebp + (formals count + formals offset + 1)*sizeof(Var)
96179613 IR::RegOpnd *srcOpnd = isGenerator ? generatorArgsPtrOpnd : IR::Opnd::CreateFramePointerOpnd(this->m_func);
@@ -9719,7 +9715,7 @@ Lowerer::LowerArgIn(IR::Instr *instrArgIn)
97199715 // $createRestArray
97209716 instrArgIn->InsertBefore(createRestArrayLabel);
97219717
9722- if (m_func->GetJnFunction()->IsGenerator ())
9718+ if (m_func->GetJnFunction()->IsCoroutine ())
97239719 {
97249720 generatorArgsPtrOpnd = LoadGeneratorArgsPtr(instrArgIn);
97259721 }
@@ -9738,7 +9734,7 @@ Lowerer::LowerArgIn(IR::Instr *instrArgIn)
97389734 if (argIndex == 1)
97399735 {
97409736 // The "this" argument is not source-dependent and doesn't need to be checked.
9741- if (m_func->GetJnFunction()->IsGenerator ())
9737+ if (m_func->GetJnFunction()->IsCoroutine ())
97429738 {
97439739 generatorArgsPtrOpnd = LoadGeneratorArgsPtr(instrArgIn);
97449740 ConvertArgOpndIfGeneratorFunction(instrArgIn, generatorArgsPtrOpnd);
@@ -9792,7 +9788,7 @@ Lowerer::LowerArgIn(IR::Instr *instrArgIn)
97929788
97939789 // Now insert all the checks and undef-assigns.
97949790
9795- if (m_func->GetJnFunction()->IsGenerator ())
9791+ if (m_func->GetJnFunction()->IsCoroutine ())
97969792 {
97979793 generatorArgsPtrOpnd = LoadGeneratorArgsPtr(instrInsert);
97989794 }
@@ -9962,7 +9958,7 @@ Lowerer::LowerArgIn(IR::Instr *instrArgIn)
99629958void
99639959Lowerer::ConvertArgOpndIfGeneratorFunction(IR::Instr *instrArgIn, IR::RegOpnd *generatorArgsPtrOpnd)
99649960{
9965- if (this->m_func->GetJnFunction()->IsGenerator ())
9961+ if (this->m_func->GetJnFunction()->IsCoroutine ())
99669962 {
99679963 // Replace stack param operand with offset into arguments array held by
99689964 // the generator object.
@@ -10668,7 +10664,7 @@ Lowerer::LoadCallInfo(IR::Instr * instrInsert)
1066810664 IR::SymOpnd * srcOpnd;
1066910665 Func * func = instrInsert->m_func;
1067010666
10671- if (func->GetJnFunction()->IsGenerator ())
10667+ if (func->GetJnFunction()->IsCoroutine ())
1067210668 {
1067310669 // Generator function arguments and ArgumentsInfo are not on the stack. Instead they
1067410670 // are accessed off the generator object (which is prm1).
@@ -18115,7 +18111,7 @@ IR::IndirOpnd*
1811518111Lowerer::GetArgsIndirOpndForTopFunction(IR::Instr* ldElem, IR::Opnd* valueOpnd)
1811618112{
1811718113 // Load argument set dst = [ebp + index] (or grab from the generator object if m_func is a generator function).
18118- IR::RegOpnd *baseOpnd = m_func->GetJnFunction()->IsGenerator () ? LoadGeneratorArgsPtr(ldElem) : IR::Opnd::CreateFramePointerOpnd(m_func);
18114+ IR::RegOpnd *baseOpnd = m_func->GetJnFunction()->IsCoroutine () ? LoadGeneratorArgsPtr(ldElem) : IR::Opnd::CreateFramePointerOpnd(m_func);
1811918115 IR::IndirOpnd* argIndirOpnd = nullptr;
1812018116 // The stack looks like this:
1812118117 // ...
@@ -18129,7 +18125,7 @@ Lowerer::GetArgsIndirOpndForTopFunction(IR::Instr* ldElem, IR::Opnd* valueOpnd)
1812918125
1813018126 //actual arguments offset is LowererMD::GetFormalParamOffset() + 1 (this)
1813118127
18132- uint16 actualOffset = m_func->GetJnFunction()->IsGenerator () ? 1 : GetFormalParamOffset() + 1; //5
18128+ uint16 actualOffset = m_func->GetJnFunction()->IsCoroutine () ? 1 : GetFormalParamOffset() + 1; //5
1813318129 Assert(actualOffset == 5 || m_func->GetJnFunction()->IsGenerator());
1813418130 if (valueOpnd->IsIntConstOpnd())
1813518131 {
@@ -20327,6 +20323,7 @@ Lowerer::GenerateSetHomeObj(IR::Instr* instrInsert)
2032720323 Func *func = instrInsert->m_func;
2032820324
2032920325 IR::LabelInstr *labelScriptFunction = IR::LabelInstr::New(Js::OpCode::Label, func, false);
20326+ IR::LabelInstr *labelForGeneratorScriptFunction = IR::LabelInstr::New(Js::OpCode::Label, func, false);
2033020327
2033120328 IR::Opnd *src2Opnd = instrInsert->UnlinkSrc2();
2033220329 IR::Opnd *src1Opnd = instrInsert->UnlinkSrc1();
@@ -20338,10 +20335,16 @@ Lowerer::GenerateSetHomeObj(IR::Instr* instrInsert)
2033820335 LowererMD::CreateAssign(funcObjRegOpnd, src1Opnd, instrInsert);
2033920336
2034020337 IR::Opnd * vtableAddressOpnd = this->LoadVTableValueOpnd(instrInsert, VTableValue::VtableJavascriptGeneratorFunction);
20338+ InsertCompareBranch(IR::IndirOpnd::New(funcObjRegOpnd, 0, TyMachPtr, func), vtableAddressOpnd,
20339+ Js::OpCode::BrEq_A, true, labelForGeneratorScriptFunction, instrInsert);
20340+
20341+ vtableAddressOpnd = this->LoadVTableValueOpnd(instrInsert, VTableValue::VtableJavascriptAsyncFunction);
2034120342 InsertCompareBranch(IR::IndirOpnd::New(funcObjRegOpnd, 0, TyMachPtr, func), vtableAddressOpnd,
2034220343 Js::OpCode::BrNeq_A, true, labelScriptFunction, instrInsert);
2034320344
20344- indirOpnd = IR::IndirOpnd::New(funcObjRegOpnd, Js::JavascriptGeneratorFunction::GetOffsetOfScriptFunction() , TyMachPtr, func);
20345+ instrInsert->InsertBefore(labelForGeneratorScriptFunction);
20346+
20347+ indirOpnd = IR::IndirOpnd::New(funcObjRegOpnd, Js::JavascriptGeneratorFunction::GetOffsetOfScriptFunction(), TyMachPtr, func);
2034520348 LowererMD::CreateAssign(funcObjRegOpnd, indirOpnd, instrInsert);
2034620349
2034720350 instrInsert->InsertBefore(labelScriptFunction);
@@ -20363,7 +20366,7 @@ Lowerer::GenerateLoadNewTarget(IR::Instr* instrInsert)
2036320366
2036420367 Assert(!func->IsInlinee());
2036520368
20366- if (func->GetJnFunction()->IsGenerator ())
20369+ if (func->GetJnFunction()->IsCoroutine ())
2036720370 {
2036820371 instrInsert->SetSrc1(opndUndefAddress);
2036920372 LowererMD::ChangeToAssign(instrInsert);
@@ -21098,7 +21101,7 @@ void Lowerer::GenerateNullOutGeneratorFrame(IR::Instr* insertInstr)
2109821101
2109921102void Lowerer::LowerFunctionExit(IR::Instr* funcExit)
2110021103{
21101- if (m_func->GetJnFunction()->IsGenerator ())
21104+ if (m_func->GetJnFunction()->IsCoroutine ())
2110221105 {
2110321106 GenerateNullOutGeneratorFrame(funcExit->m_prev);
2110421107 }
0 commit comments