@@ -1117,6 +1117,30 @@ LowererMDArch::LowerAsmJsCallI(IR::Instr * callInstr)
1117
1117
return ret;
1118
1118
}
1119
1119
1120
+ IR::Instr *
1121
+ LowererMDArch::LowerWasmMemOp (IR::Instr * instr, IR::Opnd *addrOpnd)
1122
+ {
1123
+ Assert (instr->GetSrc2 ());
1124
+
1125
+ IR::LabelInstr * helperLabel = Lowerer::InsertLabel (true , instr);
1126
+ IR::LabelInstr * loadLabel = Lowerer::InsertLabel (false , instr);
1127
+ IR::LabelInstr * doneLabel = Lowerer::InsertLabel (false , instr);
1128
+
1129
+ // Find array buffer length
1130
+ IR::RegOpnd * indexOpnd = addrOpnd->AsIndirOpnd ()->GetIndexOpnd ();
1131
+ IR::Opnd *arrayLenOpnd = instr->GetSrc2 ();
1132
+
1133
+ // Compare index + memop access length and array buffer length, and generate RuntimeError if greater
1134
+ IR::Opnd *cmpOpnd = IR::RegOpnd::New (TyUint64, m_func);
1135
+ Lowerer::InsertAdd (true , cmpOpnd, indexOpnd, IR::IntConstOpnd::New (addrOpnd->GetSize (), TyUint64, m_func), helperLabel);
1136
+ lowererMD->m_lowerer ->InsertCompareBranch (cmpOpnd, arrayLenOpnd, Js::OpCode::BrGt_A, true , helperLabel, helperLabel);
1137
+
1138
+ // MGTODO : call RuntimeError once implemented
1139
+ lowererMD->m_lowerer ->GenerateRuntimeError (loadLabel, JSERR_InvalidTypedArrayIndex, IR::HelperOp_RuntimeRangeError);
1140
+ Lowerer::InsertBranch (Js::OpCode::Br, loadLabel, helperLabel);
1141
+ return doneLabel;
1142
+ }
1143
+
1120
1144
IR::Instr*
1121
1145
LowererMDArch::LowerAsmJsLdElemHelper (IR::Instr * instr, bool isSimdLoad /* = false*/ , bool checkEndOffset /* = false*/ )
1122
1146
{
@@ -2541,6 +2565,36 @@ LowererMDArch::EmitIntToFloat(IR::Opnd *dst, IR::Opnd *src, IR::Instr *instrInse
2541
2565
}
2542
2566
}
2543
2567
2568
+ void
2569
+ LowererMDArch::EmitIntToLong (IR::Opnd *dst, IR::Opnd *src, IR::Instr *instrInsert)
2570
+ {
2571
+ Assert (dst->IsRegOpnd () && dst->IsInt64 ());
2572
+ Assert (src->IsInt32 ());
2573
+
2574
+ if (src->IsIntConstOpnd ())
2575
+ {
2576
+ Lowerer::InsertMove (dst, src, instrInsert);
2577
+ return ;
2578
+ }
2579
+ Assert (src->IsRegOpnd ());
2580
+ instrInsert->InsertBefore (IR::Instr::New (Js::OpCode::MOVSXD, dst, src, this ->m_func ));
2581
+ }
2582
+
2583
+ void
2584
+ LowererMDArch::EmitUIntToLong (IR::Opnd *dst, IR::Opnd *src, IR::Instr *instrInsert)
2585
+ {
2586
+ Assert (dst->IsRegOpnd () && dst->IsInt64 ());
2587
+ Assert (src->IsUInt32 ());
2588
+
2589
+ if (src->IsIntConstOpnd ())
2590
+ {
2591
+ Lowerer::InsertMove (dst, src, instrInsert);
2592
+ return ;
2593
+ }
2594
+ Assert (src->IsRegOpnd ());
2595
+ instrInsert->InsertBefore (IR::Instr::New (Js::OpCode::MOV, dst, src, this ->m_func ));
2596
+ }
2597
+
2544
2598
void
2545
2599
LowererMDArch::EmitUIntToFloat (IR::Opnd *dst, IR::Opnd *src, IR::Instr *instrInsert)
2546
2600
{
0 commit comments