#[repr(u8)]pub enum Opcode {
Show 200 variants
Nop = 0,
Mov = 1,
Swap = 2,
LoadWide = 3,
StoreWide = 4,
LoadInt = 5,
LoadConst = 6,
LoadUndefined = 7,
LoadNull = 8,
LoadTrue = 9,
LoadFalse = 10,
LoadEmpty = 11,
LoadFunction = 12,
CheckInit = 13,
ThrowConstAssign = 14,
Neg = 15,
Plus = 16,
ToNumeric = 17,
Inc = 18,
Dec = 19,
BitNot = 20,
Not = 21,
TypeOf = 22,
ToPropertyKey = 23,
IsUndefinedOrNull = 24,
IsUndefined = 25,
IsNull = 26,
TypeOfIsUndefined = 27,
TypeOfIsFunction = 28,
Add = 29,
Sub = 30,
Mul = 31,
Div = 32,
Mod = 33,
Pow = 34,
Shl = 35,
Sar = 36,
Shr = 37,
BitAnd = 38,
BitOr = 39,
BitXor = 40,
Eq = 41,
Neq = 42,
StrictEq = 43,
StrictNeq = 44,
Lt = 45,
Lte = 46,
Gt = 47,
Gte = 48,
InstanceOf = 49,
In = 50,
AddI = 51,
SubI = 52,
MulI = 53,
BitAndI = 54,
BitOrI = 55,
BitXorI = 56,
ShlI = 57,
SarI = 58,
ShrI = 59,
Jmp = 60,
JTrue = 61,
JFalse = 62,
JUndefinedOrNull = 63,
Gosub = 64,
Ret = 65,
JLt = 66,
JLte = 67,
JGt = 68,
JGte = 69,
JNlt = 70,
JNlte = 71,
JNgt = 72,
JNgte = 73,
JEq = 74,
JNeq = 75,
JStrictEq = 76,
JStrictNeq = 77,
JLtI = 78,
JLteI = 79,
JGtI = 80,
JGteI = 81,
JNltI = 82,
JNlteI = 83,
JNgtI = 84,
JNgteI = 85,
JEqI = 86,
JNeqI = 87,
JStrictEqI = 88,
JStrictNeqI = 89,
GetField = 90,
SetField = 91,
DefineField = 92,
DeleteField = 93,
DefineGetter = 94,
DefineSetter = 95,
GetElem = 96,
SetElem = 97,
DefineElem = 98,
DeleteElem = 99,
GetGlobal = 100,
GetGlobalOrUndefined = 101,
SetGlobal = 102,
DefineGlobal = 103,
DeleteGlobal = 104,
DeclareGlobal = 105,
DeclareGlobalLet = 106,
DeclareGlobalConst = 107,
CheckGlobalVar = 108,
CheckGlobalLexical = 109,
NewCell = 110,
NewCellEmpty = 111,
CloseCell = 112,
LoadCell = 113,
StoreCell = 114,
CheckCellInit = 115,
LoadCaptured = 116,
StoreCaptured = 117,
NewSpill = 118,
LoadSlot = 119,
StoreSlot = 120,
NewArguments = 121,
Rest = 122,
LoadNewTarget = 123,
NewRegExp = 124,
ForInStart = 125,
ForInNext = 126,
AppendSpread = 127,
ThrowInternal = 128,
CheckCtor = 129,
LoadHomeObject = 130,
ToObject = 131,
SetProto = 132,
DefineMethod = 133,
DefineMethodComputed = 134,
SetFunctionName = 135,
ThrowType = 136,
ThrowReference = 137,
ImportCall = 138,
IterStart = 139,
IterNext = 140,
IterClose = 141,
IterCloseThrow = 142,
IterCallNext = 143,
IterCall = 144,
IterCheckObject = 145,
IterStartAsync = 146,
IterNextRaw = 147,
IterResult = 148,
MakeClass = 149,
InstallFields = 150,
InitFields = 151,
RunStaticInit = 152,
CallStaticBlock = 153,
GetSuper = 154,
GetSuperValue = 155,
PutSuperValue = 156,
InitDerived = 157,
InitThis = 158,
InitThisCell = 159,
InitThisCaptured = 160,
CheckDerivedReturn = 161,
NewPrivateName = 162,
SetHomeObject = 163,
NamePrivateMethod = 164,
GetPrivate = 165,
PutPrivate = 166,
DefinePrivate = 167,
PrivateIn = 168,
GetPrivateMethod = 169,
CallPrivateGetter = 170,
CallPrivateSetter = 171,
PrivateBrandIn = 172,
InitialYield = 173,
AsyncStart = 174,
Yield = 175,
YieldStar = 176,
Await = 177,
CopyData = 178,
CopyDataExcluded = 179,
GlobalRef = 180,
GetRef = 181,
PutRef = 182,
NewObject = 183,
NewArray = 184,
MakeClosure = 185,
Call = 186,
CallMethod = 187,
TailCall = 188,
TailCallMethod = 189,
New = 190,
CallSpread = 191,
NewSpread = 192,
Return = 193,
ReturnUndefined = 194,
Throw = 195,
ToPropertyKeyOf = 196,
ClearCell = 197,
ConcatN = 198,
JmpBack = 199,
}Expand description
A register instruction’s operation. The lowering builds instructions as Rust values, so the main loop never decodes or validates an opcode byte.
Variants§
Nop = 0
Mov = 1
a = b.
Swap = 2
Exchanges a and b (cyclic stack shuffles).
LoadWide = 3
a = register imm, for a register above the window.
StoreWide = 4
register imm = a.
LoadInt = 5
LoadConst = 6
LoadUndefined = 7
LoadNull = 8
LoadTrue = 9
LoadFalse = 10
LoadEmpty = 11
The TDZ marker, for a lexical binding entering scope.
LoadFunction = 12
The running function object, for a named function expression.
CheckInit = 13
Throws ReferenceError naming key imm when a is the TDZ marker.
ThrowConstAssign = 14
Throws TypeError for an assignment to the constant named imm.
Neg = 15
Plus = 16
ToNumber, the unary +.
ToNumeric = 17
ToNumeric, the old value of a postfix update.
Inc = 18
Dec = 19
BitNot = 20
Not = 21
TypeOf = 22
ToPropertyKey = 23
IsUndefinedOrNull = 24
IsUndefined = 25
IsNull = 26
TypeOfIsUndefined = 27
TypeOfIsFunction = 28
Add = 29
Sub = 30
Mul = 31
Div = 32
Mod = 33
Pow = 34
Shl = 35
Sar = 36
Shr = 37
BitAnd = 38
BitOr = 39
BitXor = 40
Eq = 41
Neq = 42
StrictEq = 43
StrictNeq = 44
Lt = 45
Lte = 46
Gt = 47
Gte = 48
InstanceOf = 49
In = 50
AddI = 51
SubI = 52
MulI = 53
BitAndI = 54
BitOrI = 55
BitXorI = 56
ShlI = 57
SarI = 58
ShrI = 59
Jmp = 60
JTrue = 61
JFalse = 62
JUndefinedOrNull = 63
Gosub = 64
Stores the index of the next instruction in a as an Int32 and
jumps to imm (a finally block).
Ret = 65
Jumps to the instruction index held in a.
JLt = 66
JLte = 67
JGt = 68
JGte = 69
JNlt = 70
!(a < b), not a >= b: the negated forms differ on NaN.
JNlte = 71
JNgt = 72
JNgte = 73
JEq = 74
JNeq = 75
JStrictEq = 76
JStrictNeq = 77
JLtI = 78
JLteI = 79
JGtI = 80
JGteI = 81
JNltI = 82
JNlteI = 83
JNgtI = 84
JNgteI = 85
JEqI = 86
JNeqI = 87
JStrictEqI = 88
JStrictNeqI = 89
GetField = 90
a = b.imm.
SetField = 91
a.imm = b.
DefineField = 92
Defines own data property imm of a as b (literals).
DeleteField = 93
a = delete b.imm.
DefineGetter = 94
Defines the getter of own accessor imm of a as function b
(get x() {} in a literal), keeping an existing setter.
DefineSetter = 95
Defines the setter of own accessor imm of a as function b.
GetElem = 96
a = b[c].
SetElem = 97
a[b] = c.
DefineElem = 98
Defines own data property b of a as c (computed literal keys).
DeleteElem = 99
a = delete b[c].
GetGlobal = 100
GetGlobalOrUndefined = 101
typeof name on a name that may be undeclared.
SetGlobal = 102
DefineGlobal = 103
A var or function declaration at script level; b holds the
global flags.
DeleteGlobal = 104
DeclareGlobal = 105
A script-level declaration: defines global imm as undefined unless
it exists; b holds the global flags.
DeclareGlobalLet = 106
A script-level let or class: a binding of the global lexical
environment, in the TDZ.
DeclareGlobalConst = 107
A script-level const.
CheckGlobalVar = 108
GlobalDeclarationInstantiation’s check for a var or function
name: a SyntaxError if a lexical binding has it, then
CanDeclareGlobalVar or, with global::FUNCTION in b,
CanDeclareGlobalFunction, a TypeError when false.
CheckGlobalLexical = 109
The check for a lexical name: a SyntaxError if a lexical binding or
a non-configurable global property has it.
NewCell = 110
a = a new cell holding the value of b.
NewCellEmpty = 111
a = a new cell in the TDZ (a lexical binding entering scope).
CloseCell = 112
a = a new cell holding a copy of cell a’s value: the binding is
detached from closures created so far (a for (let …) iteration).
LoadCell = 113
a = the value in cell b.
StoreCell = 114
Cell a = b.
CheckCellInit = 115
Throws ReferenceError naming key imm when cell a is in the TDZ.
LoadCaptured = 116
a = the value of the running function’s capture imm.
StoreCaptured = 117
The running function’s capture imm = a.
NewSpill = 118
a = a scope of imm slots, all undefined.
LoadSlot = 119
a = slot imm of the spill scope in b.
StoreSlot = 120
Slot imm of the spill scope in b = a.
NewArguments = 121
a = a new arguments object of the running frame: imm 1 for the
mapped form (the parameters’ registers hold their cells), 0 for the
unmapped one.
Rest = 122
a = an array of the arguments from index imm (a rest parameter).
LoadNewTarget = 123
a = new.target: the running function in a new call, else
undefined.
NewRegExp = 124
a = a new regular expression over constants imm (the source) and
imm + 1 (the flags).
ForInStart = 125
a = a for-in enumeration of b’s enumerable string keys.
ForInNext = 126
The next key of enumeration b that still exists goes to a and
control to imm; an exhausted enumeration falls through.
AppendSpread = 127
Appends the elements of the array or arguments object in c to the
array in a from index b, leaving the next index in b (a spread
element).
ThrowInternal = 128
Throws InternalError whose message is the atom imm (a construct
outside the surface, reached at run time).
CheckCtor = 129
Throws TypeError when a (the new.target register) is
undefined: a class constructor called without new.
LoadHomeObject = 130
a = the running function’s home object.
ToObject = 131
a = ToObject(b).
SetProto = 132
Sets the prototype of the fresh literal a to b when b is an
object or null (__proto__: v in a literal).
DefineMethod = 133
Defines method imm of a as function b with home object a;
c holds the method flags.
DefineMethodComputed = 134
Defines method b (a canonical key) of a as function c; imm
holds the method flags.
SetFunctionName = 135
Names function a by the key in b when its name is empty
(SetFunctionName for anonymous functions in named positions).
ThrowType = 136
Throws TypeError whose message is the atom imm.
ThrowReference = 137
Throws ReferenceError whose message is the atom imm.
ImportCall = 138
a = import(b, c): the promise of module b’s namespace, with the
options in c.
IterStart = 139
The record at a (iterator, next, done flag; or array, the
Value::EMPTY mark, index) for the iterable in b; with imm set
always the generic protocol.
IterNext = 140
The next value of record b to a and whether it is done to c.
IterClose = 141
Closes record a unless it is done (a normal completion).
IterCloseThrow = 142
Closes record a unless it is done for the throw completion in b;
errors of return are dropped.
IterCallNext = 143
a = record b’s next called with c (yield*), unchecked.
IterCall = 144
a = record b’s return (imm 0) or throw (imm 1) called
with c, and a + 1 whether the method was missing (then a = c).
IterCheckObject = 145
Throws TypeError when a is not an object.
IterStartAsync = 146
The async record at a for b: its @@asyncIterator, or an
async-from-sync iterator over its sync one.
IterNextRaw = 147
a = record b’s next() result, unchecked; the record is marked
done until Opcode::IterResult reads the settled result.
IterResult = 148
Reads the settled result in a of record b: its value to a, its
done flag to c (the record is open again unless done).
MakeClass = 149
a = the class constructor made from the closure in b with the
parent in a (c 1 when it has a heritage) and b = its
prototype; imm is the class name.
InstallFields = 150
Installs the instance-field initializer c on constructor a, with
home object b.
InitFields = 151
Runs the instance-field initializer of constructor b on a.
RunStaticInit = 152
Runs the static initializer b with this and home object a.
CallStaticBlock = 153
Calls static block a with the frame’s this and home object.
GetSuper = 154
a = the prototype of home object b (null allowed).
GetSuperValue = 155
a = base[key] with receiver as this: receiver, base, key in
b, b + 1, b + 2; imm marks the call form, which reads the
same way.
PutSuperValue = 156
base[key] = value with receiver: receiver, base, key, value in
a .. a + 3.
InitDerived = 157
a = the result of the implicit derived constructor: the parent
constructed with the frame’s arguments and the new.target in b.
InitThis = 158
Binds a derived constructor’s this register a to b (a
ReferenceError if already bound).
InitThisCell = 159
Opcode::InitThis on the cell in a.
InitThisCaptured = 160
Opcode::InitThis on the running function’s capture imm.
CheckDerivedReturn = 161
A derived constructor’s return value: a stays if it is an object,
becomes the this in b for undefined; anything else throws.
NewPrivateName = 162
a = a new private name described by atom imm.
SetHomeObject = 163
Sets the home object of method a to b and gives b a brand.
NamePrivateMethod = 164
Names private method a by atom imm after the prefix c (0 none,
1 get , 2 set ).
GetPrivate = 165
a = own private field c of b (a TypeError if absent).
PutPrivate = 166
Own private field c of a = b (a TypeError if absent).
DefinePrivate = 167
Defines own private field c of a as b (a TypeError if
present).
PrivateIn = 168
a = whether b has own private field c.
GetPrivateMethod = 169
a = private method c after a brand check of b.
CallPrivateGetter = 170
a = the private getter c called on b after a brand check.
CallPrivateSetter = 171
Calls the private setter c on a with b after a brand check.
PrivateBrandIn = 172
a = whether b carries the brand of private method c.
InitialYield = 173
A generator suspends before its body: the call returns the generator object.
AsyncStart = 174
An async function starts: its promise is the call’s result, and the body runs until it awaits or completes.
Yield = 175
Suspends with the value in a; a resumption writes its value to a
and its kind (0 next, 1 return) to a + 1, or throws here.
YieldStar = 176
yield*’s suspension: the iterator result in a is returned as is;
a throw resumes with kind 2 rather than throwing.
Await = 177
Awaits the value in a; the fulfilled value is written to a, a
rejection throws here.
CopyData = 178
Copies the enumerable own properties of b onto a.
CopyDataExcluded = 179
Opcode::CopyData except the keys own by the object in c.
GlobalRef = 180
a = the environment holding global imm: the lexical one, the
global object, or undefined when unresolvable.
GetRef = 181
a = binding imm of environment b (a ReferenceError if
missing; undefined with c 1).
PutRef = 182
Binding imm of environment a = b.
NewObject = 183
a = {} with room for imm properties.
NewArray = 184
a = [b, b + 1, …] of imm elements.
MakeClosure = 185
a = a closure for child unit imm, capturing what the child’s
capture list names.
Call = 186
a = b(b + 1, …, b + c) with an undefined receiver: the callee’s
window starts at b, so b becomes its this.
CallMethod = 187
a = (b + 1)(b + 2, …) with receiver b: the window starts at
b + 1, which receives the receiver.
TailCall = 188
Call that returns the callee’s result from this frame; a is
ignored.
TailCallMethod = 189
TailCall with a receiver, as CallMethod.
New = 190
a = new b(b + 2, …) with new.target in b + 1: the window starts at
b + 1, which receives the constructed object.
CallSpread = 191
a = b(...) with receiver b + 1 and the elements of the array in
b + 2 as the arguments (a spread call): the window starts at
b + 1; c is unused.
NewSpread = 192
a = new b(...) with new.target in b + 1 and the elements of the
array in b + 2 as the arguments.
Return = 193
ReturnUndefined = 194
Throw = 195
ToPropertyKeyOf = 196
a = ToPropertyKey(b) for the base c of a compound assignment: a
null or undefined base throws first.
ClearCell = 197
Puts the cell in a back in the TDZ (a lexical scope entered again):
closures already holding it see the new binding state.
ConcatN = 198
a = b + (b + 1) + … + (b + imm - 1), a chain of + from the left
whose string concatenations join once; past the first two, the
operands are primitive constants.
JmpBack = 199
Jmp to a target at or before itself: a loop’s back-edge, which
counts down to the next interrupt poll.