Skip to main content

RegOpCode

Enum RegOpCode 

Source
#[repr(u8)]
pub enum RegOpCode {
Show 48 variants LoadConst = 0, LoadUndefined = 1, LoadNull = 2, LoadTrue = 3, LoadFalse = 4, Move = 5, Add = 6, Sub = 7, Mul = 8, Div = 9, Mod = 10, Negate = 11, BitAnd = 12, BitOr = 13, BitXor = 14, BitNot = 15, ShiftLeft = 16, ShiftRight = 17, UShiftRight = 18, StrictEqual = 19, StrictNotEqual = 20, Equal = 21, NotEqual = 22, LessThan = 23, LessEqual = 24, GreaterThan = 25, GreaterEqual = 26, Not = 27, TypeOf = 28, UnaryPlus = 29, GetVar = 30, SetVar = 31, DeclareVar = 32, DeclareLet = 33, DeclareConst = 34, InitVar = 35, InitBinding = 36, GetProp = 37, SetProp = 38, GetElem = 39, SetElem = 40, Jump = 41, JumpIfFalse = 42, JumpIfTrue = 43, Call = 44, CallMethod = 45, Return = 46, Halt = 47,
}
Expand description

Bytecode opcodes for the register-based VM.

Variants§

§

LoadConst = 0

dst = constant pool value.

§

LoadUndefined = 1

dst = undefined.

§

LoadNull = 2

dst = null.

§

LoadTrue = 3

dst = true.

§

LoadFalse = 4

dst = false.

§

Move = 5

dst = src1.

§

Add = 6

dst = src1 + src2.

§

Sub = 7

dst = src1 - src2.

§

Mul = 8

dst = src1 * src2.

§

Div = 9

dst = src1 / src2.

§

Mod = 10

dst = src1 % src2.

§

Negate = 11

dst = -src1.

§

BitAnd = 12

dst = src1 & src2.

§

BitOr = 13

dst = src1 | src2.

§

BitXor = 14

dst = src1 ^ src2.

§

BitNot = 15

dst = ~src1.

§

ShiftLeft = 16

dst = src1 << src2.

§

ShiftRight = 17

dst = src1 >> src2.

§

UShiftRight = 18

dst = src1 >>> src2.

§

StrictEqual = 19

dst = (src1 === src2).

§

StrictNotEqual = 20

dst = (src1 !== src2).

§

Equal = 21

dst = (src1 == src2).

§

NotEqual = 22

dst = (src1 != src2).

§

LessThan = 23

dst = (src1 < src2).

§

LessEqual = 24

dst = (src1 <= src2).

§

GreaterThan = 25

dst = (src1 > src2).

§

GreaterEqual = 26

dst = (src1 >= src2).

§

Not = 27

dst = !src1.

§

TypeOf = 28

dst = typeof src1.

§

UnaryPlus = 29

dst = +src1.

§

GetVar = 30

dst = get var by name (imm = name index).

§

SetVar = 31

set var by name (src1 = value, imm = name index).

§

DeclareVar = 32

declare var (imm = name index).

§

DeclareLet = 33

declare let (imm = name index).

§

DeclareConst = 34

declare const (imm = name index).

§

InitVar = 35

init var (src1 = value, imm = name index).

§

InitBinding = 36

init let/const (src1 = value, imm = name index).

§

GetProp = 37

dst = obj.prop (src1 = obj, imm = name index).

§

SetProp = 38

obj.prop = value (src1 = obj, src2 = value, imm = name index).

§

GetElem = 39

dst = obj[key] (src1 = obj, src2 = key).

§

SetElem = 40

obj[key] = value (dst = value, src1 = obj, src2 = key).

§

Jump = 41

jump to imm (absolute index).

§

JumpIfFalse = 42

if !src1 jump to imm.

§

JumpIfTrue = 43

if src1 jump to imm.

§

Call = 44

dst = call callee (src1 = callee, imm = arg count).

§

CallMethod = 45

dst = call method (src1 = object, imm = arg count, src2 = name index).

§

Return = 46

return src1.

§

Halt = 47

halt (optional src1 as result).

Trait Implementations§

Source§

impl Clone for RegOpCode

Source§

fn clone(&self) -> RegOpCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RegOpCode

Source§

impl Debug for RegOpCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RegOpCode

Source§

fn eq(&self, other: &RegOpCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RegOpCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.