|
|
@@ -1117,9 +1117,15 @@ LowererMDArch::LowerAsmJsLdElemHelper(IR::Instr * instr, bool isSimdLoad /*= fal
|
|
|
IRType type = src1->GetType();
|
|
|
IR::RegOpnd * indexOpnd = src1->AsIndirOpnd()->GetIndexOpnd();
|
|
|
const uint8 dataWidth = instr->dataWidth;
|
|
|
-
|
|
|
Assert(isSimdLoad == false || dataWidth == 4 || dataWidth == 8 || dataWidth == 12 || dataWidth == 16);
|
|
|
|
|
|
+#if ENABLE_FAST_ARRAYBUFFER
|
|
|
+ if (CONFIG_FLAG(WasmFastArray) && m_func->GetJITFunctionBody()->IsWasmFunction())
|
|
|
+ {
|
|
|
+ return instr;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef _WIN32
|
|
|
// For x64, bound checks are required only for SIMD loads.
|
|
|
if (isSimdLoad)
|
|
|
@@ -1147,6 +1153,15 @@ LowererMDArch::LowerAsmJsLdElemHelper(IR::Instr * instr, bool isSimdLoad /*= fal
|
|
|
IR::RegOpnd *tmp = IR::RegOpnd::New(cmpOpnd->GetType(), m_func);
|
|
|
// MOV tmp, cmpOnd
|
|
|
Lowerer::InsertMove(tmp, cmpOpnd, helperLabel);
|
|
|
+#ifdef ENABLE_WASM
|
|
|
+ if (m_func->GetJITFunctionBody()->IsWasmFunction() && src1->AsIndirOpnd()->GetOffset())
|
|
|
+ {
|
|
|
+ // ADD tmp, offset
|
|
|
+ Lowerer::InsertAdd(true, tmp, tmp, IR::IntConstOpnd::New((uint32)src1->AsIndirOpnd()->GetOffset(), tmp->GetType(), m_func, true), helperLabel);
|
|
|
+ // JB helper
|
|
|
+ Lowerer::InsertBranch(Js::OpCode::JB, helperLabel, helperLabel);
|
|
|
+ }
|
|
|
+#endif
|
|
|
// ADD tmp, dataWidth
|
|
|
Lowerer::InsertAdd(true, tmp, tmp, IR::IntConstOpnd::New((uint32)dataWidth, tmp->GetType(), m_func, true), helperLabel);
|
|
|
// JB helper
|
|
|
@@ -1157,7 +1172,23 @@ LowererMDArch::LowerAsmJsLdElemHelper(IR::Instr * instr, bool isSimdLoad /*= fal
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lowererMD->m_lowerer->InsertCompareBranch(cmpOpnd, instr->UnlinkSrc2(), Js::OpCode::BrGe_A, true, helperLabel, helperLabel);
|
|
|
+#ifdef ENABLE_WASM
|
|
|
+ if (m_func->GetJITFunctionBody()->IsWasmFunction() && src1->AsIndirOpnd()->GetOffset()) //WASM
|
|
|
+ {
|
|
|
+ IR::RegOpnd *tmp = IR::RegOpnd::New(cmpOpnd->GetType(), m_func);
|
|
|
+ // MOV tmp, cmpOnd
|
|
|
+ Lowerer::InsertMove(tmp, cmpOpnd, helperLabel);
|
|
|
+ // ADD tmp, offset
|
|
|
+ Lowerer::InsertAdd(true, tmp, tmp, IR::IntConstOpnd::New((uint32)src1->AsIndirOpnd()->GetOffset(), tmp->GetType(), m_func, true), helperLabel);
|
|
|
+ // JB helper
|
|
|
+ Lowerer::InsertBranch(Js::OpCode::JB, helperLabel, helperLabel);
|
|
|
+ lowererMD->m_lowerer->InsertCompareBranch(cmpOpnd, instr->UnlinkSrc2(), Js::OpCode::BrGe_A, true, helperLabel, helperLabel);
|
|
|
+ }
|
|
|
+ else
|
|
|
+#endif
|
|
|
+ {
|
|
|
+ lowererMD->m_lowerer->InsertCompareBranch(cmpOpnd, instr->UnlinkSrc2(), Js::OpCode::BrGe_A, true, helperLabel, helperLabel);
|
|
|
+ }
|
|
|
}
|
|
|
Lowerer::InsertBranch(Js::OpCode::Br, loadLabel, helperLabel);
|
|
|
|
|
|
@@ -1225,6 +1256,15 @@ LowererMDArch::LowerAsmJsStElemHelper(IR::Instr * instr, bool isSimdStore /*= fa
|
|
|
IR::RegOpnd *tmp = IR::RegOpnd::New(cmpOpnd->GetType(), m_func);
|
|
|
// MOV tmp, cmpOnd
|
|
|
Lowerer::InsertMove(tmp, cmpOpnd, helperLabel);
|
|
|
+#ifdef ENABLE_WASM
|
|
|
+ if (m_func->GetJITFunctionBody()->IsWasmFunction() && dst->AsIndirOpnd()->GetOffset())
|
|
|
+ {
|
|
|
+ // ADD tmp, offset
|
|
|
+ Lowerer::InsertAdd(true, tmp, tmp, IR::IntConstOpnd::New((uint32)dst->AsIndirOpnd()->GetOffset(), tmp->GetType(), m_func, true), helperLabel);
|
|
|
+ // JB helper
|
|
|
+ Lowerer::InsertBranch(Js::OpCode::JB, helperLabel, helperLabel);
|
|
|
+ }
|
|
|
+#endif
|
|
|
// ADD tmp, dataWidth
|
|
|
Lowerer::InsertAdd(true, tmp, tmp, IR::IntConstOpnd::New((uint32)dataWidth, tmp->GetType(), m_func, true), helperLabel);
|
|
|
// JB helper
|
|
|
@@ -1235,7 +1275,23 @@ LowererMDArch::LowerAsmJsStElemHelper(IR::Instr * instr, bool isSimdStore /*= fa
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lowererMD->m_lowerer->InsertCompareBranch(cmpOpnd, instr->UnlinkSrc2(), Js::OpCode::BrGe_A, true, helperLabel, helperLabel);
|
|
|
+#ifdef ENABLE_WASM
|
|
|
+ if (m_func->GetJITFunctionBody()->IsWasmFunction() && dst->AsIndirOpnd()->GetOffset()) //WASM
|
|
|
+ {
|
|
|
+ IR::RegOpnd *tmp = IR::RegOpnd::New(cmpOpnd->GetType(), m_func);
|
|
|
+ // MOV tmp, cmpOnd
|
|
|
+ Lowerer::InsertMove(tmp, cmpOpnd, helperLabel);
|
|
|
+ // ADD tmp, offset
|
|
|
+ Lowerer::InsertAdd(true, tmp, tmp, IR::IntConstOpnd::New((uint32)dst->AsIndirOpnd()->GetOffset(), tmp->GetType(), m_func, true), helperLabel);
|
|
|
+ // JB helper
|
|
|
+ Lowerer::InsertBranch(Js::OpCode::JB, helperLabel, helperLabel);
|
|
|
+ lowererMD->m_lowerer->InsertCompareBranch(cmpOpnd, instr->UnlinkSrc2(), Js::OpCode::BrGe_A, true, helperLabel, helperLabel);
|
|
|
+ }
|
|
|
+ else
|
|
|
+#endif
|
|
|
+ {
|
|
|
+ lowererMD->m_lowerer->InsertCompareBranch(cmpOpnd, instr->UnlinkSrc2(), Js::OpCode::BrGe_A, true, helperLabel, helperLabel);
|
|
|
+ }
|
|
|
}
|
|
|
Lowerer::InsertBranch(Js::OpCode::Br, storeLabel, helperLabel);
|
|
|
|