1
1
// -------------------------------------------------------------------------------------------------------
2
- // Copyright (C) Microsoft. All rights reserved.
2
+ // Copyright (C) Microsoft Corporation and contributors . All rights reserved.
3
3
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4
4
// -------------------------------------------------------------------------------------------------------
5
+
5
6
#include " Backend.h"
6
7
#include " Debug/DebuggingFlags.h"
7
8
#include " Debug/DiagProbe.h"
@@ -395,6 +396,14 @@ void BailOutRecord::DumpArgOffsets(uint count, int* offsets, int argOutSlotStart
395
396
// Simd128 reside in Float64 regs
396
397
isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128F4Syms ->Test (argOutSlotStart + i) != 0 ;
397
398
isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128I4Syms ->Test (argOutSlotStart + i) != 0 ;
399
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128I8Syms ->Test (argOutSlotStart + i) != 0 ;
400
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128I16Syms ->Test (argOutSlotStart + i) != 0 ;
401
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128U4Syms ->Test (argOutSlotStart + i) != 0 ;
402
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128U8Syms ->Test (argOutSlotStart + i) != 0 ;
403
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128U16Syms ->Test (argOutSlotStart + i) != 0 ;
404
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128B4Syms ->Test (argOutSlotStart + i) != 0 ;
405
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128B8Syms ->Test (argOutSlotStart + i) != 0 ;
406
+ isFloat64 |= this ->argOutOffsetInfo ->argOutSimd128B16Syms ->Test (argOutSlotStart + i) != 0 ;
398
407
399
408
Assert (!isFloat64 || !isInt32);
400
409
@@ -418,6 +427,14 @@ void BailOutRecord::DumpLocalOffsets(uint count, int argOutSlotStart)
418
427
// Simd values are in float64 regs
419
428
isFloat64 = isFloat64 || row->isSimd128F4 ;
420
429
isFloat64 = isFloat64 || row->isSimd128I4 ;
430
+ isFloat64 = isFloat64 || row->isSimd128I8 ;
431
+ isFloat64 = isFloat64 || row->isSimd128I16 ;
432
+ isFloat64 = isFloat64 || row->isSimd128U4 ;
433
+ isFloat64 = isFloat64 || row->isSimd128U8 ;
434
+ isFloat64 = isFloat64 || row->isSimd128U16 ;
435
+ isFloat64 = isFloat64 || row->isSimd128B4 ;
436
+ isFloat64 = isFloat64 || row->isSimd128B8 ;
437
+ isFloat64 = isFloat64 || row->isSimd128B16 ;
421
438
422
439
Assert (!isFloat64 || !isInt32);
423
440
@@ -694,26 +711,48 @@ BailOutRecord::AdjustOffsetsForDiagMode(Js::JavascriptCallStackLayout * layout,
694
711
}
695
712
696
713
void
697
- BailOutRecord::IsOffsetNativeIntOrFloat (uint offsetIndex, int argOutSlotStart, bool * pIsFloat64, bool * pIsInt32, bool * pIsSimd128F4, bool * pIsSimd128I4) const
714
+ BailOutRecord::IsOffsetNativeIntOrFloat (uint offsetIndex, int argOutSlotStart, bool * pIsFloat64, bool * pIsInt32,
715
+ bool * pIsSimd128F4, bool * pIsSimd128I4, bool * pIsSimd128I8, bool * pIsSimd128I16, bool * pIsSimd128U4,
716
+ bool * pIsSimd128U8, bool * pIsSimd128U16, bool * pIsSimd128B4, bool * pIsSimd128B8, bool * pIsSimd128B16) const
698
717
{
699
718
bool isFloat64 = this ->argOutOffsetInfo ->argOutFloat64Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
700
719
bool isInt32 = this ->argOutOffsetInfo ->argOutLosslessInt32Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
701
720
// SIMD_JS
702
- bool isSimd128F4 = this ->argOutOffsetInfo ->argOutSimd128F4Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
703
- bool isSimd128I4 = this ->argOutOffsetInfo ->argOutSimd128I4Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
704
-
705
- Assert (!isFloat64 || !isInt32 || !isSimd128F4 || !isSimd128I4);
721
+ bool isSimd128F4 = this ->argOutOffsetInfo ->argOutSimd128F4Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
722
+ bool isSimd128I4 = this ->argOutOffsetInfo ->argOutSimd128I4Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
723
+ bool isSimd128I8 = this ->argOutOffsetInfo ->argOutSimd128I8Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
724
+ bool isSimd128I16 = this ->argOutOffsetInfo ->argOutSimd128I16Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
725
+ bool isSimd128U4 = this ->argOutOffsetInfo ->argOutSimd128U4Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
726
+ bool isSimd128U8 = this ->argOutOffsetInfo ->argOutSimd128U8Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
727
+ bool isSimd128U16 = this ->argOutOffsetInfo ->argOutSimd128U16Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
728
+ bool isSimd128B4 = this ->argOutOffsetInfo ->argOutSimd128B4Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
729
+ bool isSimd128B8 = this ->argOutOffsetInfo ->argOutSimd128B8Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
730
+ bool isSimd128B16 = this ->argOutOffsetInfo ->argOutSimd128B16Syms ->Test (argOutSlotStart + offsetIndex) != 0 ;
731
+
732
+ Assert (!isFloat64 || !isInt32 ||
733
+ !isSimd128F4 || !isSimd128I4 || !isSimd128I8 || !isSimd128I16 || !
734
+ !isSimd128U4 || !isSimd128U8 || !isSimd128U16);
706
735
707
736
*pIsFloat64 = isFloat64;
708
737
*pIsInt32 = isInt32;
709
738
*pIsSimd128F4 = isSimd128F4;
710
739
*pIsSimd128I4 = isSimd128I4;
740
+ *pIsSimd128I8 = isSimd128I8;
741
+ *pIsSimd128I16 = isSimd128I16;
742
+ *pIsSimd128U4 = isSimd128U4;
743
+ *pIsSimd128U8 = isSimd128U8;
744
+ *pIsSimd128U16 = isSimd128U16;
745
+ *pIsSimd128B4 = isSimd128B4;
746
+ *pIsSimd128B8 = isSimd128B8;
747
+ *pIsSimd128B16 = isSimd128B16;
711
748
}
712
749
713
750
void
714
751
BailOutRecord::RestoreValue (IR::BailOutKind bailOutKind, Js::JavascriptCallStackLayout * layout, Js::Var * values, Js::ScriptContext * scriptContext,
715
752
bool fromLoopBody, Js::Var * registerSaves, Js::InterpreterStackFrame * newInstance, Js::Var* pArgumentsObject, void * argoutRestoreAddress,
716
- uint regSlot, int offset, bool isLocal, bool isFloat64, bool isInt32, bool isSimd128F4, bool isSimd128I4) const
753
+ uint regSlot, int offset, bool isLocal, bool isFloat64, bool isInt32,
754
+ bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16,
755
+ bool isSimd128U4, bool isSimd128U8, bool isSimd128U16, bool isSimd128B4, bool isSimd128B8, bool isSimd128B16) const
717
756
{
718
757
bool boxStackInstance = true ;
719
758
Js::Var value = 0 ;
@@ -744,7 +783,11 @@ BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStack
744
783
{
745
784
int32Value = layout->GetInt32AtOffset (offset);
746
785
}
747
- else if (isSimd128F4 || isSimd128I4)
786
+ else if (
787
+ isSimd128F4 || isSimd128I4 || isSimd128I8 || isSimd128I16 ||
788
+ isSimd128U4 || isSimd128U8 || isSimd128U16 || isSimd128B4 ||
789
+ isSimd128B8 || isSimd128B16
790
+ )
748
791
{
749
792
// SIMD_JS
750
793
simdValue = layout->GetSimdValueAtOffset (offset);
@@ -766,7 +809,11 @@ BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStack
766
809
// } catch(..) {..}
767
810
// and we bailout during bar args evaluation, we recover from args from argoutRestoreAddress, not from caller function frame.
768
811
// This is because try-catch is implemented as a C wrapper, so args will be a different offset from rbp in that case.
769
- Assert (!isFloat64 && !isInt32 && !isSimd128F4 && !isSimd128I4);
812
+ Assert (
813
+ !isFloat64 && !isInt32 &&
814
+ !isSimd128F4 && !isSimd128I4 && !isSimd128I8 && !isSimd128I16 && !isSimd128U4 &&
815
+ !isSimd128U8 && !isSimd128U16 && !isSimd128B4 && !isSimd128B8 && !isSimd128B16
816
+ );
770
817
771
818
value = *((Js::Var *)(((char *)argoutRestoreAddress) + regSlot * MachPtr));
772
819
AssertMsg (!(newInstance->function ->GetFunctionBody ()->IsInDebugMode () &&
@@ -798,7 +845,11 @@ BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStack
798
845
}
799
846
else
800
847
{
801
- if (isSimd128F4 || isSimd128I4)
848
+ if (
849
+ isSimd128F4 || isSimd128I4 || isSimd128I8 || isSimd128I16 ||
850
+ isSimd128U4 || isSimd128U8 || isSimd128U16 || isSimd128B4 ||
851
+ isSimd128B8 || isSimd128B16
852
+ )
802
853
{
803
854
simdValue = *((SIMDValue *)&(registerSaveSpace[offset - 1 ]));
804
855
}
@@ -875,6 +926,46 @@ BailOutRecord::RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStack
875
926
Assert (!value);
876
927
value = Js::JavascriptSIMDInt32x4::New (&simdValue, scriptContext);
877
928
}
929
+ else if (isSimd128I8)
930
+ {
931
+ Assert (!value);
932
+ value = Js::JavascriptSIMDInt16x8::New (&simdValue, scriptContext);
933
+ }
934
+ else if (isSimd128I16)
935
+ {
936
+ Assert (!value);
937
+ value = Js::JavascriptSIMDInt8x16::New (&simdValue, scriptContext);
938
+ }
939
+ else if (isSimd128U4)
940
+ {
941
+ Assert (!value);
942
+ value = Js::JavascriptSIMDUint32x4::New (&simdValue, scriptContext);
943
+ }
944
+ else if (isSimd128U8)
945
+ {
946
+ Assert (!value);
947
+ value = Js::JavascriptSIMDUint16x8::New (&simdValue, scriptContext);
948
+ }
949
+ else if (isSimd128U16)
950
+ {
951
+ Assert (!value);
952
+ value = Js::JavascriptSIMDUint8x16::New (&simdValue, scriptContext);
953
+ }
954
+ else if (isSimd128B4)
955
+ {
956
+ Assert (!value);
957
+ value = Js::JavascriptSIMDBool32x4::New (&simdValue, scriptContext);
958
+ }
959
+ else if (isSimd128B8)
960
+ {
961
+ Assert (!value);
962
+ value = Js::JavascriptSIMDBool16x8::New (&simdValue, scriptContext);
963
+ }
964
+ else if (isSimd128B16)
965
+ {
966
+ Assert (!value);
967
+ value = Js::JavascriptSIMDBool8x16::New (&simdValue, scriptContext);
968
+ }
878
969
else
879
970
{
880
971
BAILOUT_VERBOSE_TRACE (newInstance->function ->GetFunctionBody (), bailOutKind, _u (" , value: 0x%p" ), value);
@@ -906,7 +997,9 @@ BailOutRecord::RestoreValues(IR::BailOutKind bailOutKind, Js::JavascriptCallStac
906
997
globalBailOutRecordTable->IterateGlobalBailOutRecordTableRows (m_bailOutRecordId, [=](GlobalBailOutRecordDataRow *row) {
907
998
Assert (row->offset != 0 );
908
999
RestoreValue (bailOutKind, layout, values, scriptContext, fromLoopBody, registerSaves, newInstance, pArgumentsObject,
909
- argoutRestoreAddress, row->regSlot , row->offset , true , row->isFloat , row->isInt , row->isSimd128F4 , row->isSimd128I4 );
1000
+ argoutRestoreAddress, row->regSlot , row->offset , true , row->isFloat , row->isInt , row->isSimd128F4 ,
1001
+ row->isSimd128I4 , row->isSimd128I8 , row->isSimd128I16 , row->isSimd128U4 , row->isSimd128U8 , row->isSimd128U16 ,
1002
+ row->isSimd128B4 , row->isSimd128B8 , row->isSimd128B16 );
910
1003
});
911
1004
}
912
1005
else
@@ -918,12 +1011,25 @@ BailOutRecord::RestoreValues(IR::BailOutKind bailOutKind, Js::JavascriptCallStac
918
1011
// The variables below determine whether we have a Var or native float/int.
919
1012
bool isFloat64;
920
1013
bool isInt32;
921
- bool isSimd128F4, isSimd128I4;
1014
+ bool isSimd128F4;
1015
+ bool isSimd128I4;
1016
+ bool isSimd128I8;
1017
+ bool isSimd128I16;
1018
+ bool isSimd128U4;
1019
+ bool isSimd128U8;
1020
+ bool isSimd128U16;
1021
+ bool isSimd128B4;
1022
+ bool isSimd128B8;
1023
+ bool isSimd128B16;
922
1024
923
1025
offset = offsets[i];
924
- this ->IsOffsetNativeIntOrFloat (i, argOutSlotStart, &isFloat64, &isInt32, &isSimd128F4, &isSimd128I4);
1026
+ this ->IsOffsetNativeIntOrFloat (i, argOutSlotStart, &isFloat64, &isInt32,
1027
+ &isSimd128F4, &isSimd128I4, &isSimd128I8, &isSimd128I16,
1028
+ &isSimd128U4, &isSimd128U8, &isSimd128U16, &isSimd128B4, &isSimd128B8, &isSimd128B16);
1029
+
925
1030
RestoreValue (bailOutKind, layout, values, scriptContext, fromLoopBody, registerSaves, newInstance, pArgumentsObject,
926
- argoutRestoreAddress, i, offset, false , isFloat64, isInt32, isSimd128F4, isSimd128I4);
1031
+ argoutRestoreAddress, i, offset, false , isFloat64, isInt32, isSimd128F4, isSimd128I4, isSimd128I8,
1032
+ isSimd128I16, isSimd128U4, isSimd128U8, isSimd128U16, isSimd128B4, isSimd128B8, isSimd128B16);
927
1033
}
928
1034
}
929
1035
}
@@ -2549,7 +2655,9 @@ void GlobalBailOutRecordDataTable::Finalize(NativeCodeData::Allocator *allocator
2549
2655
#endif
2550
2656
}
2551
2657
2552
- void GlobalBailOutRecordDataTable::AddOrUpdateRow (JitArenaAllocator *allocator, uint32 bailOutRecordId, uint32 regSlot, bool isFloat, bool isInt, bool isSimd128F4, bool isSimd128I4, int32 offset, uint *lastUpdatedRowIndex)
2658
+ void GlobalBailOutRecordDataTable::AddOrUpdateRow (JitArenaAllocator *allocator, uint32 bailOutRecordId, uint32 regSlot, bool isFloat, bool isInt,
2659
+ bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16, bool isSimd128U4, bool isSimd128U8, bool isSimd128U16,
2660
+ bool isSimd128B4, bool isSimd128B8, bool isSimd128B16, int32 offset, uint *lastUpdatedRowIndex)
2553
2661
{
2554
2662
Assert (offset != 0 );
2555
2663
const int INITIAL_TABLE_SIZE = 64 ;
@@ -2569,8 +2677,16 @@ void GlobalBailOutRecordDataTable::AddOrUpdateRow(JitArenaAllocator *allocator,
2569
2677
rowToUpdate->isInt == (unsigned )isInt &&
2570
2678
rowToUpdate->isFloat == (unsigned )isFloat &&
2571
2679
// SIMD_JS
2572
- rowToUpdate->isSimd128F4 == (unsigned ) isSimd128F4 &&
2573
- rowToUpdate->isSimd128I4 == (unsigned ) isSimd128I4 &&
2680
+ rowToUpdate->isSimd128F4 == (unsigned ) isSimd128F4 &&
2681
+ rowToUpdate->isSimd128I4 == (unsigned ) isSimd128I4 &&
2682
+ rowToUpdate->isSimd128I8 == (unsigned ) isSimd128I8 &&
2683
+ rowToUpdate->isSimd128I16 == (unsigned ) isSimd128I16 &&
2684
+ rowToUpdate->isSimd128U4 == (unsigned ) isSimd128U4 &&
2685
+ rowToUpdate->isSimd128U8 == (unsigned ) isSimd128U8 &&
2686
+ rowToUpdate->isSimd128U16 == (unsigned ) isSimd128U16 &&
2687
+ rowToUpdate->isSimd128B4 == (unsigned ) isSimd128B4 &&
2688
+ rowToUpdate->isSimd128B8 == (unsigned ) isSimd128B8 &&
2689
+ rowToUpdate->isSimd128B16 == (unsigned ) isSimd128B16 &&
2574
2690
2575
2691
rowToUpdate->end + 1 == bailOutRecordId)
2576
2692
{
@@ -2592,8 +2708,16 @@ void GlobalBailOutRecordDataTable::AddOrUpdateRow(JitArenaAllocator *allocator,
2592
2708
rowToInsert->isFloat = isFloat;
2593
2709
rowToInsert->isInt = isInt;
2594
2710
// SIMD_JS
2595
- rowToInsert->isSimd128F4 = isSimd128F4;
2596
- rowToInsert->isSimd128I4 = isSimd128I4;
2711
+ rowToInsert->isSimd128F4 = isSimd128F4;
2712
+ rowToInsert->isSimd128I4 = isSimd128I4;
2713
+ rowToInsert->isSimd128I8 = isSimd128I8 ;
2714
+ rowToInsert->isSimd128I16 = isSimd128I16;
2715
+ rowToInsert->isSimd128U4 = isSimd128U4 ;
2716
+ rowToInsert->isSimd128U8 = isSimd128U8 ;
2717
+ rowToInsert->isSimd128U16 = isSimd128U16;
2718
+ rowToInsert->isSimd128B4 = isSimd128B4 ;
2719
+ rowToInsert->isSimd128B8 = isSimd128B8 ;
2720
+ rowToInsert->isSimd128B16 = isSimd128B16;
2597
2721
rowToInsert->regSlot = regSlot;
2598
2722
*lastUpdatedRowIndex = length++;
2599
2723
}
0 commit comments