pub enum Instruction {
Show 37 variants
LoadConst {
dst: Register,
constant: ConstantId,
},
Move {
dst: Register,
src: Register,
},
Unary {
dst: Register,
op: UnaryOp,
operand: Register,
},
Binary {
dst: Register,
op: BinaryOp,
left: Register,
right: Register,
},
CreateObject {
dst: Register,
},
CreateArray {
dst: Register,
},
CreateCell {
dst: Register,
},
CreateClosure {
dst: Register,
function: FunctionId,
captures: Register,
},
GetProperty {
dst: Register,
object: Register,
key: Register,
},
SetProperty {
object: Register,
key: Register,
value: Register,
},
DeleteProperty {
dst: Register,
object: Register,
key: Register,
},
DefineAccessor {
object: Register,
key: Register,
accessor: Register,
kind: AccessorKind,
},
Call {
dst: Register,
callee: Register,
this_value: Register,
arguments: Register,
},
Construct {
dst: Register,
callee: Register,
arguments: Register,
},
LoadGlobal {
dst: Register,
name: ConstantId,
},
StoreGlobal {
name: ConstantId,
value: Register,
},
TypeOfGlobal {
dst: Register,
name: ConstantId,
},
LoadThis {
dst: Register,
},
LoadArguments {
dst: Register,
},
LoadNewTarget {
dst: Register,
},
ArrayPush {
array: Register,
value: Register,
},
ArrayExtend {
array: Register,
iterable: Register,
},
ObjectSpread {
target: Register,
source: Register,
},
SetPrototype {
object: Register,
prototype: Register,
},
CreatePrivateName {
dst: Register,
description: ConstantId,
},
CreateRegExp {
dst: Register,
pattern: ConstantId,
flags: ConstantId,
},
GetIterator {
dst: Register,
src: Register,
kind: IteratorKind,
},
IteratorNext {
done: Register,
value: Register,
iterator: Register,
},
Jump {
target: Pc,
},
JumpIfTrue {
condition: Register,
target: Pc,
},
JumpIfFalse {
condition: Register,
target: Pc,
},
Return {
value: Register,
},
Throw {
value: Register,
},
Suspend {
dst: Register,
src: Register,
resume: Pc,
},
Import {
dst: Register,
specifier: ConstantId,
},
Export {
name: ConstantId,
src: Register,
},
Halt,
}Expand description
The production instruction algebra. Opcodes 0..=36 are stable wire tags.
Variants§
LoadConst
Load a constant into dst (refines the formal Load).
Move
Copy src into dst.
Unary
Apply a unary operator to operand, writing dst.
Binary
Apply a binary operator (generalizes the formal Add), writing dst.
CreateObject
Create a fresh empty object in dst.
CreateArray
Create a fresh empty array in dst.
CreateCell
Create a compiler-private one-element array cell seeded with the runtime-only uninitialized sentinel.
CreateClosure
Materialize a closure over function, binding the captured cells held in
the array register captures, into dst. The captured cells initialize
the callee’s leading capture_count registers.
GetProperty
dst = object[key], with the property key taken from a register.
SetProperty
object[key] = value, with the property key taken from a register.
DeleteProperty
dst = delete object[key], with the property key taken from a register.
DefineAccessor
Install a getter or setter accessor under key on object.
Call
Call callee with receiver this_value and the dynamic argument array
in arguments, writing the result to dst. Spread and any arity lower
through the single arguments array.
Construct
Construct with callee and the dynamic argument array in arguments,
writing the instance to dst.
LoadGlobal
dst = globalThis[name], where name is a string constant. Throws a
ReferenceError at runtime for an undeclared global.
StoreGlobal
globalThis[name] = value, where name is a string constant.
TypeOfGlobal
dst = typeof globalThis[name], where name is a string constant.
Yields "undefined" for an undeclared global rather than throwing.
LoadThis
Load the receiver binding this into dst.
LoadArguments
Load the arguments exotic object into dst.
LoadNewTarget
Load new.target into dst.
ArrayPush
Append value to the array in array.
ArrayExtend
Spread every element of iterable onto the end of the array in array.
ObjectSpread
Copy the own enumerable properties of source onto target
({ ...source }).
SetPrototype
Set the [[Prototype]] of object to prototype.
CreatePrivateName
Create a fresh private name described by the string constant
description, writing it to dst. The result is used as a register key
for private-field access via the property instructions.
CreateRegExp
Create a RegExp from the string-constant pattern and flags.
GetIterator
Acquire an iterator over src using protocol kind, writing it to dst.
IteratorNext
Advance iterator one step: write whether iteration is done to done
and the produced value to value (two writes).
Jump
Unconditional control transfer (identical to the formal Jump).
JumpIfTrue
Branch to target when condition is truthy, else fall through.
JumpIfFalse
Branch to target when condition is falsy, else fall through.
Return
Return value to the caller (terminator).
Throw
Throw value (terminator; caught by an enclosing handler if any).
Suspend
Yield src and resume at resume, receiving the resumed value in dst
(refines the formal Suspend). See the module-level resume contract.
Import
Import the module named by the string constant specifier into dst.
Export
Export the local value in src under the string constant name.
Halt
Terminate the current activation (identical to the formal Halt).
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more