1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
24pub enum OpFormat {
25 None,
27 NoneInt,
29 NoneLoc,
31 NoneArg,
33 NoneVarRef,
35 U8,
37 I8,
39 Loc8,
41 Const8,
43 Label8,
45 U16,
47 I16,
49 Label16,
51 Npop,
53 Npopx,
55 NpopU16,
57 Loc,
59 Arg,
61 VarRef,
63 U32,
65 I32,
67 Const,
69 Label,
71 Atom,
73 AtomU8,
75 AtomU16,
77 AtomLabelU8,
79 AtomLabelU16,
81 LabelU16,
83}
84
85impl OpFormat {
86 pub fn as_str(self) -> &'static str {
88 match self {
89 OpFormat::None => "none",
90 OpFormat::NoneInt => "none_int",
91 OpFormat::NoneLoc => "none_loc",
92 OpFormat::NoneArg => "none_arg",
93 OpFormat::NoneVarRef => "none_var_ref",
94 OpFormat::U8 => "u8",
95 OpFormat::I8 => "i8",
96 OpFormat::Loc8 => "loc8",
97 OpFormat::Const8 => "const8",
98 OpFormat::Label8 => "label8",
99 OpFormat::U16 => "u16",
100 OpFormat::I16 => "i16",
101 OpFormat::Label16 => "label16",
102 OpFormat::Npop => "npop",
103 OpFormat::Npopx => "npopx",
104 OpFormat::NpopU16 => "npop_u16",
105 OpFormat::Loc => "loc",
106 OpFormat::Arg => "arg",
107 OpFormat::VarRef => "var_ref",
108 OpFormat::U32 => "u32",
109 OpFormat::I32 => "i32",
110 OpFormat::Const => "const",
111 OpFormat::Label => "label",
112 OpFormat::Atom => "atom",
113 OpFormat::AtomU8 => "atom_u8",
114 OpFormat::AtomU16 => "atom_u16",
115 OpFormat::AtomLabelU8 => "atom_label_u8",
116 OpFormat::AtomLabelU16 => "atom_label_u16",
117 OpFormat::LabelU16 => "label_u16",
118 }
119 }
120
121 pub fn is_label(self) -> bool {
123 matches!(
124 self,
125 OpFormat::Label
126 | OpFormat::Label8
127 | OpFormat::Label16
128 | OpFormat::AtomLabelU8
129 | OpFormat::AtomLabelU16
130 | OpFormat::LabelU16
131 )
132 }
133}
134
135#[derive(Debug, Clone, Copy)]
137pub struct OpInfo {
138 pub name: &'static str,
140 pub size: u8,
142 pub n_pop: u8,
144 pub n_push: u8,
146 pub format: OpFormat,
148}
149
150#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
156#[repr(u8)]
157pub enum Opcode {
158 Invalid = 0,
160 PushI32 = 1,
162 PushConst = 2,
164 Fclosure = 3,
166 PushAtomValue = 4,
168 PrivateSymbol = 5,
170 Undefined = 6,
172 Null = 7,
174 PushThis = 8,
176 PushFalse = 9,
178 PushTrue = 10,
180 Object = 11,
182 SpecialObject = 12,
184 Rest = 13,
186 Drop = 14,
188 Nip = 15,
190 Nip1 = 16,
192 Dup = 17,
194 Dup1 = 18,
196 Dup2 = 19,
198 Dup3 = 20,
200 Insert2 = 21,
202 Insert3 = 22,
204 Insert4 = 23,
206 Perm3 = 24,
208 Perm4 = 25,
210 Perm5 = 26,
212 Swap = 27,
214 Swap2 = 28,
216 Rot3l = 29,
218 Rot3r = 30,
220 Rot4l = 31,
222 Rot5l = 32,
224 CallConstructor = 33,
226 Call = 34,
228 TailCall = 35,
230 CallMethod = 36,
232 TailCallMethod = 37,
234 ArrayFrom = 38,
236 Apply = 39,
238 Return = 40,
240 ReturnUndef = 41,
242 CheckCtorReturn = 42,
244 CheckCtor = 43,
246 InitCtor = 44,
248 CheckBrand = 45,
250 AddBrand = 46,
252 ReturnAsync = 47,
254 Throw = 48,
256 ThrowError = 49,
258 Eval = 50,
260 ApplyEval = 51,
262 Regexp = 52,
264 GetSuper = 53,
266 Import = 54,
268 GetVarUndef = 55,
270 GetVar = 56,
272 PutVar = 57,
274 PutVarInit = 58,
276 GetRefValue = 59,
278 PutRefValue = 60,
280 GetField = 61,
282 GetField2 = 62,
284 PutField = 63,
286 GetPrivateField = 64,
288 PutPrivateField = 65,
290 DefinePrivateField = 66,
292 GetArrayEl = 67,
294 GetArrayEl2 = 68,
296 GetArrayEl3 = 69,
298 PutArrayEl = 70,
300 GetSuperValue = 71,
302 PutSuperValue = 72,
304 DefineField = 73,
306 SetName = 74,
308 SetNameComputed = 75,
310 SetProto = 76,
312 SetHomeObject = 77,
314 DefineArrayEl = 78,
316 Append = 79,
318 CopyDataProperties = 80,
320 DefineMethod = 81,
322 DefineMethodComputed = 82,
324 DefineClass = 83,
326 DefineClassComputed = 84,
328 GetLoc = 85,
330 PutLoc = 86,
332 SetLoc = 87,
334 GetArg = 88,
336 PutArg = 89,
338 SetArg = 90,
340 GetVarRef = 91,
342 PutVarRef = 92,
344 SetVarRef = 93,
346 SetLocUninitialized = 94,
348 GetLocCheck = 95,
350 PutLocCheck = 96,
352 SetLocCheck = 97,
354 PutLocCheckInit = 98,
356 GetLocCheckthis = 99,
358 GetVarRefCheck = 100,
360 PutVarRefCheck = 101,
362 PutVarRefCheckInit = 102,
364 CloseLoc = 103,
366 IfFalse = 104,
368 IfTrue = 105,
370 Goto = 106,
372 Catch = 107,
374 Gosub = 108,
376 Ret = 109,
378 NipCatch = 110,
380 ToObject = 111,
382 ToPropkey = 112,
384 WithGetVar = 113,
386 WithPutVar = 114,
388 WithDeleteVar = 115,
390 WithMakeRef = 116,
392 WithGetRef = 117,
394 MakeLocRef = 118,
396 MakeArgRef = 119,
398 MakeVarRefRef = 120,
400 MakeVarRef = 121,
402 ForInStart = 122,
404 ForOfStart = 123,
406 ForAwaitOfStart = 124,
408 ForInNext = 125,
410 ForOfNext = 126,
412 ForAwaitOfNext = 127,
414 IteratorCheckObject = 128,
416 IteratorGetValueDone = 129,
418 IteratorClose = 130,
420 IteratorNext = 131,
422 IteratorCall = 132,
424 InitialYield = 133,
426 Yield = 134,
428 YieldStar = 135,
430 AsyncYieldStar = 136,
432 Await = 137,
434 Neg = 138,
436 Plus = 139,
438 Dec = 140,
440 Inc = 141,
442 PostDec = 142,
444 PostInc = 143,
446 DecLoc = 144,
448 IncLoc = 145,
450 AddLoc = 146,
452 Not = 147,
454 Lnot = 148,
456 Typeof = 149,
458 Delete = 150,
460 DeleteVar = 151,
462 Mul = 152,
464 Div = 153,
466 Mod = 154,
468 Add = 155,
470 Sub = 156,
472 Pow = 157,
474 Shl = 158,
476 Sar = 159,
478 Shr = 160,
480 Lt = 161,
482 Lte = 162,
484 Gt = 163,
486 Gte = 164,
488 Instanceof = 165,
490 In = 166,
492 Eq = 167,
494 Neq = 168,
496 StrictEq = 169,
498 StrictNeq = 170,
500 And = 171,
502 Xor = 172,
504 Or = 173,
506 IsUndefinedOrNull = 174,
508 PrivateIn = 175,
510 PushBigintI32 = 176,
512 UsingDisposeInit = 177,
514 UsingDispose = 178,
516 UsingDisposeAsync = 179,
518 UsingDisposeMerge = 180,
520 UsingDisposeEnd = 181,
522 UsingCheck = 182,
524 Nop = 183,
526 PushMinus1 = 184,
528 Push0 = 185,
530 Push1 = 186,
532 Push2 = 187,
534 Push3 = 188,
536 Push4 = 189,
538 Push5 = 190,
540 Push6 = 191,
542 Push7 = 192,
544 PushI8 = 193,
546 PushI16 = 194,
548 PushConst8 = 195,
550 Fclosure8 = 196,
552 PushEmptyString = 197,
554 GetLoc8 = 198,
556 PutLoc8 = 199,
558 SetLoc8 = 200,
560 GetLoc0 = 201,
562 GetLoc1 = 202,
564 GetLoc2 = 203,
566 GetLoc3 = 204,
568 PutLoc0 = 205,
570 PutLoc1 = 206,
572 PutLoc2 = 207,
574 PutLoc3 = 208,
576 SetLoc0 = 209,
578 SetLoc1 = 210,
580 SetLoc2 = 211,
582 SetLoc3 = 212,
584 GetArg0 = 213,
586 GetArg1 = 214,
588 GetArg2 = 215,
590 GetArg3 = 216,
592 PutArg0 = 217,
594 PutArg1 = 218,
596 PutArg2 = 219,
598 PutArg3 = 220,
600 SetArg0 = 221,
602 SetArg1 = 222,
604 SetArg2 = 223,
606 SetArg3 = 224,
608 GetVarRef0 = 225,
610 GetVarRef1 = 226,
612 GetVarRef2 = 227,
614 GetVarRef3 = 228,
616 PutVarRef0 = 229,
618 PutVarRef1 = 230,
620 PutVarRef2 = 231,
622 PutVarRef3 = 232,
624 SetVarRef0 = 233,
626 SetVarRef1 = 234,
628 SetVarRef2 = 235,
630 SetVarRef3 = 236,
632 GetLength = 237,
634 IfFalse8 = 238,
636 IfTrue8 = 239,
638 Goto8 = 240,
640 Goto16 = 241,
642 Call0 = 242,
644 Call1 = 243,
646 Call2 = 244,
648 Call3 = 245,
650 IsUndefined = 246,
652 IsNull = 247,
654 TypeofIsUndefined = 248,
656 TypeofIsFunction = 249,
658 WithHasVar = 250,
660}
661
662pub const OP_COUNT: u8 = 251;
664
665#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
670#[repr(u8)]
671pub enum TempOpcode {
672 EnterScope = 1,
674 LeaveScope = 2,
676 Label = 3,
678 ScopeGetVarUndef = 4,
680 ScopeGetVar = 5,
682 ScopePutVar = 6,
684 ScopeDeleteVar = 7,
686 ScopeMakeRef = 8,
688 ScopeGetRef = 9,
690 ScopePutVarInit = 10,
692 ScopeGetVarCheckthis = 11,
694 ScopeGetPrivateField = 12,
696 ScopeGetPrivateField2 = 13,
698 ScopePutPrivateField = 14,
700 ScopeInPrivateField = 15,
702 GetFieldOptChain = 16,
704 GetArrayElOptChain = 17,
706 SetClassName = 18,
708 LineNum = 19,
710}
711
712impl Opcode {
713 pub fn info(self) -> OpInfo {
715 OP_INFO[self as usize]
716 }
717
718 pub fn name(self) -> &'static str {
720 self.info().name
721 }
722
723 pub fn size(self) -> u8 {
725 self.info().size
726 }
727
728 pub fn from_u8(byte: u8) -> Option<Opcode> {
730 OP_BY_BYTE.get(byte as usize).copied().flatten()
731 }
732
733 pub fn by_name(name: &str) -> Option<Opcode> {
735 OP_INFO
736 .iter()
737 .position(|info| info.name == name)
738 .map(|index| OP_ALL[index])
739 }
740}
741
742impl TempOpcode {
743 pub fn info(self) -> OpInfo {
745 TEMP_INFO[self as usize - TEMP_START]
746 }
747
748 pub fn name(self) -> &'static str {
750 self.info().name
751 }
752}
753
754const TEMP_START: usize = 1;
755
756impl Opcode {
757 pub fn specialised_index(self) -> Option<i32> {
763 use Opcode::*;
764 let byte = self as u32;
765 let base = |op: Opcode| op as u32;
766 if (base(PushMinus1)..=base(Push7)).contains(&byte) {
769 return Some(byte as i32 - base(Push0) as i32);
771 }
772 if (base(GetLoc0)..=base(SetLoc3)).contains(&byte) {
773 return Some(((byte - base(GetLoc0)) % 4) as i32);
774 }
775 if (base(GetArg0)..=base(SetArg3)).contains(&byte) {
776 return Some(((byte - base(GetArg0)) % 4) as i32);
777 }
778 if (base(GetVarRef0)..=base(SetVarRef3)).contains(&byte) {
779 return Some(((byte - base(GetVarRef0)) % 4) as i32);
780 }
781 if (base(Call0)..=base(Call3)).contains(&byte) {
782 return Some((byte - base(Call0)) as i32);
783 }
784 None
785 }
786
787 pub fn short_form(self, index: u32) -> Option<Opcode> {
792 use Opcode::*;
793 let base = match self {
794 PushI32 => Push0,
795 GetLoc => GetLoc0,
796 PutLoc => PutLoc0,
797 SetLoc => SetLoc0,
798 GetArg => GetArg0,
799 PutArg => PutArg0,
800 SetArg => SetArg0,
801 GetVarRef => GetVarRef0,
802 PutVarRef => PutVarRef0,
803 SetVarRef => SetVarRef0,
804 Call => Call0,
805 _ => return None,
806 };
807 if self == PushI32 {
808 if index == u32::MAX {
811 return Some(PushMinus1);
812 }
813 return if index <= 7 {
814 Opcode::from_u8(u8::try_from(Push0 as u32 + index).ok()?)
815 } else {
816 None
817 };
818 }
819 if index <= 3 {
825 return u8::try_from(base as u32 + index)
826 .ok()
827 .and_then(Opcode::from_u8);
828 }
829 if index <= 0xFF {
833 return match self {
834 GetLoc => Some(GetLoc8),
835 PutLoc => Some(PutLoc8),
836 SetLoc => Some(SetLoc8),
837 _ => None,
838 };
839 }
840 None
841 }
842}
843
844static OP_ALL: [Opcode; 251] = [
846 Opcode::Invalid,
847 Opcode::PushI32,
848 Opcode::PushConst,
849 Opcode::Fclosure,
850 Opcode::PushAtomValue,
851 Opcode::PrivateSymbol,
852 Opcode::Undefined,
853 Opcode::Null,
854 Opcode::PushThis,
855 Opcode::PushFalse,
856 Opcode::PushTrue,
857 Opcode::Object,
858 Opcode::SpecialObject,
859 Opcode::Rest,
860 Opcode::Drop,
861 Opcode::Nip,
862 Opcode::Nip1,
863 Opcode::Dup,
864 Opcode::Dup1,
865 Opcode::Dup2,
866 Opcode::Dup3,
867 Opcode::Insert2,
868 Opcode::Insert3,
869 Opcode::Insert4,
870 Opcode::Perm3,
871 Opcode::Perm4,
872 Opcode::Perm5,
873 Opcode::Swap,
874 Opcode::Swap2,
875 Opcode::Rot3l,
876 Opcode::Rot3r,
877 Opcode::Rot4l,
878 Opcode::Rot5l,
879 Opcode::CallConstructor,
880 Opcode::Call,
881 Opcode::TailCall,
882 Opcode::CallMethod,
883 Opcode::TailCallMethod,
884 Opcode::ArrayFrom,
885 Opcode::Apply,
886 Opcode::Return,
887 Opcode::ReturnUndef,
888 Opcode::CheckCtorReturn,
889 Opcode::CheckCtor,
890 Opcode::InitCtor,
891 Opcode::CheckBrand,
892 Opcode::AddBrand,
893 Opcode::ReturnAsync,
894 Opcode::Throw,
895 Opcode::ThrowError,
896 Opcode::Eval,
897 Opcode::ApplyEval,
898 Opcode::Regexp,
899 Opcode::GetSuper,
900 Opcode::Import,
901 Opcode::GetVarUndef,
902 Opcode::GetVar,
903 Opcode::PutVar,
904 Opcode::PutVarInit,
905 Opcode::GetRefValue,
906 Opcode::PutRefValue,
907 Opcode::GetField,
908 Opcode::GetField2,
909 Opcode::PutField,
910 Opcode::GetPrivateField,
911 Opcode::PutPrivateField,
912 Opcode::DefinePrivateField,
913 Opcode::GetArrayEl,
914 Opcode::GetArrayEl2,
915 Opcode::GetArrayEl3,
916 Opcode::PutArrayEl,
917 Opcode::GetSuperValue,
918 Opcode::PutSuperValue,
919 Opcode::DefineField,
920 Opcode::SetName,
921 Opcode::SetNameComputed,
922 Opcode::SetProto,
923 Opcode::SetHomeObject,
924 Opcode::DefineArrayEl,
925 Opcode::Append,
926 Opcode::CopyDataProperties,
927 Opcode::DefineMethod,
928 Opcode::DefineMethodComputed,
929 Opcode::DefineClass,
930 Opcode::DefineClassComputed,
931 Opcode::GetLoc,
932 Opcode::PutLoc,
933 Opcode::SetLoc,
934 Opcode::GetArg,
935 Opcode::PutArg,
936 Opcode::SetArg,
937 Opcode::GetVarRef,
938 Opcode::PutVarRef,
939 Opcode::SetVarRef,
940 Opcode::SetLocUninitialized,
941 Opcode::GetLocCheck,
942 Opcode::PutLocCheck,
943 Opcode::SetLocCheck,
944 Opcode::PutLocCheckInit,
945 Opcode::GetLocCheckthis,
946 Opcode::GetVarRefCheck,
947 Opcode::PutVarRefCheck,
948 Opcode::PutVarRefCheckInit,
949 Opcode::CloseLoc,
950 Opcode::IfFalse,
951 Opcode::IfTrue,
952 Opcode::Goto,
953 Opcode::Catch,
954 Opcode::Gosub,
955 Opcode::Ret,
956 Opcode::NipCatch,
957 Opcode::ToObject,
958 Opcode::ToPropkey,
959 Opcode::WithGetVar,
960 Opcode::WithPutVar,
961 Opcode::WithDeleteVar,
962 Opcode::WithMakeRef,
963 Opcode::WithGetRef,
964 Opcode::MakeLocRef,
965 Opcode::MakeArgRef,
966 Opcode::MakeVarRefRef,
967 Opcode::MakeVarRef,
968 Opcode::ForInStart,
969 Opcode::ForOfStart,
970 Opcode::ForAwaitOfStart,
971 Opcode::ForInNext,
972 Opcode::ForOfNext,
973 Opcode::ForAwaitOfNext,
974 Opcode::IteratorCheckObject,
975 Opcode::IteratorGetValueDone,
976 Opcode::IteratorClose,
977 Opcode::IteratorNext,
978 Opcode::IteratorCall,
979 Opcode::InitialYield,
980 Opcode::Yield,
981 Opcode::YieldStar,
982 Opcode::AsyncYieldStar,
983 Opcode::Await,
984 Opcode::Neg,
985 Opcode::Plus,
986 Opcode::Dec,
987 Opcode::Inc,
988 Opcode::PostDec,
989 Opcode::PostInc,
990 Opcode::DecLoc,
991 Opcode::IncLoc,
992 Opcode::AddLoc,
993 Opcode::Not,
994 Opcode::Lnot,
995 Opcode::Typeof,
996 Opcode::Delete,
997 Opcode::DeleteVar,
998 Opcode::Mul,
999 Opcode::Div,
1000 Opcode::Mod,
1001 Opcode::Add,
1002 Opcode::Sub,
1003 Opcode::Pow,
1004 Opcode::Shl,
1005 Opcode::Sar,
1006 Opcode::Shr,
1007 Opcode::Lt,
1008 Opcode::Lte,
1009 Opcode::Gt,
1010 Opcode::Gte,
1011 Opcode::Instanceof,
1012 Opcode::In,
1013 Opcode::Eq,
1014 Opcode::Neq,
1015 Opcode::StrictEq,
1016 Opcode::StrictNeq,
1017 Opcode::And,
1018 Opcode::Xor,
1019 Opcode::Or,
1020 Opcode::IsUndefinedOrNull,
1021 Opcode::PrivateIn,
1022 Opcode::PushBigintI32,
1023 Opcode::UsingDisposeInit,
1024 Opcode::UsingDispose,
1025 Opcode::UsingDisposeAsync,
1026 Opcode::UsingDisposeMerge,
1027 Opcode::UsingDisposeEnd,
1028 Opcode::UsingCheck,
1029 Opcode::Nop,
1030 Opcode::PushMinus1,
1031 Opcode::Push0,
1032 Opcode::Push1,
1033 Opcode::Push2,
1034 Opcode::Push3,
1035 Opcode::Push4,
1036 Opcode::Push5,
1037 Opcode::Push6,
1038 Opcode::Push7,
1039 Opcode::PushI8,
1040 Opcode::PushI16,
1041 Opcode::PushConst8,
1042 Opcode::Fclosure8,
1043 Opcode::PushEmptyString,
1044 Opcode::GetLoc8,
1045 Opcode::PutLoc8,
1046 Opcode::SetLoc8,
1047 Opcode::GetLoc0,
1048 Opcode::GetLoc1,
1049 Opcode::GetLoc2,
1050 Opcode::GetLoc3,
1051 Opcode::PutLoc0,
1052 Opcode::PutLoc1,
1053 Opcode::PutLoc2,
1054 Opcode::PutLoc3,
1055 Opcode::SetLoc0,
1056 Opcode::SetLoc1,
1057 Opcode::SetLoc2,
1058 Opcode::SetLoc3,
1059 Opcode::GetArg0,
1060 Opcode::GetArg1,
1061 Opcode::GetArg2,
1062 Opcode::GetArg3,
1063 Opcode::PutArg0,
1064 Opcode::PutArg1,
1065 Opcode::PutArg2,
1066 Opcode::PutArg3,
1067 Opcode::SetArg0,
1068 Opcode::SetArg1,
1069 Opcode::SetArg2,
1070 Opcode::SetArg3,
1071 Opcode::GetVarRef0,
1072 Opcode::GetVarRef1,
1073 Opcode::GetVarRef2,
1074 Opcode::GetVarRef3,
1075 Opcode::PutVarRef0,
1076 Opcode::PutVarRef1,
1077 Opcode::PutVarRef2,
1078 Opcode::PutVarRef3,
1079 Opcode::SetVarRef0,
1080 Opcode::SetVarRef1,
1081 Opcode::SetVarRef2,
1082 Opcode::SetVarRef3,
1083 Opcode::GetLength,
1084 Opcode::IfFalse8,
1085 Opcode::IfTrue8,
1086 Opcode::Goto8,
1087 Opcode::Goto16,
1088 Opcode::Call0,
1089 Opcode::Call1,
1090 Opcode::Call2,
1091 Opcode::Call3,
1092 Opcode::IsUndefined,
1093 Opcode::IsNull,
1094 Opcode::TypeofIsUndefined,
1095 Opcode::TypeofIsFunction,
1096 Opcode::WithHasVar,
1097];
1098
1099static OP_INFO: [OpInfo; 251] = [
1101 OpInfo {
1102 name: "invalid",
1103 size: 1,
1104 n_pop: 0,
1105 n_push: 0,
1106 format: OpFormat::None,
1107 },
1108 OpInfo {
1109 name: "push_i32",
1110 size: 5,
1111 n_pop: 0,
1112 n_push: 1,
1113 format: OpFormat::I32,
1114 },
1115 OpInfo {
1116 name: "push_const",
1117 size: 5,
1118 n_pop: 0,
1119 n_push: 1,
1120 format: OpFormat::Const,
1121 },
1122 OpInfo {
1123 name: "fclosure",
1124 size: 5,
1125 n_pop: 0,
1126 n_push: 1,
1127 format: OpFormat::Const,
1128 },
1129 OpInfo {
1130 name: "push_atom_value",
1131 size: 5,
1132 n_pop: 0,
1133 n_push: 1,
1134 format: OpFormat::Atom,
1135 },
1136 OpInfo {
1137 name: "private_symbol",
1138 size: 5,
1139 n_pop: 0,
1140 n_push: 1,
1141 format: OpFormat::Atom,
1142 },
1143 OpInfo {
1144 name: "undefined",
1145 size: 1,
1146 n_pop: 0,
1147 n_push: 1,
1148 format: OpFormat::None,
1149 },
1150 OpInfo {
1151 name: "null",
1152 size: 1,
1153 n_pop: 0,
1154 n_push: 1,
1155 format: OpFormat::None,
1156 },
1157 OpInfo {
1158 name: "push_this",
1159 size: 1,
1160 n_pop: 0,
1161 n_push: 1,
1162 format: OpFormat::None,
1163 },
1164 OpInfo {
1165 name: "push_false",
1166 size: 1,
1167 n_pop: 0,
1168 n_push: 1,
1169 format: OpFormat::None,
1170 },
1171 OpInfo {
1172 name: "push_true",
1173 size: 1,
1174 n_pop: 0,
1175 n_push: 1,
1176 format: OpFormat::None,
1177 },
1178 OpInfo {
1179 name: "object",
1180 size: 1,
1181 n_pop: 0,
1182 n_push: 1,
1183 format: OpFormat::None,
1184 },
1185 OpInfo {
1186 name: "special_object",
1187 size: 2,
1188 n_pop: 0,
1189 n_push: 1,
1190 format: OpFormat::U8,
1191 },
1192 OpInfo {
1193 name: "rest",
1194 size: 3,
1195 n_pop: 0,
1196 n_push: 1,
1197 format: OpFormat::U16,
1198 },
1199 OpInfo {
1200 name: "drop",
1201 size: 1,
1202 n_pop: 1,
1203 n_push: 0,
1204 format: OpFormat::None,
1205 },
1206 OpInfo {
1207 name: "nip",
1208 size: 1,
1209 n_pop: 2,
1210 n_push: 1,
1211 format: OpFormat::None,
1212 },
1213 OpInfo {
1214 name: "nip1",
1215 size: 1,
1216 n_pop: 3,
1217 n_push: 2,
1218 format: OpFormat::None,
1219 },
1220 OpInfo {
1221 name: "dup",
1222 size: 1,
1223 n_pop: 1,
1224 n_push: 2,
1225 format: OpFormat::None,
1226 },
1227 OpInfo {
1228 name: "dup1",
1229 size: 1,
1230 n_pop: 2,
1231 n_push: 3,
1232 format: OpFormat::None,
1233 },
1234 OpInfo {
1235 name: "dup2",
1236 size: 1,
1237 n_pop: 2,
1238 n_push: 4,
1239 format: OpFormat::None,
1240 },
1241 OpInfo {
1242 name: "dup3",
1243 size: 1,
1244 n_pop: 3,
1245 n_push: 6,
1246 format: OpFormat::None,
1247 },
1248 OpInfo {
1249 name: "insert2",
1250 size: 1,
1251 n_pop: 2,
1252 n_push: 3,
1253 format: OpFormat::None,
1254 },
1255 OpInfo {
1256 name: "insert3",
1257 size: 1,
1258 n_pop: 3,
1259 n_push: 4,
1260 format: OpFormat::None,
1261 },
1262 OpInfo {
1263 name: "insert4",
1264 size: 1,
1265 n_pop: 4,
1266 n_push: 5,
1267 format: OpFormat::None,
1268 },
1269 OpInfo {
1270 name: "perm3",
1271 size: 1,
1272 n_pop: 3,
1273 n_push: 3,
1274 format: OpFormat::None,
1275 },
1276 OpInfo {
1277 name: "perm4",
1278 size: 1,
1279 n_pop: 4,
1280 n_push: 4,
1281 format: OpFormat::None,
1282 },
1283 OpInfo {
1284 name: "perm5",
1285 size: 1,
1286 n_pop: 5,
1287 n_push: 5,
1288 format: OpFormat::None,
1289 },
1290 OpInfo {
1291 name: "swap",
1292 size: 1,
1293 n_pop: 2,
1294 n_push: 2,
1295 format: OpFormat::None,
1296 },
1297 OpInfo {
1298 name: "swap2",
1299 size: 1,
1300 n_pop: 4,
1301 n_push: 4,
1302 format: OpFormat::None,
1303 },
1304 OpInfo {
1305 name: "rot3l",
1306 size: 1,
1307 n_pop: 3,
1308 n_push: 3,
1309 format: OpFormat::None,
1310 },
1311 OpInfo {
1312 name: "rot3r",
1313 size: 1,
1314 n_pop: 3,
1315 n_push: 3,
1316 format: OpFormat::None,
1317 },
1318 OpInfo {
1319 name: "rot4l",
1320 size: 1,
1321 n_pop: 4,
1322 n_push: 4,
1323 format: OpFormat::None,
1324 },
1325 OpInfo {
1326 name: "rot5l",
1327 size: 1,
1328 n_pop: 5,
1329 n_push: 5,
1330 format: OpFormat::None,
1331 },
1332 OpInfo {
1333 name: "call_constructor",
1334 size: 3,
1335 n_pop: 2,
1336 n_push: 1,
1337 format: OpFormat::Npop,
1338 },
1339 OpInfo {
1340 name: "call",
1341 size: 3,
1342 n_pop: 1,
1343 n_push: 1,
1344 format: OpFormat::Npop,
1345 },
1346 OpInfo {
1347 name: "tail_call",
1348 size: 3,
1349 n_pop: 1,
1350 n_push: 0,
1351 format: OpFormat::Npop,
1352 },
1353 OpInfo {
1354 name: "call_method",
1355 size: 3,
1356 n_pop: 2,
1357 n_push: 1,
1358 format: OpFormat::Npop,
1359 },
1360 OpInfo {
1361 name: "tail_call_method",
1362 size: 3,
1363 n_pop: 2,
1364 n_push: 0,
1365 format: OpFormat::Npop,
1366 },
1367 OpInfo {
1368 name: "array_from",
1369 size: 3,
1370 n_pop: 0,
1371 n_push: 1,
1372 format: OpFormat::Npop,
1373 },
1374 OpInfo {
1375 name: "apply",
1376 size: 3,
1377 n_pop: 3,
1378 n_push: 1,
1379 format: OpFormat::U16,
1380 },
1381 OpInfo {
1382 name: "return",
1383 size: 1,
1384 n_pop: 1,
1385 n_push: 0,
1386 format: OpFormat::None,
1387 },
1388 OpInfo {
1389 name: "return_undef",
1390 size: 1,
1391 n_pop: 0,
1392 n_push: 0,
1393 format: OpFormat::None,
1394 },
1395 OpInfo {
1396 name: "check_ctor_return",
1397 size: 1,
1398 n_pop: 1,
1399 n_push: 2,
1400 format: OpFormat::None,
1401 },
1402 OpInfo {
1403 name: "check_ctor",
1404 size: 1,
1405 n_pop: 0,
1406 n_push: 0,
1407 format: OpFormat::None,
1408 },
1409 OpInfo {
1410 name: "init_ctor",
1411 size: 1,
1412 n_pop: 0,
1413 n_push: 1,
1414 format: OpFormat::None,
1415 },
1416 OpInfo {
1417 name: "check_brand",
1418 size: 1,
1419 n_pop: 2,
1420 n_push: 2,
1421 format: OpFormat::None,
1422 },
1423 OpInfo {
1424 name: "add_brand",
1425 size: 1,
1426 n_pop: 2,
1427 n_push: 0,
1428 format: OpFormat::None,
1429 },
1430 OpInfo {
1431 name: "return_async",
1432 size: 1,
1433 n_pop: 1,
1434 n_push: 0,
1435 format: OpFormat::None,
1436 },
1437 OpInfo {
1438 name: "throw",
1439 size: 1,
1440 n_pop: 1,
1441 n_push: 0,
1442 format: OpFormat::None,
1443 },
1444 OpInfo {
1445 name: "throw_error",
1446 size: 6,
1447 n_pop: 0,
1448 n_push: 0,
1449 format: OpFormat::AtomU8,
1450 },
1451 OpInfo {
1452 name: "eval",
1453 size: 5,
1454 n_pop: 1,
1455 n_push: 1,
1456 format: OpFormat::NpopU16,
1457 },
1458 OpInfo {
1459 name: "apply_eval",
1460 size: 3,
1461 n_pop: 2,
1462 n_push: 1,
1463 format: OpFormat::U16,
1464 },
1465 OpInfo {
1466 name: "regexp",
1467 size: 1,
1468 n_pop: 2,
1469 n_push: 1,
1470 format: OpFormat::None,
1471 },
1472 OpInfo {
1473 name: "get_super",
1474 size: 1,
1475 n_pop: 1,
1476 n_push: 1,
1477 format: OpFormat::None,
1478 },
1479 OpInfo {
1480 name: "import",
1481 size: 1,
1482 n_pop: 2,
1483 n_push: 1,
1484 format: OpFormat::None,
1485 },
1486 OpInfo {
1487 name: "get_var_undef",
1488 size: 3,
1489 n_pop: 0,
1490 n_push: 1,
1491 format: OpFormat::VarRef,
1492 },
1493 OpInfo {
1494 name: "get_var",
1495 size: 3,
1496 n_pop: 0,
1497 n_push: 1,
1498 format: OpFormat::VarRef,
1499 },
1500 OpInfo {
1501 name: "put_var",
1502 size: 3,
1503 n_pop: 1,
1504 n_push: 0,
1505 format: OpFormat::VarRef,
1506 },
1507 OpInfo {
1508 name: "put_var_init",
1509 size: 3,
1510 n_pop: 1,
1511 n_push: 0,
1512 format: OpFormat::VarRef,
1513 },
1514 OpInfo {
1515 name: "get_ref_value",
1516 size: 1,
1517 n_pop: 0,
1518 n_push: 1,
1519 format: OpFormat::None,
1520 },
1521 OpInfo {
1522 name: "put_ref_value",
1523 size: 1,
1524 n_pop: 2,
1525 n_push: 0,
1526 format: OpFormat::None,
1527 },
1528 OpInfo {
1529 name: "get_field",
1530 size: 5,
1531 n_pop: 1,
1532 n_push: 1,
1533 format: OpFormat::Atom,
1534 },
1535 OpInfo {
1536 name: "get_field2",
1537 size: 5,
1538 n_pop: 1,
1539 n_push: 2,
1540 format: OpFormat::Atom,
1541 },
1542 OpInfo {
1543 name: "put_field",
1544 size: 5,
1545 n_pop: 2,
1546 n_push: 0,
1547 format: OpFormat::Atom,
1548 },
1549 OpInfo {
1550 name: "get_private_field",
1551 size: 1,
1552 n_pop: 2,
1553 n_push: 1,
1554 format: OpFormat::None,
1555 },
1556 OpInfo {
1557 name: "put_private_field",
1558 size: 1,
1559 n_pop: 3,
1560 n_push: 0,
1561 format: OpFormat::None,
1562 },
1563 OpInfo {
1564 name: "define_private_field",
1565 size: 1,
1566 n_pop: 3,
1567 n_push: 1,
1568 format: OpFormat::None,
1569 },
1570 OpInfo {
1571 name: "get_array_el",
1572 size: 1,
1573 n_pop: 2,
1574 n_push: 1,
1575 format: OpFormat::None,
1576 },
1577 OpInfo {
1578 name: "get_array_el2",
1579 size: 1,
1580 n_pop: 2,
1581 n_push: 2,
1582 format: OpFormat::None,
1583 },
1584 OpInfo {
1585 name: "get_array_el3",
1586 size: 1,
1587 n_pop: 2,
1588 n_push: 3,
1589 format: OpFormat::None,
1590 },
1591 OpInfo {
1592 name: "put_array_el",
1593 size: 1,
1594 n_pop: 3,
1595 n_push: 0,
1596 format: OpFormat::None,
1597 },
1598 OpInfo {
1599 name: "get_super_value",
1600 size: 1,
1601 n_pop: 3,
1602 n_push: 1,
1603 format: OpFormat::None,
1604 },
1605 OpInfo {
1606 name: "put_super_value",
1607 size: 1,
1608 n_pop: 4,
1609 n_push: 0,
1610 format: OpFormat::None,
1611 },
1612 OpInfo {
1613 name: "define_field",
1614 size: 5,
1615 n_pop: 2,
1616 n_push: 1,
1617 format: OpFormat::Atom,
1618 },
1619 OpInfo {
1620 name: "set_name",
1621 size: 5,
1622 n_pop: 1,
1623 n_push: 1,
1624 format: OpFormat::Atom,
1625 },
1626 OpInfo {
1627 name: "set_name_computed",
1628 size: 1,
1629 n_pop: 2,
1630 n_push: 2,
1631 format: OpFormat::None,
1632 },
1633 OpInfo {
1634 name: "set_proto",
1635 size: 1,
1636 n_pop: 2,
1637 n_push: 1,
1638 format: OpFormat::None,
1639 },
1640 OpInfo {
1641 name: "set_home_object",
1642 size: 1,
1643 n_pop: 2,
1644 n_push: 2,
1645 format: OpFormat::None,
1646 },
1647 OpInfo {
1648 name: "define_array_el",
1649 size: 1,
1650 n_pop: 3,
1651 n_push: 2,
1652 format: OpFormat::None,
1653 },
1654 OpInfo {
1655 name: "append",
1656 size: 1,
1657 n_pop: 3,
1658 n_push: 2,
1659 format: OpFormat::None,
1660 },
1661 OpInfo {
1662 name: "copy_data_properties",
1663 size: 2,
1664 n_pop: 3,
1665 n_push: 3,
1666 format: OpFormat::U8,
1667 },
1668 OpInfo {
1669 name: "define_method",
1670 size: 6,
1671 n_pop: 2,
1672 n_push: 1,
1673 format: OpFormat::AtomU8,
1674 },
1675 OpInfo {
1676 name: "define_method_computed",
1677 size: 2,
1678 n_pop: 3,
1679 n_push: 1,
1680 format: OpFormat::U8,
1681 },
1682 OpInfo {
1683 name: "define_class",
1684 size: 6,
1685 n_pop: 2,
1686 n_push: 2,
1687 format: OpFormat::AtomU8,
1688 },
1689 OpInfo {
1690 name: "define_class_computed",
1691 size: 6,
1692 n_pop: 3,
1693 n_push: 3,
1694 format: OpFormat::AtomU8,
1695 },
1696 OpInfo {
1697 name: "get_loc",
1698 size: 3,
1699 n_pop: 0,
1700 n_push: 1,
1701 format: OpFormat::Loc,
1702 },
1703 OpInfo {
1704 name: "put_loc",
1705 size: 3,
1706 n_pop: 1,
1707 n_push: 0,
1708 format: OpFormat::Loc,
1709 },
1710 OpInfo {
1711 name: "set_loc",
1712 size: 3,
1713 n_pop: 1,
1714 n_push: 1,
1715 format: OpFormat::Loc,
1716 },
1717 OpInfo {
1718 name: "get_arg",
1719 size: 3,
1720 n_pop: 0,
1721 n_push: 1,
1722 format: OpFormat::Arg,
1723 },
1724 OpInfo {
1725 name: "put_arg",
1726 size: 3,
1727 n_pop: 1,
1728 n_push: 0,
1729 format: OpFormat::Arg,
1730 },
1731 OpInfo {
1732 name: "set_arg",
1733 size: 3,
1734 n_pop: 1,
1735 n_push: 1,
1736 format: OpFormat::Arg,
1737 },
1738 OpInfo {
1739 name: "get_var_ref",
1740 size: 3,
1741 n_pop: 0,
1742 n_push: 1,
1743 format: OpFormat::VarRef,
1744 },
1745 OpInfo {
1746 name: "put_var_ref",
1747 size: 3,
1748 n_pop: 1,
1749 n_push: 0,
1750 format: OpFormat::VarRef,
1751 },
1752 OpInfo {
1753 name: "set_var_ref",
1754 size: 3,
1755 n_pop: 1,
1756 n_push: 1,
1757 format: OpFormat::VarRef,
1758 },
1759 OpInfo {
1760 name: "set_loc_uninitialized",
1761 size: 3,
1762 n_pop: 0,
1763 n_push: 0,
1764 format: OpFormat::Loc,
1765 },
1766 OpInfo {
1767 name: "get_loc_check",
1768 size: 3,
1769 n_pop: 0,
1770 n_push: 1,
1771 format: OpFormat::Loc,
1772 },
1773 OpInfo {
1774 name: "put_loc_check",
1775 size: 3,
1776 n_pop: 1,
1777 n_push: 0,
1778 format: OpFormat::Loc,
1779 },
1780 OpInfo {
1781 name: "set_loc_check",
1782 size: 3,
1783 n_pop: 1,
1784 n_push: 1,
1785 format: OpFormat::Loc,
1786 },
1787 OpInfo {
1788 name: "put_loc_check_init",
1789 size: 3,
1790 n_pop: 1,
1791 n_push: 0,
1792 format: OpFormat::Loc,
1793 },
1794 OpInfo {
1795 name: "get_loc_checkthis",
1796 size: 3,
1797 n_pop: 0,
1798 n_push: 1,
1799 format: OpFormat::Loc,
1800 },
1801 OpInfo {
1802 name: "get_var_ref_check",
1803 size: 3,
1804 n_pop: 0,
1805 n_push: 1,
1806 format: OpFormat::VarRef,
1807 },
1808 OpInfo {
1809 name: "put_var_ref_check",
1810 size: 3,
1811 n_pop: 1,
1812 n_push: 0,
1813 format: OpFormat::VarRef,
1814 },
1815 OpInfo {
1816 name: "put_var_ref_check_init",
1817 size: 3,
1818 n_pop: 1,
1819 n_push: 0,
1820 format: OpFormat::VarRef,
1821 },
1822 OpInfo {
1823 name: "close_loc",
1824 size: 3,
1825 n_pop: 0,
1826 n_push: 0,
1827 format: OpFormat::Loc,
1828 },
1829 OpInfo {
1830 name: "if_false",
1831 size: 5,
1832 n_pop: 1,
1833 n_push: 0,
1834 format: OpFormat::Label,
1835 },
1836 OpInfo {
1837 name: "if_true",
1838 size: 5,
1839 n_pop: 1,
1840 n_push: 0,
1841 format: OpFormat::Label,
1842 },
1843 OpInfo {
1844 name: "goto",
1845 size: 5,
1846 n_pop: 0,
1847 n_push: 0,
1848 format: OpFormat::Label,
1849 },
1850 OpInfo {
1851 name: "catch",
1852 size: 5,
1853 n_pop: 0,
1854 n_push: 1,
1855 format: OpFormat::Label,
1856 },
1857 OpInfo {
1858 name: "gosub",
1859 size: 5,
1860 n_pop: 0,
1861 n_push: 0,
1862 format: OpFormat::Label,
1863 },
1864 OpInfo {
1865 name: "ret",
1866 size: 1,
1867 n_pop: 1,
1868 n_push: 0,
1869 format: OpFormat::None,
1870 },
1871 OpInfo {
1872 name: "nip_catch",
1873 size: 1,
1874 n_pop: 2,
1875 n_push: 1,
1876 format: OpFormat::None,
1877 },
1878 OpInfo {
1879 name: "to_object",
1880 size: 1,
1881 n_pop: 1,
1882 n_push: 1,
1883 format: OpFormat::None,
1884 },
1885 OpInfo {
1886 name: "to_propkey",
1887 size: 1,
1888 n_pop: 1,
1889 n_push: 1,
1890 format: OpFormat::None,
1891 },
1892 OpInfo {
1893 name: "with_get_var",
1894 size: 5,
1895 n_pop: 1,
1896 n_push: 1,
1897 format: OpFormat::Atom,
1898 },
1899 OpInfo {
1900 name: "with_put_var",
1901 size: 5,
1902 n_pop: 2,
1903 n_push: 0,
1904 format: OpFormat::Atom,
1905 },
1906 OpInfo {
1907 name: "with_delete_var",
1908 size: 10,
1909 n_pop: 1,
1910 n_push: 0,
1911 format: OpFormat::AtomLabelU8,
1912 },
1913 OpInfo {
1914 name: "with_make_ref",
1915 size: 10,
1916 n_pop: 1,
1917 n_push: 0,
1918 format: OpFormat::AtomLabelU8,
1919 },
1920 OpInfo {
1921 name: "with_get_ref",
1922 size: 10,
1923 n_pop: 1,
1924 n_push: 0,
1925 format: OpFormat::AtomLabelU8,
1926 },
1927 OpInfo {
1928 name: "make_loc_ref",
1929 size: 7,
1930 n_pop: 0,
1931 n_push: 1,
1932 format: OpFormat::AtomU16,
1933 },
1934 OpInfo {
1935 name: "make_arg_ref",
1936 size: 7,
1937 n_pop: 0,
1938 n_push: 1,
1939 format: OpFormat::AtomU16,
1940 },
1941 OpInfo {
1942 name: "make_var_ref_ref",
1943 size: 7,
1944 n_pop: 0,
1945 n_push: 1,
1946 format: OpFormat::AtomU16,
1947 },
1948 OpInfo {
1949 name: "make_var_ref",
1950 size: 5,
1951 n_pop: 0,
1952 n_push: 1,
1953 format: OpFormat::Atom,
1954 },
1955 OpInfo {
1956 name: "for_in_start",
1957 size: 1,
1958 n_pop: 1,
1959 n_push: 1,
1960 format: OpFormat::None,
1961 },
1962 OpInfo {
1963 name: "for_of_start",
1964 size: 1,
1965 n_pop: 1,
1966 n_push: 3,
1967 format: OpFormat::None,
1968 },
1969 OpInfo {
1970 name: "for_await_of_start",
1971 size: 1,
1972 n_pop: 1,
1973 n_push: 3,
1974 format: OpFormat::None,
1975 },
1976 OpInfo {
1977 name: "for_in_next",
1978 size: 1,
1979 n_pop: 1,
1980 n_push: 3,
1981 format: OpFormat::None,
1982 },
1983 OpInfo {
1984 name: "for_of_next",
1985 size: 2,
1986 n_pop: 3,
1987 n_push: 5,
1988 format: OpFormat::U8,
1989 },
1990 OpInfo {
1991 name: "for_await_of_next",
1992 size: 1,
1993 n_pop: 3,
1994 n_push: 4,
1995 format: OpFormat::None,
1996 },
1997 OpInfo {
1998 name: "iterator_check_object",
1999 size: 1,
2000 n_pop: 1,
2001 n_push: 1,
2002 format: OpFormat::None,
2003 },
2004 OpInfo {
2005 name: "iterator_get_value_done",
2006 size: 1,
2007 n_pop: 2,
2008 n_push: 3,
2009 format: OpFormat::None,
2010 },
2011 OpInfo {
2012 name: "iterator_close",
2013 size: 1,
2014 n_pop: 3,
2015 n_push: 0,
2016 format: OpFormat::None,
2017 },
2018 OpInfo {
2019 name: "iterator_next",
2020 size: 1,
2021 n_pop: 4,
2022 n_push: 4,
2023 format: OpFormat::None,
2024 },
2025 OpInfo {
2026 name: "iterator_call",
2027 size: 2,
2028 n_pop: 4,
2029 n_push: 5,
2030 format: OpFormat::U8,
2031 },
2032 OpInfo {
2033 name: "initial_yield",
2034 size: 1,
2035 n_pop: 0,
2036 n_push: 0,
2037 format: OpFormat::None,
2038 },
2039 OpInfo {
2040 name: "yield",
2041 size: 1,
2042 n_pop: 1,
2043 n_push: 2,
2044 format: OpFormat::None,
2045 },
2046 OpInfo {
2047 name: "yield_star",
2048 size: 1,
2049 n_pop: 1,
2050 n_push: 2,
2051 format: OpFormat::None,
2052 },
2053 OpInfo {
2054 name: "async_yield_star",
2055 size: 1,
2056 n_pop: 1,
2057 n_push: 2,
2058 format: OpFormat::None,
2059 },
2060 OpInfo {
2061 name: "await",
2062 size: 1,
2063 n_pop: 1,
2064 n_push: 1,
2065 format: OpFormat::None,
2066 },
2067 OpInfo {
2068 name: "neg",
2069 size: 1,
2070 n_pop: 1,
2071 n_push: 1,
2072 format: OpFormat::None,
2073 },
2074 OpInfo {
2075 name: "plus",
2076 size: 1,
2077 n_pop: 1,
2078 n_push: 1,
2079 format: OpFormat::None,
2080 },
2081 OpInfo {
2082 name: "dec",
2083 size: 1,
2084 n_pop: 1,
2085 n_push: 1,
2086 format: OpFormat::None,
2087 },
2088 OpInfo {
2089 name: "inc",
2090 size: 1,
2091 n_pop: 1,
2092 n_push: 1,
2093 format: OpFormat::None,
2094 },
2095 OpInfo {
2096 name: "post_dec",
2097 size: 1,
2098 n_pop: 1,
2099 n_push: 2,
2100 format: OpFormat::None,
2101 },
2102 OpInfo {
2103 name: "post_inc",
2104 size: 1,
2105 n_pop: 1,
2106 n_push: 2,
2107 format: OpFormat::None,
2108 },
2109 OpInfo {
2110 name: "dec_loc",
2111 size: 2,
2112 n_pop: 0,
2113 n_push: 0,
2114 format: OpFormat::Loc8,
2115 },
2116 OpInfo {
2117 name: "inc_loc",
2118 size: 2,
2119 n_pop: 0,
2120 n_push: 0,
2121 format: OpFormat::Loc8,
2122 },
2123 OpInfo {
2124 name: "add_loc",
2125 size: 2,
2126 n_pop: 1,
2127 n_push: 0,
2128 format: OpFormat::Loc8,
2129 },
2130 OpInfo {
2131 name: "not",
2132 size: 1,
2133 n_pop: 1,
2134 n_push: 1,
2135 format: OpFormat::None,
2136 },
2137 OpInfo {
2138 name: "lnot",
2139 size: 1,
2140 n_pop: 1,
2141 n_push: 1,
2142 format: OpFormat::None,
2143 },
2144 OpInfo {
2145 name: "typeof",
2146 size: 1,
2147 n_pop: 1,
2148 n_push: 1,
2149 format: OpFormat::None,
2150 },
2151 OpInfo {
2152 name: "delete",
2153 size: 1,
2154 n_pop: 2,
2155 n_push: 1,
2156 format: OpFormat::None,
2157 },
2158 OpInfo {
2159 name: "delete_var",
2160 size: 5,
2161 n_pop: 0,
2162 n_push: 1,
2163 format: OpFormat::Atom,
2164 },
2165 OpInfo {
2166 name: "mul",
2167 size: 1,
2168 n_pop: 2,
2169 n_push: 1,
2170 format: OpFormat::None,
2171 },
2172 OpInfo {
2173 name: "div",
2174 size: 1,
2175 n_pop: 2,
2176 n_push: 1,
2177 format: OpFormat::None,
2178 },
2179 OpInfo {
2180 name: "mod",
2181 size: 1,
2182 n_pop: 2,
2183 n_push: 1,
2184 format: OpFormat::None,
2185 },
2186 OpInfo {
2187 name: "add",
2188 size: 1,
2189 n_pop: 2,
2190 n_push: 1,
2191 format: OpFormat::None,
2192 },
2193 OpInfo {
2194 name: "sub",
2195 size: 1,
2196 n_pop: 2,
2197 n_push: 1,
2198 format: OpFormat::None,
2199 },
2200 OpInfo {
2201 name: "pow",
2202 size: 1,
2203 n_pop: 2,
2204 n_push: 1,
2205 format: OpFormat::None,
2206 },
2207 OpInfo {
2208 name: "shl",
2209 size: 1,
2210 n_pop: 2,
2211 n_push: 1,
2212 format: OpFormat::None,
2213 },
2214 OpInfo {
2215 name: "sar",
2216 size: 1,
2217 n_pop: 2,
2218 n_push: 1,
2219 format: OpFormat::None,
2220 },
2221 OpInfo {
2222 name: "shr",
2223 size: 1,
2224 n_pop: 2,
2225 n_push: 1,
2226 format: OpFormat::None,
2227 },
2228 OpInfo {
2229 name: "lt",
2230 size: 1,
2231 n_pop: 2,
2232 n_push: 1,
2233 format: OpFormat::None,
2234 },
2235 OpInfo {
2236 name: "lte",
2237 size: 1,
2238 n_pop: 2,
2239 n_push: 1,
2240 format: OpFormat::None,
2241 },
2242 OpInfo {
2243 name: "gt",
2244 size: 1,
2245 n_pop: 2,
2246 n_push: 1,
2247 format: OpFormat::None,
2248 },
2249 OpInfo {
2250 name: "gte",
2251 size: 1,
2252 n_pop: 2,
2253 n_push: 1,
2254 format: OpFormat::None,
2255 },
2256 OpInfo {
2257 name: "instanceof",
2258 size: 1,
2259 n_pop: 2,
2260 n_push: 1,
2261 format: OpFormat::None,
2262 },
2263 OpInfo {
2264 name: "in",
2265 size: 1,
2266 n_pop: 2,
2267 n_push: 1,
2268 format: OpFormat::None,
2269 },
2270 OpInfo {
2271 name: "eq",
2272 size: 1,
2273 n_pop: 2,
2274 n_push: 1,
2275 format: OpFormat::None,
2276 },
2277 OpInfo {
2278 name: "neq",
2279 size: 1,
2280 n_pop: 2,
2281 n_push: 1,
2282 format: OpFormat::None,
2283 },
2284 OpInfo {
2285 name: "strict_eq",
2286 size: 1,
2287 n_pop: 2,
2288 n_push: 1,
2289 format: OpFormat::None,
2290 },
2291 OpInfo {
2292 name: "strict_neq",
2293 size: 1,
2294 n_pop: 2,
2295 n_push: 1,
2296 format: OpFormat::None,
2297 },
2298 OpInfo {
2299 name: "and",
2300 size: 1,
2301 n_pop: 2,
2302 n_push: 1,
2303 format: OpFormat::None,
2304 },
2305 OpInfo {
2306 name: "xor",
2307 size: 1,
2308 n_pop: 2,
2309 n_push: 1,
2310 format: OpFormat::None,
2311 },
2312 OpInfo {
2313 name: "or",
2314 size: 1,
2315 n_pop: 2,
2316 n_push: 1,
2317 format: OpFormat::None,
2318 },
2319 OpInfo {
2320 name: "is_undefined_or_null",
2321 size: 1,
2322 n_pop: 1,
2323 n_push: 1,
2324 format: OpFormat::None,
2325 },
2326 OpInfo {
2327 name: "private_in",
2328 size: 1,
2329 n_pop: 2,
2330 n_push: 1,
2331 format: OpFormat::None,
2332 },
2333 OpInfo {
2334 name: "push_bigint_i32",
2335 size: 5,
2336 n_pop: 0,
2337 n_push: 1,
2338 format: OpFormat::I32,
2339 },
2340 OpInfo {
2341 name: "using_dispose_init",
2342 size: 1,
2343 n_pop: 0,
2344 n_push: 1,
2345 format: OpFormat::None,
2346 },
2347 OpInfo {
2348 name: "using_dispose",
2349 size: 3,
2350 n_pop: 1,
2351 n_push: 1,
2352 format: OpFormat::Loc,
2353 },
2354 OpInfo {
2355 name: "using_dispose_async",
2356 size: 3,
2357 n_pop: 0,
2358 n_push: 1,
2359 format: OpFormat::Loc,
2360 },
2361 OpInfo {
2362 name: "using_dispose_merge",
2363 size: 1,
2364 n_pop: 2,
2365 n_push: 1,
2366 format: OpFormat::None,
2367 },
2368 OpInfo {
2369 name: "using_dispose_end",
2370 size: 1,
2371 n_pop: 1,
2372 n_push: 0,
2373 format: OpFormat::None,
2374 },
2375 OpInfo {
2376 name: "using_check",
2377 size: 2,
2378 n_pop: 1,
2379 n_push: 2,
2380 format: OpFormat::U8,
2381 },
2382 OpInfo {
2383 name: "nop",
2384 size: 1,
2385 n_pop: 0,
2386 n_push: 0,
2387 format: OpFormat::None,
2388 },
2389 OpInfo {
2390 name: "push_minus1",
2391 size: 1,
2392 n_pop: 0,
2393 n_push: 1,
2394 format: OpFormat::NoneInt,
2395 },
2396 OpInfo {
2397 name: "push_0",
2398 size: 1,
2399 n_pop: 0,
2400 n_push: 1,
2401 format: OpFormat::NoneInt,
2402 },
2403 OpInfo {
2404 name: "push_1",
2405 size: 1,
2406 n_pop: 0,
2407 n_push: 1,
2408 format: OpFormat::NoneInt,
2409 },
2410 OpInfo {
2411 name: "push_2",
2412 size: 1,
2413 n_pop: 0,
2414 n_push: 1,
2415 format: OpFormat::NoneInt,
2416 },
2417 OpInfo {
2418 name: "push_3",
2419 size: 1,
2420 n_pop: 0,
2421 n_push: 1,
2422 format: OpFormat::NoneInt,
2423 },
2424 OpInfo {
2425 name: "push_4",
2426 size: 1,
2427 n_pop: 0,
2428 n_push: 1,
2429 format: OpFormat::NoneInt,
2430 },
2431 OpInfo {
2432 name: "push_5",
2433 size: 1,
2434 n_pop: 0,
2435 n_push: 1,
2436 format: OpFormat::NoneInt,
2437 },
2438 OpInfo {
2439 name: "push_6",
2440 size: 1,
2441 n_pop: 0,
2442 n_push: 1,
2443 format: OpFormat::NoneInt,
2444 },
2445 OpInfo {
2446 name: "push_7",
2447 size: 1,
2448 n_pop: 0,
2449 n_push: 1,
2450 format: OpFormat::NoneInt,
2451 },
2452 OpInfo {
2453 name: "push_i8",
2454 size: 2,
2455 n_pop: 0,
2456 n_push: 1,
2457 format: OpFormat::I8,
2458 },
2459 OpInfo {
2460 name: "push_i16",
2461 size: 3,
2462 n_pop: 0,
2463 n_push: 1,
2464 format: OpFormat::I16,
2465 },
2466 OpInfo {
2467 name: "push_const8",
2468 size: 2,
2469 n_pop: 0,
2470 n_push: 1,
2471 format: OpFormat::Const8,
2472 },
2473 OpInfo {
2474 name: "fclosure8",
2475 size: 2,
2476 n_pop: 0,
2477 n_push: 1,
2478 format: OpFormat::Const8,
2479 },
2480 OpInfo {
2481 name: "push_empty_string",
2482 size: 1,
2483 n_pop: 0,
2484 n_push: 1,
2485 format: OpFormat::None,
2486 },
2487 OpInfo {
2488 name: "get_loc8",
2489 size: 2,
2490 n_pop: 0,
2491 n_push: 1,
2492 format: OpFormat::Loc8,
2493 },
2494 OpInfo {
2495 name: "put_loc8",
2496 size: 2,
2497 n_pop: 1,
2498 n_push: 0,
2499 format: OpFormat::Loc8,
2500 },
2501 OpInfo {
2502 name: "set_loc8",
2503 size: 2,
2504 n_pop: 1,
2505 n_push: 1,
2506 format: OpFormat::Loc8,
2507 },
2508 OpInfo {
2509 name: "get_loc0",
2510 size: 1,
2511 n_pop: 0,
2512 n_push: 1,
2513 format: OpFormat::NoneLoc,
2514 },
2515 OpInfo {
2516 name: "get_loc1",
2517 size: 1,
2518 n_pop: 0,
2519 n_push: 1,
2520 format: OpFormat::NoneLoc,
2521 },
2522 OpInfo {
2523 name: "get_loc2",
2524 size: 1,
2525 n_pop: 0,
2526 n_push: 1,
2527 format: OpFormat::NoneLoc,
2528 },
2529 OpInfo {
2530 name: "get_loc3",
2531 size: 1,
2532 n_pop: 0,
2533 n_push: 1,
2534 format: OpFormat::NoneLoc,
2535 },
2536 OpInfo {
2537 name: "put_loc0",
2538 size: 1,
2539 n_pop: 1,
2540 n_push: 0,
2541 format: OpFormat::NoneLoc,
2542 },
2543 OpInfo {
2544 name: "put_loc1",
2545 size: 1,
2546 n_pop: 1,
2547 n_push: 0,
2548 format: OpFormat::NoneLoc,
2549 },
2550 OpInfo {
2551 name: "put_loc2",
2552 size: 1,
2553 n_pop: 1,
2554 n_push: 0,
2555 format: OpFormat::NoneLoc,
2556 },
2557 OpInfo {
2558 name: "put_loc3",
2559 size: 1,
2560 n_pop: 1,
2561 n_push: 0,
2562 format: OpFormat::NoneLoc,
2563 },
2564 OpInfo {
2565 name: "set_loc0",
2566 size: 1,
2567 n_pop: 1,
2568 n_push: 1,
2569 format: OpFormat::NoneLoc,
2570 },
2571 OpInfo {
2572 name: "set_loc1",
2573 size: 1,
2574 n_pop: 1,
2575 n_push: 1,
2576 format: OpFormat::NoneLoc,
2577 },
2578 OpInfo {
2579 name: "set_loc2",
2580 size: 1,
2581 n_pop: 1,
2582 n_push: 1,
2583 format: OpFormat::NoneLoc,
2584 },
2585 OpInfo {
2586 name: "set_loc3",
2587 size: 1,
2588 n_pop: 1,
2589 n_push: 1,
2590 format: OpFormat::NoneLoc,
2591 },
2592 OpInfo {
2593 name: "get_arg0",
2594 size: 1,
2595 n_pop: 0,
2596 n_push: 1,
2597 format: OpFormat::NoneArg,
2598 },
2599 OpInfo {
2600 name: "get_arg1",
2601 size: 1,
2602 n_pop: 0,
2603 n_push: 1,
2604 format: OpFormat::NoneArg,
2605 },
2606 OpInfo {
2607 name: "get_arg2",
2608 size: 1,
2609 n_pop: 0,
2610 n_push: 1,
2611 format: OpFormat::NoneArg,
2612 },
2613 OpInfo {
2614 name: "get_arg3",
2615 size: 1,
2616 n_pop: 0,
2617 n_push: 1,
2618 format: OpFormat::NoneArg,
2619 },
2620 OpInfo {
2621 name: "put_arg0",
2622 size: 1,
2623 n_pop: 1,
2624 n_push: 0,
2625 format: OpFormat::NoneArg,
2626 },
2627 OpInfo {
2628 name: "put_arg1",
2629 size: 1,
2630 n_pop: 1,
2631 n_push: 0,
2632 format: OpFormat::NoneArg,
2633 },
2634 OpInfo {
2635 name: "put_arg2",
2636 size: 1,
2637 n_pop: 1,
2638 n_push: 0,
2639 format: OpFormat::NoneArg,
2640 },
2641 OpInfo {
2642 name: "put_arg3",
2643 size: 1,
2644 n_pop: 1,
2645 n_push: 0,
2646 format: OpFormat::NoneArg,
2647 },
2648 OpInfo {
2649 name: "set_arg0",
2650 size: 1,
2651 n_pop: 1,
2652 n_push: 1,
2653 format: OpFormat::NoneArg,
2654 },
2655 OpInfo {
2656 name: "set_arg1",
2657 size: 1,
2658 n_pop: 1,
2659 n_push: 1,
2660 format: OpFormat::NoneArg,
2661 },
2662 OpInfo {
2663 name: "set_arg2",
2664 size: 1,
2665 n_pop: 1,
2666 n_push: 1,
2667 format: OpFormat::NoneArg,
2668 },
2669 OpInfo {
2670 name: "set_arg3",
2671 size: 1,
2672 n_pop: 1,
2673 n_push: 1,
2674 format: OpFormat::NoneArg,
2675 },
2676 OpInfo {
2677 name: "get_var_ref0",
2678 size: 1,
2679 n_pop: 0,
2680 n_push: 1,
2681 format: OpFormat::NoneVarRef,
2682 },
2683 OpInfo {
2684 name: "get_var_ref1",
2685 size: 1,
2686 n_pop: 0,
2687 n_push: 1,
2688 format: OpFormat::NoneVarRef,
2689 },
2690 OpInfo {
2691 name: "get_var_ref2",
2692 size: 1,
2693 n_pop: 0,
2694 n_push: 1,
2695 format: OpFormat::NoneVarRef,
2696 },
2697 OpInfo {
2698 name: "get_var_ref3",
2699 size: 1,
2700 n_pop: 0,
2701 n_push: 1,
2702 format: OpFormat::NoneVarRef,
2703 },
2704 OpInfo {
2705 name: "put_var_ref0",
2706 size: 1,
2707 n_pop: 1,
2708 n_push: 0,
2709 format: OpFormat::NoneVarRef,
2710 },
2711 OpInfo {
2712 name: "put_var_ref1",
2713 size: 1,
2714 n_pop: 1,
2715 n_push: 0,
2716 format: OpFormat::NoneVarRef,
2717 },
2718 OpInfo {
2719 name: "put_var_ref2",
2720 size: 1,
2721 n_pop: 1,
2722 n_push: 0,
2723 format: OpFormat::NoneVarRef,
2724 },
2725 OpInfo {
2726 name: "put_var_ref3",
2727 size: 1,
2728 n_pop: 1,
2729 n_push: 0,
2730 format: OpFormat::NoneVarRef,
2731 },
2732 OpInfo {
2733 name: "set_var_ref0",
2734 size: 1,
2735 n_pop: 1,
2736 n_push: 1,
2737 format: OpFormat::NoneVarRef,
2738 },
2739 OpInfo {
2740 name: "set_var_ref1",
2741 size: 1,
2742 n_pop: 1,
2743 n_push: 1,
2744 format: OpFormat::NoneVarRef,
2745 },
2746 OpInfo {
2747 name: "set_var_ref2",
2748 size: 1,
2749 n_pop: 1,
2750 n_push: 1,
2751 format: OpFormat::NoneVarRef,
2752 },
2753 OpInfo {
2754 name: "set_var_ref3",
2755 size: 1,
2756 n_pop: 1,
2757 n_push: 1,
2758 format: OpFormat::NoneVarRef,
2759 },
2760 OpInfo {
2761 name: "get_length",
2762 size: 1,
2763 n_pop: 1,
2764 n_push: 1,
2765 format: OpFormat::None,
2766 },
2767 OpInfo {
2768 name: "if_false8",
2769 size: 2,
2770 n_pop: 1,
2771 n_push: 0,
2772 format: OpFormat::Label8,
2773 },
2774 OpInfo {
2775 name: "if_true8",
2776 size: 2,
2777 n_pop: 1,
2778 n_push: 0,
2779 format: OpFormat::Label8,
2780 },
2781 OpInfo {
2782 name: "goto8",
2783 size: 2,
2784 n_pop: 0,
2785 n_push: 0,
2786 format: OpFormat::Label8,
2787 },
2788 OpInfo {
2789 name: "goto16",
2790 size: 3,
2791 n_pop: 0,
2792 n_push: 0,
2793 format: OpFormat::Label16,
2794 },
2795 OpInfo {
2796 name: "call0",
2797 size: 1,
2798 n_pop: 1,
2799 n_push: 1,
2800 format: OpFormat::Npopx,
2801 },
2802 OpInfo {
2803 name: "call1",
2804 size: 1,
2805 n_pop: 1,
2806 n_push: 1,
2807 format: OpFormat::Npopx,
2808 },
2809 OpInfo {
2810 name: "call2",
2811 size: 1,
2812 n_pop: 1,
2813 n_push: 1,
2814 format: OpFormat::Npopx,
2815 },
2816 OpInfo {
2817 name: "call3",
2818 size: 1,
2819 n_pop: 1,
2820 n_push: 1,
2821 format: OpFormat::Npopx,
2822 },
2823 OpInfo {
2824 name: "is_undefined",
2825 size: 1,
2826 n_pop: 1,
2827 n_push: 1,
2828 format: OpFormat::None,
2829 },
2830 OpInfo {
2831 name: "is_null",
2832 size: 1,
2833 n_pop: 1,
2834 n_push: 1,
2835 format: OpFormat::None,
2836 },
2837 OpInfo {
2838 name: "typeof_is_undefined",
2839 size: 1,
2840 n_pop: 1,
2841 n_push: 1,
2842 format: OpFormat::None,
2843 },
2844 OpInfo {
2845 name: "typeof_is_function",
2846 size: 1,
2847 n_pop: 1,
2848 n_push: 1,
2849 format: OpFormat::None,
2850 },
2851 OpInfo {
2852 name: "with_has_var",
2853 size: 5,
2854 n_pop: 1,
2855 n_push: 1,
2856 format: OpFormat::Atom,
2857 },
2858];
2859
2860static TEMP_INFO: [OpInfo; 19] = [
2862 OpInfo {
2863 name: "enter_scope",
2864 size: 3,
2865 n_pop: 0,
2866 n_push: 0,
2867 format: OpFormat::U16,
2868 },
2869 OpInfo {
2870 name: "leave_scope",
2871 size: 3,
2872 n_pop: 0,
2873 n_push: 0,
2874 format: OpFormat::U16,
2875 },
2876 OpInfo {
2877 name: "label",
2878 size: 5,
2879 n_pop: 0,
2880 n_push: 0,
2881 format: OpFormat::Label,
2882 },
2883 OpInfo {
2884 name: "scope_get_var_undef",
2885 size: 7,
2886 n_pop: 0,
2887 n_push: 1,
2888 format: OpFormat::AtomU16,
2889 },
2890 OpInfo {
2891 name: "scope_get_var",
2892 size: 7,
2893 n_pop: 0,
2894 n_push: 1,
2895 format: OpFormat::AtomU16,
2896 },
2897 OpInfo {
2898 name: "scope_put_var",
2899 size: 7,
2900 n_pop: 1,
2901 n_push: 0,
2902 format: OpFormat::AtomU16,
2903 },
2904 OpInfo {
2905 name: "scope_delete_var",
2906 size: 7,
2907 n_pop: 0,
2908 n_push: 1,
2909 format: OpFormat::AtomU16,
2910 },
2911 OpInfo {
2912 name: "scope_make_ref",
2913 size: 11,
2914 n_pop: 0,
2915 n_push: 2,
2916 format: OpFormat::AtomLabelU16,
2917 },
2918 OpInfo {
2919 name: "scope_get_ref",
2920 size: 7,
2921 n_pop: 0,
2922 n_push: 2,
2923 format: OpFormat::AtomU16,
2924 },
2925 OpInfo {
2926 name: "scope_put_var_init",
2927 size: 7,
2928 n_pop: 0,
2929 n_push: 2,
2930 format: OpFormat::AtomU16,
2931 },
2932 OpInfo {
2933 name: "scope_get_var_checkthis",
2934 size: 7,
2935 n_pop: 0,
2936 n_push: 1,
2937 format: OpFormat::AtomU16,
2938 },
2939 OpInfo {
2940 name: "scope_get_private_field",
2941 size: 7,
2942 n_pop: 1,
2943 n_push: 1,
2944 format: OpFormat::AtomU16,
2945 },
2946 OpInfo {
2947 name: "scope_get_private_field2",
2948 size: 7,
2949 n_pop: 1,
2950 n_push: 2,
2951 format: OpFormat::AtomU16,
2952 },
2953 OpInfo {
2954 name: "scope_put_private_field",
2955 size: 7,
2956 n_pop: 2,
2957 n_push: 0,
2958 format: OpFormat::AtomU16,
2959 },
2960 OpInfo {
2961 name: "scope_in_private_field",
2962 size: 7,
2963 n_pop: 1,
2964 n_push: 1,
2965 format: OpFormat::AtomU16,
2966 },
2967 OpInfo {
2968 name: "get_field_opt_chain",
2969 size: 5,
2970 n_pop: 1,
2971 n_push: 1,
2972 format: OpFormat::Atom,
2973 },
2974 OpInfo {
2975 name: "get_array_el_opt_chain",
2976 size: 1,
2977 n_pop: 2,
2978 n_push: 1,
2979 format: OpFormat::None,
2980 },
2981 OpInfo {
2982 name: "set_class_name",
2983 size: 5,
2984 n_pop: 1,
2985 n_push: 1,
2986 format: OpFormat::U32,
2987 },
2988 OpInfo {
2989 name: "line_num",
2990 size: 5,
2991 n_pop: 0,
2992 n_push: 0,
2993 format: OpFormat::U32,
2994 },
2995];
2996
2997const OP_BY_BYTE: [Option<Opcode>; 256] = [
2999 Some(Opcode::Invalid),
3000 Some(Opcode::PushI32),
3001 Some(Opcode::PushConst),
3002 Some(Opcode::Fclosure),
3003 Some(Opcode::PushAtomValue),
3004 Some(Opcode::PrivateSymbol),
3005 Some(Opcode::Undefined),
3006 Some(Opcode::Null),
3007 Some(Opcode::PushThis),
3008 Some(Opcode::PushFalse),
3009 Some(Opcode::PushTrue),
3010 Some(Opcode::Object),
3011 Some(Opcode::SpecialObject),
3012 Some(Opcode::Rest),
3013 Some(Opcode::Drop),
3014 Some(Opcode::Nip),
3015 Some(Opcode::Nip1),
3016 Some(Opcode::Dup),
3017 Some(Opcode::Dup1),
3018 Some(Opcode::Dup2),
3019 Some(Opcode::Dup3),
3020 Some(Opcode::Insert2),
3021 Some(Opcode::Insert3),
3022 Some(Opcode::Insert4),
3023 Some(Opcode::Perm3),
3024 Some(Opcode::Perm4),
3025 Some(Opcode::Perm5),
3026 Some(Opcode::Swap),
3027 Some(Opcode::Swap2),
3028 Some(Opcode::Rot3l),
3029 Some(Opcode::Rot3r),
3030 Some(Opcode::Rot4l),
3031 Some(Opcode::Rot5l),
3032 Some(Opcode::CallConstructor),
3033 Some(Opcode::Call),
3034 Some(Opcode::TailCall),
3035 Some(Opcode::CallMethod),
3036 Some(Opcode::TailCallMethod),
3037 Some(Opcode::ArrayFrom),
3038 Some(Opcode::Apply),
3039 Some(Opcode::Return),
3040 Some(Opcode::ReturnUndef),
3041 Some(Opcode::CheckCtorReturn),
3042 Some(Opcode::CheckCtor),
3043 Some(Opcode::InitCtor),
3044 Some(Opcode::CheckBrand),
3045 Some(Opcode::AddBrand),
3046 Some(Opcode::ReturnAsync),
3047 Some(Opcode::Throw),
3048 Some(Opcode::ThrowError),
3049 Some(Opcode::Eval),
3050 Some(Opcode::ApplyEval),
3051 Some(Opcode::Regexp),
3052 Some(Opcode::GetSuper),
3053 Some(Opcode::Import),
3054 Some(Opcode::GetVarUndef),
3055 Some(Opcode::GetVar),
3056 Some(Opcode::PutVar),
3057 Some(Opcode::PutVarInit),
3058 Some(Opcode::GetRefValue),
3059 Some(Opcode::PutRefValue),
3060 Some(Opcode::GetField),
3061 Some(Opcode::GetField2),
3062 Some(Opcode::PutField),
3063 Some(Opcode::GetPrivateField),
3064 Some(Opcode::PutPrivateField),
3065 Some(Opcode::DefinePrivateField),
3066 Some(Opcode::GetArrayEl),
3067 Some(Opcode::GetArrayEl2),
3068 Some(Opcode::GetArrayEl3),
3069 Some(Opcode::PutArrayEl),
3070 Some(Opcode::GetSuperValue),
3071 Some(Opcode::PutSuperValue),
3072 Some(Opcode::DefineField),
3073 Some(Opcode::SetName),
3074 Some(Opcode::SetNameComputed),
3075 Some(Opcode::SetProto),
3076 Some(Opcode::SetHomeObject),
3077 Some(Opcode::DefineArrayEl),
3078 Some(Opcode::Append),
3079 Some(Opcode::CopyDataProperties),
3080 Some(Opcode::DefineMethod),
3081 Some(Opcode::DefineMethodComputed),
3082 Some(Opcode::DefineClass),
3083 Some(Opcode::DefineClassComputed),
3084 Some(Opcode::GetLoc),
3085 Some(Opcode::PutLoc),
3086 Some(Opcode::SetLoc),
3087 Some(Opcode::GetArg),
3088 Some(Opcode::PutArg),
3089 Some(Opcode::SetArg),
3090 Some(Opcode::GetVarRef),
3091 Some(Opcode::PutVarRef),
3092 Some(Opcode::SetVarRef),
3093 Some(Opcode::SetLocUninitialized),
3094 Some(Opcode::GetLocCheck),
3095 Some(Opcode::PutLocCheck),
3096 Some(Opcode::SetLocCheck),
3097 Some(Opcode::PutLocCheckInit),
3098 Some(Opcode::GetLocCheckthis),
3099 Some(Opcode::GetVarRefCheck),
3100 Some(Opcode::PutVarRefCheck),
3101 Some(Opcode::PutVarRefCheckInit),
3102 Some(Opcode::CloseLoc),
3103 Some(Opcode::IfFalse),
3104 Some(Opcode::IfTrue),
3105 Some(Opcode::Goto),
3106 Some(Opcode::Catch),
3107 Some(Opcode::Gosub),
3108 Some(Opcode::Ret),
3109 Some(Opcode::NipCatch),
3110 Some(Opcode::ToObject),
3111 Some(Opcode::ToPropkey),
3112 Some(Opcode::WithGetVar),
3113 Some(Opcode::WithPutVar),
3114 Some(Opcode::WithDeleteVar),
3115 Some(Opcode::WithMakeRef),
3116 Some(Opcode::WithGetRef),
3117 Some(Opcode::MakeLocRef),
3118 Some(Opcode::MakeArgRef),
3119 Some(Opcode::MakeVarRefRef),
3120 Some(Opcode::MakeVarRef),
3121 Some(Opcode::ForInStart),
3122 Some(Opcode::ForOfStart),
3123 Some(Opcode::ForAwaitOfStart),
3124 Some(Opcode::ForInNext),
3125 Some(Opcode::ForOfNext),
3126 Some(Opcode::ForAwaitOfNext),
3127 Some(Opcode::IteratorCheckObject),
3128 Some(Opcode::IteratorGetValueDone),
3129 Some(Opcode::IteratorClose),
3130 Some(Opcode::IteratorNext),
3131 Some(Opcode::IteratorCall),
3132 Some(Opcode::InitialYield),
3133 Some(Opcode::Yield),
3134 Some(Opcode::YieldStar),
3135 Some(Opcode::AsyncYieldStar),
3136 Some(Opcode::Await),
3137 Some(Opcode::Neg),
3138 Some(Opcode::Plus),
3139 Some(Opcode::Dec),
3140 Some(Opcode::Inc),
3141 Some(Opcode::PostDec),
3142 Some(Opcode::PostInc),
3143 Some(Opcode::DecLoc),
3144 Some(Opcode::IncLoc),
3145 Some(Opcode::AddLoc),
3146 Some(Opcode::Not),
3147 Some(Opcode::Lnot),
3148 Some(Opcode::Typeof),
3149 Some(Opcode::Delete),
3150 Some(Opcode::DeleteVar),
3151 Some(Opcode::Mul),
3152 Some(Opcode::Div),
3153 Some(Opcode::Mod),
3154 Some(Opcode::Add),
3155 Some(Opcode::Sub),
3156 Some(Opcode::Pow),
3157 Some(Opcode::Shl),
3158 Some(Opcode::Sar),
3159 Some(Opcode::Shr),
3160 Some(Opcode::Lt),
3161 Some(Opcode::Lte),
3162 Some(Opcode::Gt),
3163 Some(Opcode::Gte),
3164 Some(Opcode::Instanceof),
3165 Some(Opcode::In),
3166 Some(Opcode::Eq),
3167 Some(Opcode::Neq),
3168 Some(Opcode::StrictEq),
3169 Some(Opcode::StrictNeq),
3170 Some(Opcode::And),
3171 Some(Opcode::Xor),
3172 Some(Opcode::Or),
3173 Some(Opcode::IsUndefinedOrNull),
3174 Some(Opcode::PrivateIn),
3175 Some(Opcode::PushBigintI32),
3176 Some(Opcode::UsingDisposeInit),
3177 Some(Opcode::UsingDispose),
3178 Some(Opcode::UsingDisposeAsync),
3179 Some(Opcode::UsingDisposeMerge),
3180 Some(Opcode::UsingDisposeEnd),
3181 Some(Opcode::UsingCheck),
3182 Some(Opcode::Nop),
3183 Some(Opcode::PushMinus1),
3184 Some(Opcode::Push0),
3185 Some(Opcode::Push1),
3186 Some(Opcode::Push2),
3187 Some(Opcode::Push3),
3188 Some(Opcode::Push4),
3189 Some(Opcode::Push5),
3190 Some(Opcode::Push6),
3191 Some(Opcode::Push7),
3192 Some(Opcode::PushI8),
3193 Some(Opcode::PushI16),
3194 Some(Opcode::PushConst8),
3195 Some(Opcode::Fclosure8),
3196 Some(Opcode::PushEmptyString),
3197 Some(Opcode::GetLoc8),
3198 Some(Opcode::PutLoc8),
3199 Some(Opcode::SetLoc8),
3200 Some(Opcode::GetLoc0),
3201 Some(Opcode::GetLoc1),
3202 Some(Opcode::GetLoc2),
3203 Some(Opcode::GetLoc3),
3204 Some(Opcode::PutLoc0),
3205 Some(Opcode::PutLoc1),
3206 Some(Opcode::PutLoc2),
3207 Some(Opcode::PutLoc3),
3208 Some(Opcode::SetLoc0),
3209 Some(Opcode::SetLoc1),
3210 Some(Opcode::SetLoc2),
3211 Some(Opcode::SetLoc3),
3212 Some(Opcode::GetArg0),
3213 Some(Opcode::GetArg1),
3214 Some(Opcode::GetArg2),
3215 Some(Opcode::GetArg3),
3216 Some(Opcode::PutArg0),
3217 Some(Opcode::PutArg1),
3218 Some(Opcode::PutArg2),
3219 Some(Opcode::PutArg3),
3220 Some(Opcode::SetArg0),
3221 Some(Opcode::SetArg1),
3222 Some(Opcode::SetArg2),
3223 Some(Opcode::SetArg3),
3224 Some(Opcode::GetVarRef0),
3225 Some(Opcode::GetVarRef1),
3226 Some(Opcode::GetVarRef2),
3227 Some(Opcode::GetVarRef3),
3228 Some(Opcode::PutVarRef0),
3229 Some(Opcode::PutVarRef1),
3230 Some(Opcode::PutVarRef2),
3231 Some(Opcode::PutVarRef3),
3232 Some(Opcode::SetVarRef0),
3233 Some(Opcode::SetVarRef1),
3234 Some(Opcode::SetVarRef2),
3235 Some(Opcode::SetVarRef3),
3236 Some(Opcode::GetLength),
3237 Some(Opcode::IfFalse8),
3238 Some(Opcode::IfTrue8),
3239 Some(Opcode::Goto8),
3240 Some(Opcode::Goto16),
3241 Some(Opcode::Call0),
3242 Some(Opcode::Call1),
3243 Some(Opcode::Call2),
3244 Some(Opcode::Call3),
3245 Some(Opcode::IsUndefined),
3246 Some(Opcode::IsNull),
3247 Some(Opcode::TypeofIsUndefined),
3248 Some(Opcode::TypeofIsFunction),
3249 Some(Opcode::WithHasVar),
3250 None,
3251 None,
3252 None,
3253 None,
3254 None,
3255];
3256
3257#[cfg(test)]
3258mod tests {
3259 use super::*;
3260
3261 #[test]
3262 fn every_discriminant_matches_its_index() {
3263 for (index, opcode) in OP_ALL.iter().enumerate() {
3264 assert_eq!(
3265 *opcode as usize, index,
3266 "OP_ALL must be ordered by discriminant"
3267 );
3268 assert!(!opcode.name().is_empty());
3269 assert!(opcode.size() >= 1, "{} has a zero size", opcode.name());
3270 }
3271 assert_eq!(OP_ALL.len(), OP_COUNT as usize);
3272 assert_eq!(OP_INFO.len(), OP_ALL.len());
3273 assert_eq!(TEMP_INFO.len(), 20 - TEMP_START);
3274 }
3275
3276 #[test]
3277 fn opcode_bytes_round_trip() {
3278 for opcode in OP_ALL {
3279 assert_eq!(
3280 Opcode::from_u8(opcode as u8),
3281 Some(opcode),
3282 "{}",
3283 opcode.name()
3284 );
3285 }
3286 assert_eq!(Opcode::from_u8(OP_COUNT), None);
3287 assert_eq!(Opcode::from_u8(255), None);
3288 }
3289
3290 #[test]
3291 fn names_round_trip() {
3292 for opcode in OP_ALL {
3293 assert_eq!(
3294 Opcode::by_name(opcode.name()),
3295 Some(opcode),
3296 "{}",
3297 opcode.name()
3298 );
3299 }
3300 }
3301
3302 #[test]
3303 fn temporary_opcodes_overlap_real_opcodes() {
3304 assert_eq!(TempOpcode::EnterScope as u8, Opcode::PushI32 as u8);
3308 assert_eq!(TempOpcode::LineNum as u8, 19);
3309 assert!(Opcode::from_u8(TempOpcode::EnterScope as u8).is_some());
3310 assert!(Opcode::from_u8(TempOpcode::LineNum as u8).is_some());
3311 }
3312}