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