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