Bytecode Descriptions

Bytecode Listing

This document is automatically generated from Opcodes.h by make_opcode_doc.py.

Statements

Jumps

JSOP_AND [-1, +1] (JUMP, DETECTING, LEFTASSOC)
Value 69 (0x45)
Operands int32_t offset
Length 5
Stack Uses cond
Stack Defs cond

Converts the top of stack value into a boolean, if the result is false, jumps to a 32-bit offset from the current bytecode.

JSOP_GOTO [-0, +0] (JUMP)
Value 6 (0x06)
Operands int32_t offset
Length 5
Stack Uses  
Stack Defs  

Jumps to a 32-bit offset from the current bytecode.

JSOP_IFEQ [-1, +0] (JUMP, DETECTING)
Value 7 (0x07)
Operands int32_t offset
Length 5
Stack Uses cond
Stack Defs  

Pops the top of stack value, converts it into a boolean, if the result is false, jumps to a 32-bit offset from the current bytecode.

The idea is that a sequence like JSOP_ZERO; JSOP_ZERO; JSOP_EQ; JSOP_IFEQ; JSOP_RETURN; reads like a nice linear sequence that will execute the return.

JSOP_IFNE [-1, +0] (JUMP)
Value 8 (0x08)
Operands int32_t offset
Length 5
Stack Uses cond
Stack Defs  

Pops the top of stack value, converts it into a boolean, if the result is true, jumps to a 32-bit offset from the current bytecode.

JSOP_LABEL [-0, +0] (JUMP)
Value 106 (0x6a)
Operands int32_t offset
Length 5
Stack Uses  
Stack Defs  

This opcode precedes every labeled statement. It's a no-op.

offset is the offset to the next instruction after this statement, the one break LABEL; would jump to. IonMonkey uses this.

JSOP_LOOPENTRY [-0, +0] (UINT8)
Value 227 (0xe3)
Operands uint8_t BITFIELD
Length 2
Stack Uses  
Stack Defs  

This opcode is the target of the entry jump for some loop. The uint8 argument is a bitfield. The lower 7 bits of the argument indicate the loop depth. This value starts at 1 and is just a hint: deeply nested loops all have the same value. The upper bit is set if Ion should be able to OSR at this point, which is true unless there is non-loop state on the stack.

JSOP_LOOPHEAD [-0, +0]
Value 109 (0x6d)
Operands  
Length 1
Stack Uses  
Stack Defs  

Another no-op.

This opcode is the target of the backwards jump for some loop.

JSOP_OR [-1, +1] (JUMP, DETECTING, LEFTASSOC)
Value 68 (0x44)
Operands int32_t offset
Length 5
Stack Uses cond
Stack Defs cond

Converts the top of stack value into a boolean, if the result is true, jumps to a 32-bit offset from the current bytecode.

Switch Statement

JSOP_CASE [-2, +1] (JUMP)
Value 121 (0x79)
Operands int32_t offset
Length 5
Stack Uses lval, rval
Stack Defs lval(if lval !== rval)

Pops the top two values on the stack as rval and lval, compare them with ===, if the result is true, jumps to a 32-bit offset from the current bytecode, re-pushes lval onto the stack if false.

JSOP_CONDSWITCH [-0, +0]
Value 120 (0x78)
Operands  
Length 1
Stack Uses  
Stack Defs  

This no-op appears after the bytecode for EXPR in switch (EXPR) {...} if the switch cannot be optimized using JSOP_TABLESWITCH. For a non-optimized switch statement like this:

   switch (EXPR) {
     case V0:
       C0;
     ...
     default:
       D;
   }

the bytecode looks like this:

   (EXPR)
   condswitch
   (V0)
   case ->C0
   ...
   default ->D
   (C0)
   ...
   (D)

Note that code for all case-labels is emitted first, then code for the body of each case clause.

JSOP_DEFAULT [-1, +0] (JUMP)
Value 122 (0x7a)
Operands int32_t offset
Length 5
Stack Uses lval
Stack Defs  

This appears after all cases in a JSOP_CONDSWITCH, whether there is a default: label in the switch statement or not. Pop the switch operand from the stack and jump to a 32-bit offset from the current bytecode. offset from the current bytecode.

JSOP_TABLESWITCH [-1, +0] (TABLESWITCH, DETECTING)
Value 70 (0x46)
Operands int32_t len, int32_t low, int32_t high,int32_t offset[0], ..., int32_t offset[high-low]
Length len
Stack Uses i
Stack Defs  

Pops the top of stack value as i, if low <= i <= high, jumps to a 32-bit offset: offset[i - low] from the current bytecode, jumps to a 32-bit offset: len from the current bytecode if not.

This opcode has variable length.

For-In Statement

JSOP_ENDITER [-1, +0]
Value 78 (0x4e)
Operands  
Length 1
Stack Uses iter
Stack Defs  

Exits a for-in loop by popping the iterator object from the stack and closing it.

JSOP_ISGENCLOSING [-1, +2]
Value 187 (0xbb)
Operands  
Length 1
Stack Uses val
Stack Defs val, res

Pushes a boolean indicating whether the top of the stack is MagicValue(JS_GENERATOR_CLOSING).

JSOP_ISNOITER [-1, +2]
Value 77 (0x4d)
Operands  
Length 1
Stack Uses val
Stack Defs val, res

Pushes a boolean indicating whether the value on top of the stack is MagicValue(JS_NO_ITER_VALUE).

JSOP_ITER [-1, +1] (UINT8)
Value 75 (0x4b)
Operands uint8_t flags
Length 2
Stack Uses val
Stack Defs iter

Sets up a for-in or for-each-in loop using the JSITER_* flag bits in this op's uint8_t immediate operand. It pops the top of stack value as val and pushes iter which is an iterator for val.

JSOP_MOREITER [-1, +2]
Value 76 (0x4c)
Operands  
Length 1
Stack Uses iter
Stack Defs iter, val

Pushes the next iterated value onto the stack. If no value is available, MagicValue(JS_NO_ITER_VALUE) is pushed.

With Statement

JSOP_ENTERWITH [-1, +0] (SCOPE)
Value 3 (0x03)
Operands uint32_t staticWithIndex
Length 5
Stack Uses val
Stack Defs  

Pops the top of stack value, converts it to an object, and adds a WithEnvironmentObject wrapping that object to the environment chain.

There is a matching JSOP_LEAVEWITH instruction later. All name lookups between the two that may need to consult the With object are deoptimized.

JSOP_LEAVEWITH [-0, +0]
Value 4 (0x04)
Operands  
Length 1
Stack Uses  
Stack Defs  

Pops the environment chain object pushed by JSOP_ENTERWITH.

Exception Handling

JSOP_EXCEPTION [-0, +1]
Value 118 (0x76)
Operands  
Length 1
Stack Uses  
Stack Defs exception

Pushes the current pending exception onto the stack and clears the pending exception. This is only emitted at the beginning of code for a catch-block, so it is known that an exception is pending. It is used to implement catch-blocks and yield*.

JSOP_FINALLY [-0, +2]
Value 135 (0x87)
Operands  
Length 1
Stack Uses  
Stack Defs false, (next bytecode's PC)

This opcode has a def count of 2, but these values are already on the stack (they're pushed by JSOP_GOSUB).

JSOP_GOSUB [-0, +0] (JUMP)
Value 116 (0x74)
Operands int32_t offset
Length 5
Stack Uses  
Stack Defs  

Pushes false and next bytecode's PC onto the stack, and jumps to a 32-bit offset from the current bytecode.

This opcode is used for entering finally block. When the execution resumes from finally block, those stack values are popped.

JSOP_RETSUB [-2, +0]
Value 117 (0x75)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs  

Pops the top two values on the stack as rval and lval, converts lval into a boolean, raises error if the result is true, jumps to a 32-bit absolute PC: rval if false.

This opcode is used for returning from finally block.

JSOP_THROW [-1, +0]
Value 112 (0x70)
Operands  
Length 1
Stack Uses v
Stack Defs  

Pops the top of stack value as v, sets pending exception as v, then raises error.

JSOP_THROWING [-1, +0]
Value 151 (0x97)
Operands  
Length 1
Stack Uses v
Stack Defs  

Pops the top of stack value as v, sets pending exception as v, to trigger rethrow.

This opcode is used in conditional catch clauses.

JSOP_THROWMSG [-0, +0] (UINT16)
Value 74 (0x4a)
Operands uint16_t msgNumber
Length 3
Stack Uses  
Stack Defs  

Sometimes we know when emitting that an operation will always throw.

Throws the indicated JSMSG.

JSOP_TRY [-0, +0]
Value 134 (0x86)
Operands  
Length 1
Stack Uses  
Stack Defs  

This no-op appears at the top of the bytecode for a TryStatement.

Location information for catch/finally blocks is stored in a side table, script->trynotes().

Function

JSOP_CALL [-(argc+2), +1] (UINT16, INVOKE, TYPESET)
Value 58 (0x3a)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1]
Stack Defs rval

Invokes callee with this and args, pushes return value onto the stack.

JSOP_CALLITER [-2, +1] (UINT16, INVOKE, TYPESET)
Value 145 (0x91)
Operands uint16_t argc (must be 0)
Length 3
Stack Uses callee, this
Stack Defs rval

Like JSOP_CALL, but used as part of for-of and destructuring bytecode to provide better error messages.

JSOP_CALL_IGNORES_RV [-(argc+2), +1] (UINT16, INVOKE, TYPESET)
Value 231 (0xe7)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1]
Stack Defs rval

Like JSOP_CALL, but tells the function that the return value is ignored. stack.

JSOP_CHECKISCALLABLE [-1, +1] (UINT8)
Value 219 (0xdb)
Operands uint8_t kind
Length 2
Stack Uses obj
Stack Defs obj

Checks that the top value on the stack is callable, and throws a TypeError if not. The operand kind is used only to generate an appropriate error message.

JSOP_EVAL [-(argc+2), +1] (UINT16, INVOKE, TYPESET, CHECKSLOPPY)
Value 123 (0x7b)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1]
Stack Defs rval

Invokes eval with args and pushes return value onto the stack.

If eval in global scope is not original one, invokes the function with this and args, and pushes return value onto the stack.

JSOP_FUNAPPLY [-(argc+2), +1] (UINT16, INVOKE, TYPESET)
Value 79 (0x4f)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1]
Stack Defs rval

Invokes callee with this and args, pushes return value onto the stack.

This is for f.apply.

JSOP_FUNCALL [-(argc+2), +1] (UINT16, INVOKE, TYPESET)
Value 108 (0x6c)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1]
Stack Defs rval

Invokes callee with this and args, pushes return value onto the stack.

If callee is determined to be the canonical Function.prototype.call function, then this operation is optimized to directly call callee with args[0] as this, and the remaining arguments as formal args to callee.

Like JSOP_FUNAPPLY but for f.call instead of f.apply.

JSOP_FUNWITHPROTO [-1, +1] (OBJECT)
Value 52 (0x34)
Operands uint32_t funcIndex
Length 5
Stack Uses proto
Stack Defs obj

Pushes a clone of a function with a given [[Prototype]] onto the stack.

JSOP_GETRVAL [-0, +1]
Value 2 (0x02)
Operands  
Length 1
Stack Uses  
Stack Defs rval

Pushes stack frame's rval onto the stack.

JSOP_LAMBDA [-0, +1] (OBJECT)
Value 130 (0x82)
Operands uint32_t funcIndex
Length 5
Stack Uses  
Stack Defs obj

Pushes a closure for a named or anonymous function expression onto the stack.

JSOP_LAMBDA_ARROW [-1, +1] (OBJECT)
Value 131 (0x83)
Operands uint32_t funcIndex
Length 5
Stack Uses new.target
Stack Defs obj

Pops the top of stack value as new.target, pushes an arrow function with lexical new.target onto the stack.

JSOP_NEW [-(argc+3), +1] (UINT16, INVOKE, TYPESET)
Value 82 (0x52)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1], newTarget
Stack Defs rval

Invokes callee as a constructor with this and args, pushes return value onto the stack.

JSOP_OPTIMIZE_SPREADCALL [-1, +2]
Value 178 (0xb2)
Operands  
Length 1
Stack Uses arr
Stack Defs arr, optimized

Pops the top stack value, pushes the value and a boolean value that indicates whether the spread operation for the value can be optimized in spread call.

JSOP_RETRVAL [-0, +0]
Value 153 (0x99)
Operands  
Length 1
Stack Uses  
Stack Defs  

Stops interpretation and returns value set by JSOP_SETRVAL. When not set, returns undefined.

Also emitted at end of script so interpreter don't need to check if opcode is still in script range.

JSOP_RETURN [-1, +0]
Value 5 (0x05)
Operands  
Length 1
Stack Uses rval
Stack Defs  

Pops the top of stack value as rval, stops interpretation of current script and returns rval.

JSOP_RUNONCE [-0, +0]
Value 71 (0x47)
Operands  
Length 1
Stack Uses  
Stack Defs  

Prologue emitted in scripts expected to run once, which deoptimizes code if it executes multiple times.

JSOP_SETFUNNAME [-2, +1] (UINT8)
Value 182 (0xb6)
Operands uint8_t prefixKind
Length 2
Stack Uses fun, name
Stack Defs fun

Pops the top two values on the stack as name and fun, defines the name of fun to name with prefix if any, and pushes fun back onto the stack.

JSOP_SETRVAL [-1, +0]
Value 152 (0x98)
Operands  
Length 1
Stack Uses rval
Stack Defs  

Pops the top of stack value as rval, sets the return value in stack frame as rval.

JSOP_SPREADCALL [-3, +1] (INVOKE, TYPESET)
Value 41 (0x29)
Operands  
Length 1
Stack Uses callee, this, args
Stack Defs rval

spreadcall variant of JSOP_CALL.

Invokes callee with this and args, pushes the return value onto the stack.

args is an Array object which contains actual arguments.

JSOP_SPREADEVAL [-3, +1] (INVOKE, TYPESET, CHECKSLOPPY)
Value 43 (0x2b)
Operands  
Length 1
Stack Uses callee, this, args
Stack Defs rval

spreadcall variant of JSOP_EVAL

Invokes eval with args and pushes the return value onto the stack.

If eval in global scope is not original one, invokes the function with this and args, and pushes return value onto the stack.

JSOP_SPREADNEW [-4, +1] (INVOKE, TYPESET)
Value 42 (0x2a)
Operands  
Length 1
Stack Uses callee, this, args, newTarget
Stack Defs rval

spreadcall variant of JSOP_NEW

Invokes callee as a constructor with this and args, pushes the return value onto the stack.

JSOP_SPREADSUPERCALL [-4, +1] (INVOKE, TYPESET)
Value 166 (0xa6)
Operands  
Length 1
Stack Uses callee, this, args, newTarget
Stack Defs rval

spreadcall variant of JSOP_SUPERCALL.

Behaves exactly like JSOP_SPREADNEW.

JSOP_STRICTEVAL [-(argc+2), +1] (UINT16, INVOKE, TYPESET, CHECKSTRICT)
Value 124 (0x7c)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1]
Stack Defs rval

Invokes eval with args and pushes return value onto the stack.

If eval in global scope is not original one, invokes the function with this and args, and pushes return value onto the stack.

JSOP_STRICTSPREADEVAL [-3, +1] (INVOKE, TYPESET, CHECKSTRICT)
Value 50 (0x32)
Operands  
Length 1
Stack Uses callee, this, args
Stack Defs rval

spreadcall variant of JSOP_EVAL

Invokes eval with args and pushes the return value onto the stack.

If eval in global scope is not original one, invokes the function with this and args, and pushes return value onto the stack.

JSOP_SUPERCALL [-(argc+3), +1] (UINT16, INVOKE, TYPESET)
Value 165 (0xa5)
Operands uint16_t argc
Length 3
Stack Uses callee, this, args[0], ..., args[argc-1], newTarget
Stack Defs rval

Behaves exactly like JSOP_NEW, but allows JITs to distinguish the two cases.

JSOP_TOASYNC [-1, +1]
Value 149 (0x95)
Operands  
Length 1
Stack Uses unwrapped
Stack Defs wrapped

Pops the top of stack value as unwrapped, converts it to async function wrapped, and pushes wrapped back on the stack.

Generator

JSOP_AWAIT [-2, +1] (UINT24)
Value 209 (0xd1)
Operands uint24_t yieldAndAwaitIndex
Length 4
Stack Uses promise, gen
Stack Defs resolved

Pops the generator and the return value promise, stops interpretation and returns promise. Pushes resolved value onto the stack.

JSOP_CHECKISOBJ [-1, +1] (UINT8)
Value 14 (0x0e)
Operands uint8_t kind
Length 2
Stack Uses result
Stack Defs result

Checks that the top value on the stack is an object, and throws a TypeError if not. The operand kind is used only to generate an appropriate error message.

JSOP_FINALYIELDRVAL [-1, +0]
Value 204 (0xcc)
Operands  
Length 1
Stack Uses gen
Stack Defs  

Pops the generator and suspends and closes it. Yields the value in the frame's return value slot.

JSOP_GENERATOR [-0, +1]
Value 212 (0xd4)
Operands  
Length 1
Stack Uses  
Stack Defs generator

Initializes generator frame, creates a generator and pushes it on the stack.

JSOP_INITIALYIELD [-1, +1] (UINT24)
Value 202 (0xca)
Operands uint24_t yieldAndAwaitIndex
Length 4
Stack Uses generator
Stack Defs generator

Pops the generator from the top of the stack, suspends it and stops interpretation.

JSOP_RESUME [-2, +1] (UINT8, INVOKE)
Value 205 (0xcd)
Operands resume kind (GeneratorObject::ResumeKind)
Length 3
Stack Uses gen, val
Stack Defs rval

Pops the generator and argument from the stack, pushes a new generator frame and resumes execution of it. Pushes the return value after the generator yields.

JSOP_YIELD [-2, +1] (UINT24)
Value 203 (0xcb)
Operands uint24_t yieldAndAwaitIndex
Length 4
Stack Uses rval1, gen
Stack Defs rval2

Pops the generator and the return value rval1, stops interpretation and returns rval1. Pushes sent value from send() onto the stack.

Debugger

JSOP_DEBUGGER [-0, +0]
Value 115 (0x73)
Operands  
Length 1
Stack Uses  
Stack Defs  

Invokes debugger.

JSOP_DEBUGLEAVELEXICALENV [-0, +0]
Value 201 (0xc9)
Operands  
Length 1
Stack Uses  
Stack Defs  

The opcode to assist the debugger.

Variables and Scopes

Variables

JSOP_BINDNAME [-0, +1] (ATOM, NAME)
Value 110 (0x6e)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs env

Looks up name on the environment chain and pushes the environment which contains the name onto the stack. If not found, pushes global lexical environment onto the stack.

JSOP_DEFCONST [-0, +0] (ATOM)
Value 128 (0x80)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs  
Defines the new constant binding on global lexical environment.

Throws if a binding with the same name already exists on the environment, or if a var binding with the same name exists on the global.

JSOP_DEFFUN [-1, +0]
Value 127 (0x7f)
Operands  
Length 1
Stack Uses fun
Stack Defs  

Defines the given function on the current scope.

This is used for global scripts and also in some cases for function scripts where use of dynamic scoping inhibits optimization.

JSOP_DEFLET [-0, +0] (ATOM)
Value 162 (0xa2)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs  
Defines the new mutable binding on global lexical environment.

Throws if a binding with the same name already exists on the environment, or if a var binding with the same name exists on the global.

JSOP_DEFVAR [-0, +0] (ATOM)
Value 129 (0x81)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs  

Defines the new binding on the frame's current variables-object (the environment on the environment chain designated to receive new variables).

Throws if the current variables-object is the global object and a binding with the same name exists on the global lexical environment.

This is used for global scripts and also in some cases for function scripts where use of dynamic scoping inhibits optimization.

JSOP_DELNAME [-0, +1] (ATOM, NAME, CHECKSLOPPY)
Value 36 (0x24)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs succeeded

Looks up name on the environment chain and deletes it, pushes true onto the stack if succeeded (if the property was present and deleted or if the property wasn't present in the first place), false if not.

Strict mode code should never contain this opcode.

JSOP_GETIMPORT [-0, +1] (ATOM, NAME, TYPESET)
Value 176 (0xb0)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs val

Gets the value of a module import by name and pushes it onto the stack.

JSOP_GETNAME [-0, +1] (ATOM, NAME, TYPESET)
Value 59 (0x3b)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs val

Looks up name on the environment chain and pushes its value onto the stack.

JSOP_SETNAME [-2, +1] (ATOM, NAME, PROPSET, DETECTING, CHECKSLOPPY)
Value 111 (0x6f)
Operands uint32_t nameIndex
Length 5
Stack Uses env, val
Stack Defs val

Pops an environment and value from the stack, assigns value to the given name, and pushes the value back on the stack

JSOP_STRICTSETNAME [-2, +1] (ATOM, NAME, PROPSET, DETECTING, CHECKSTRICT)
Value 49 (0x31)
Operands uint32_t nameIndex
Length 5
Stack Uses env, val
Stack Defs val

Pops a environment and value from the stack, assigns value to the given name, and pushes the value back on the stack. If the set failed, then throw a TypeError, per usual strict mode semantics.

Free Variables

JSOP_BINDGNAME [-0, +1] (ATOM, NAME, GNAME)
Value 214 (0xd6)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs global

Pushes the global environment onto the stack if the script doesn't have a non-syntactic global scope. Otherwise will act like JSOP_BINDNAME.

nameIndex is only used when acting like JSOP_BINDNAME.

JSOP_BINDVAR [-0, +1]
Value 213 (0xd5)
Operands  
Length 1
Stack Uses  
Stack Defs env

Pushes the nearest var environment.

JSOP_GETGNAME [-0, +1] (ATOM, NAME, TYPESET, GNAME)
Value 154 (0x9a)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs val

Looks up name on global environment and pushes its value onto the stack, unless the script has a non-syntactic global scope, in which case it acts just like JSOP_NAME.

Free variable references that must either be found on the global or a ReferenceError.

JSOP_INITGLEXICAL [-1, +1] (ATOM, NAME, PROPINIT, GNAME)
Value 161 (0xa1)
Operands uint32_t nameIndex
Length 5
Stack Uses val
Stack Defs val

Initializes an uninitialized global lexical binding with the top of stack value.

JSOP_SETGNAME [-2, +1] (ATOM, NAME, PROPSET, DETECTING, GNAME, CHECKSLOPPY)
Value 155 (0x9b)
Operands uint32_t nameIndex
Length 5
Stack Uses env, val
Stack Defs val

Pops the top two values on the stack as val and env, sets property of env as val and pushes val back on the stack.

env should be the global lexical environment unless the script has a non-syntactic global scope, in which case acts like JSOP_SETNAME.

JSOP_STRICTSETGNAME [-2, +1] (ATOM, NAME, PROPSET, DETECTING, GNAME, CHECKSTRICT)
Value 156 (0x9c)
Operands uint32_t nameIndex
Length 5
Stack Uses env, val
Stack Defs val

Pops the top two values on the stack as val and env, sets property of env as val and pushes val back on the stack. Throws a TypeError if the set fails, per strict mode semantics.

env should be the global lexical environment unless the script has a non-syntactic global scope, in which case acts like JSOP_STRICTSETNAME.

Local Variables

JSOP_CHECKLEXICAL [-0, +0] (LOCAL, NAME)
Value 138 (0x8a)
Operands uint32_t localno
Length 4
Stack Uses  
Stack Defs  

Checks if the value of the local variable is the JS_UNINITIALIZED_LEXICAL magic, throwing an error if so.

JSOP_GETLOCAL [-0, +1] (LOCAL, NAME)
Value 86 (0x56)
Operands uint32_t localno
Length 4
Stack Uses  
Stack Defs val

Pushes the value of local variable onto the stack.

JSOP_INITLEXICAL [-1, +1] (LOCAL, NAME, DETECTING)
Value 139 (0x8b)
Operands uint32_t localno
Length 4
Stack Uses v
Stack Defs v

Initializes an uninitialized local lexical binding with the top of stack value.

JSOP_SETLOCAL [-1, +1] (LOCAL, NAME, DETECTING)
Value 87 (0x57)
Operands uint32_t localno
Length 4
Stack Uses v
Stack Defs v

Stores the top stack value to the given local.

JSOP_THROWSETCALLEE [-1, +1]
Value 179 (0xb3)
Operands  
Length 1
Stack Uses v
Stack Defs v

Throws a runtime TypeError for invalid assignment to the callee in a named lambda, which is always a const binding. This is a different bytecode than JSOP_SETCONST because the named lambda callee, if not closed over, does not have a frame slot to look up the name with for the error message.

JSOP_THROWSETCONST [-1, +1] (LOCAL, NAME, DETECTING)
Value 169 (0xa9)
Operands uint32_t localno
Length 4
Stack Uses v
Stack Defs v

Throws a runtime TypeError for invalid assignment to const. The localno is used for better error messages.

Aliased Variables

JSOP_CHECKALIASEDLEXICAL [-0, +0] (ENVCOORD, NAME)
Value 140 (0x8c)
Operands uint8_t hops, uint24_t slot
Length 5
Stack Uses  
Stack Defs  

Checks if the value of the aliased variable is the JS_UNINITIALIZED_LEXICAL magic, throwing an error if so.

JSOP_GETALIASEDVAR [-0, +1] (ENVCOORD, NAME, TYPESET)
Value 136 (0x88)
Operands uint8_t hops, uint24_t slot
Length 5
Stack Uses  
Stack Defs aliasedVar

Pushes aliased variable onto the stack.

An "aliased variable" is a var, let, or formal arg that is aliased. Sources of aliasing include: nested functions accessing the vars of an enclosing function, function statements that are conditionally executed, eval, with, and arguments. All of these cases require creating a CallObject to own the aliased variable.

An ALIASEDVAR opcode contains the following immediates:

uint8 hops: the number of environment objects to skip to find the
             EnvironmentObject containing the variable being accessed
uint24 slot: the slot containing the variable in the EnvironmentObject
             (this 'slot' does not include RESERVED_SLOTS).
JSOP_INITALIASEDLEXICAL [-1, +1] (ENVCOORD, NAME, PROPINIT, DETECTING)
Value 141 (0x8d)
Operands uint8_t hops, uint24_t slot
Length 5
Stack Uses v
Stack Defs v

Initializes an uninitialized aliased lexical binding with the top of stack value.

JSOP_SETALIASEDVAR [-1, +1] (ENVCOORD, NAME, PROPSET, DETECTING)
Value 137 (0x89)
Operands uint8_t hops, uint24_t slot
Length 5
Stack Uses v
Stack Defs v

Sets aliased variable as the top of stack value.

JSOP_THROWSETALIASEDCONST [-1, +1] (ENVCOORD, NAME, DETECTING)
Value 170 (0xaa)
Operands uint8_t hops, uint24_t slot
Length 5
Stack Uses v
Stack Defs v

Throws a runtime TypeError for invalid assignment to const. The environment coordinate is used for better error messages.

Intrinsics

JSOP_GETINTRINSIC [-0, +1] (ATOM, NAME, TYPESET)
Value 143 (0x8f)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs intrinsic[name]
Pushes the value of the intrinsic onto the stack.

Intrinsic names are emitted instead of JSOP_*NAME ops when the CompileOptions flag selfHostingMode is set.

They are used in self-hosted code to access other self-hosted values and intrinsic functions the runtime doesn't give client JS code access to.

JSOP_SETINTRINSIC [-1, +1] (ATOM, NAME, DETECTING)
Value 144 (0x90)
Operands uint32_t nameIndex
Length 5
Stack Uses val
Stack Defs val

Stores the top stack value in the specified intrinsic.

Block-local Scope

JSOP_FRESHENLEXICALENV [-0, +0]
Value 197 (0xc5)
Operands  
Length 1
Stack Uses  
Stack Defs  

Replaces the current block on the env chain with a fresh block that copies all the bindings in the bock. This operation implements the behavior of inducing a fresh lexical environment for every iteration of a for(let ...; ...; ...) loop, if any declarations induced by such a loop are captured within the loop.

JSOP_POPLEXICALENV [-0, +0]
Value 200 (0xc8)
Operands  
Length 1
Stack Uses  
Stack Defs  

Pops lexical environment from the env chain.

JSOP_PUSHLEXICALENV [-0, +0] (SCOPE)
Value 199 (0xc7)
Operands uint32_t scopeIndex
Length 5
Stack Uses  
Stack Defs  

Pushes lexical environment onto the env chain.

JSOP_RECREATELEXICALENV [-0, +0]
Value 198 (0xc6)
Operands  
Length 1
Stack Uses  
Stack Defs  

Recreates the current block on the env chain with a fresh block with uninitialized bindings. This operation implements the behavior of inducing a fresh lexical environment for every iteration of a for-in/of loop whose loop-head has a (captured) lexical declaration.

This

JSOP_CHECKRETURN [-1, +0]
Value 190 (0xbe)
Operands  
Length 1
Stack Uses this
Stack Defs  

Check if a derived class constructor has a valid return value and this value before it returns. If the return value is not an object, stores the this value to the return value slot.

JSOP_CHECKTHIS [-1, +1]
Value 189 (0xbd)
Operands  
Length 1
Stack Uses this
Stack Defs this

Throw if the value on top of the stack is the TDZ MagicValue. Used in derived class constructors.

JSOP_CHECKTHISREINIT [-1, +1]
Value 191 (0xbf)
Operands  
Length 1
Stack Uses this
Stack Defs this

Throw an exception if the value on top of the stack is not the TDZ MagicValue. Used in derived class constructors.

JSOP_FUNCTIONTHIS [-0, +1]
Value 185 (0xb9)
Operands  
Length 1
Stack Uses  
Stack Defs this

Determines the this value for current function frame and pushes it onto the stack. Emitted in the prologue of functions with a this-binding.

JSOP_GIMPLICITTHIS [-0, +1] (ATOM)
Value 157 (0x9d)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs this

Pushes the implicit this value for calls to the associated name onto the stack; only used when we know this implicit this will be our first non-syntactic scope.

JSOP_GLOBALTHIS [-0, +1]
Value 186 (0xba)
Operands  
Length 1
Stack Uses  
Stack Defs this

Pushes this value for current stack frame onto the stack. Emitted when this refers to the global this.

JSOP_IMPLICITTHIS [-0, +1] (ATOM)
Value 226 (0xe2)
Operands uint32_t nameIndex
Length 5
Stack Uses  
Stack Defs this

Pushes the implicit this value for calls to the associated name onto the stack.

Super

JSOP_SUPERBASE [-0, +1]
Value 103 (0x67)
Operands  
Length 1
Stack Uses  
Stack Defs homeObjectProto

Pushes the prototype of the home object for current callee onto the stack.

JSOP_SUPERFUN [-0, +1]
Value 164 (0xa4)
Operands  
Length 1
Stack Uses  
Stack Defs superFun

Find the function to invoke with |super()| on the environment chain.

Arguments

JSOP_ARGUMENTS [-0, +1]
Value 9 (0x09)
Operands  
Length 1
Stack Uses  
Stack Defs arguments

Pushes the arguments object for the current function activation.

If JSScript is not marked needsArgsObj, then a JS_OPTIMIZED_ARGUMENTS magic value is pushed. Otherwise, a proper arguments object is constructed and pushed.

This opcode requires that the function does not have rest parameter.

JSOP_CALLEE [-0, +1]
Value 132 (0x84)
Operands  
Length 1
Stack Uses  
Stack Defs callee

Pushes current callee onto the stack.

Used for named function expression self-naming, if lightweight.

JSOP_GETARG [-0, +1] (QARG , NAME)
Value 84 (0x54)
Operands uint16_t argno
Length 3
Stack Uses  
Stack Defs arguments[argno]

Fast get op for function arguments and local variables.

Pushes arguments[argno] onto the stack.

JSOP_NEWTARGET [-0, +1]
Value 148 (0x94)
Operands  
Length 1
Stack Uses  
Stack Defs new.target

Push "new.target"

JSOP_REST [-0, +1] (TYPESET)
Value 224 (0xe0)
Operands  
Length 1
Stack Uses  
Stack Defs rest

Creates rest parameter array for current function call, and pushes it onto the stack.

JSOP_SETARG [-1, +1] (QARG , NAME)
Value 85 (0x55)
Operands uint16_t argno
Length 3
Stack Uses v
Stack Defs v

Fast set op for function arguments and local variables.

Sets arguments[argno] as the top of stack value.

Var Scope

JSOP_POPVARENV [-0, +0]
Value 181 (0xb5)
Operands  
Length 1
Stack Uses  
Stack Defs  

Pops a var environment from the env chain.

JSOP_PUSHVARENV [-0, +0] (SCOPE)
Value 180 (0xb4)
Operands uint32_t scopeIndex
Length 5
Stack Uses  
Stack Defs  

Pushes a var environment onto the env chain.

Operators

Comparison Operators

JSOP_EQ [-2, +1] (LEFTASSOC, ARITH, DETECTING)
JSOP_GE [-2, +1] (LEFTASSOC, ARITH)
JSOP_GT [-2, +1] (LEFTASSOC, ARITH)
JSOP_LE [-2, +1] (LEFTASSOC, ARITH)
JSOP_LT [-2, +1] (LEFTASSOC, ARITH)
JSOP_NE [-2, +1] (LEFTASSOC, ARITH, DETECTING)
Value JSOP_EQ: 18 (0x12)
JSOP_GE: 23 (0x17)
JSOP_GT: 22 (0x16)
JSOP_LE: 21 (0x15)
JSOP_LT: 20 (0x14)
JSOP_NE: 19 (0x13)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval OP rval)

Pops the top two values from the stack and pushes the result of comparing them.

JSOP_STRICTEQ [-2, +1] (DETECTING, LEFTASSOC, ARITH)
JSOP_STRICTNE [-2, +1] (DETECTING, LEFTASSOC, ARITH)
Value JSOP_STRICTEQ: 72 (0x48)
JSOP_STRICTNE: 73 (0x49)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval OP rval)

Pops the top two values from the stack, then pushes the result of applying the operator to the two values.

Arithmetic Operators

JSOP_ADD [-2, +1] (LEFTASSOC, ARITH)
Value 27 (0x1b)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval + rval)

Pops the top two values lval and rval from the stack, then pushes the result of lval + rval.

JSOP_DIV [-2, +1] (LEFTASSOC, ARITH)
JSOP_MOD [-2, +1] (LEFTASSOC, ARITH)
JSOP_MUL [-2, +1] (LEFTASSOC, ARITH)
JSOP_SUB [-2, +1] (LEFTASSOC, ARITH)
Value JSOP_DIV: 30 (0x1e)
JSOP_MOD: 31 (0x1f)
JSOP_MUL: 29 (0x1d)
JSOP_SUB: 28 (0x1c)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval OP rval)

Pops the top two values lval and rval from the stack, then pushes the result of applying the arithmetic operation to them.

JSOP_NEG [-1, +1] (ARITH)
Value 34 (0x22)
Operands  
Length 1
Stack Uses val
Stack Defs (-val)

Pops the value val from the stack, then pushes -val.

JSOP_POS [-1, +1] (ARITH)
Value 35 (0x23)
Operands  
Length 1
Stack Uses val
Stack Defs (+val)

Pops the value val from the stack, then pushes +val. (+val is the value converted to a number.)

JSOP_POW [-2, +1] (ARITH)
Value 150 (0x96)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval ** rval)

Pops the top two values lval and rval from the stack, then pushes the result of Math.pow(lval, rval).

Bitwise Logical Operators

JSOP_BITAND [-2, +1] (LEFTASSOC, ARITH)
JSOP_BITOR [-2, +1] (LEFTASSOC, ARITH)
JSOP_BITXOR [-2, +1] (LEFTASSOC, ARITH)
Value JSOP_BITAND: 17 (0x11)
JSOP_BITOR: 15 (0x0f)
JSOP_BITXOR: 16 (0x10)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval OP rval)

Pops the top two values lval and rval from the stack, then pushes the result of the operation applied to the two operands, converting both to 32-bit signed integers if necessary.

JSOP_BITNOT [-1, +1] (ARITH)
Value 33 (0x21)
Operands  
Length 1
Stack Uses val
Stack Defs (~val)

Pops the value val from the stack, then pushes ~val.

Bitwise Shift Operators

JSOP_LSH [-2, +1] (LEFTASSOC, ARITH)
JSOP_RSH [-2, +1] (LEFTASSOC, ARITH)
Value JSOP_LSH: 24 (0x18)
JSOP_RSH: 25 (0x19)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval OP rval)

Pops the top two values lval and rval from the stack, then pushes the result of the operation applied to the operands.

JSOP_URSH [-2, +1] (LEFTASSOC, ARITH)
Value 26 (0x1a)
Operands  
Length 1
Stack Uses lval, rval
Stack Defs (lval >>> rval)

Pops the top two values lval and rval from the stack, then pushes lval >>> rval.

Logical Operators

JSOP_NOT [-1, +1] (ARITH, DETECTING)
Value 32 (0x20)
Operands  
Length 1
Stack Uses val
Stack Defs (!val)

Pops the value val from the stack, then pushes !val.

Special Operators

JSOP_DELELEM [-2, +1] (BYTE , ELEM, CHECKSLOPPY)
Value 38 (0x26)
Operands  
Length 1
Stack Uses obj, propval
Stack Defs succeeded

Pops the top two values on the stack as propval and obj, deletes propval property from obj, pushes true onto the stack if succeeded, false if not.

JSOP_DELPROP [-1, +1] (ATOM, PROP, CHECKSLOPPY)
Value 37 (0x25)
Operands uint32_t nameIndex
Length 5
Stack Uses obj
Stack Defs succeeded

Pops the top of stack value, deletes property from it, pushes true onto the stack if succeeded, false if not.

JSOP_IN [-2, +1] (LEFTASSOC)
Value 113 (0x71)
Operands  
Length 1
Stack Uses id, obj
Stack Defs (id in obj)

Pops the top two values id and obj from the stack, then pushes id in obj. This will throw a TypeError if obj is not an object.

Note that obj is the top value.

JSOP_INSTANCEOF [-2, +1] (LEFTASSOC)
Value 114 (0x72)
Operands  
Length 1
Stack Uses obj, ctor
Stack Defs (obj instanceof ctor)

Pops the top two values obj and ctor from the stack, then pushes obj instanceof ctor. This will throw a TypeError if obj is not an object.

JSOP_STRICTDELPROP [-1, +1] (ATOM, PROP, CHECKSTRICT)
Value 46 (0x2e)
Operands uint32_t nameIndex
Length 5
Stack Uses obj
Stack Defs succeeded

Pops the top of stack value and attempts to delete the given property from it. Pushes true onto success, else throws a TypeError per strict mode property-deletion requirements.

JSOP_TYPEOF [-1, +1] (DETECTING)
Value 39 (0x27)
Operands  
Length 1
Stack Uses val
Stack Defs (typeof val)

Pops the value val from the stack, then pushes typeof val.

JSOP_TYPEOFEXPR [-1, +1] (DETECTING)
Value 196 (0xc4)
Operands  
Length 1
Stack Uses val
Stack Defs (typeof val)

Pops the top stack value as val and pushes typeof val. Note that this opcode isn't used when, in the original source code, val is a name -- see JSOP_TYPEOF for that. (This is because typeof undefinedName === "undefined".)

JSOP_VOID [-1, +1]
Value 40 (0x28)
Operands  
Length 1
Stack Uses val
Stack Defs undefined

Pops the top value on the stack and pushes undefined.

Stack Operations

JSOP_DUP [-1, +2]
Value 12 (0x0c)
Operands  
Length 1
Stack Uses v
Stack Defs v, v

Pushes a copy of the top value on the stack.

JSOP_DUP2 [-2, +4]
Value 13 (0x0d)
Operands  
Length 1
Stack Uses v1, v2
Stack Defs v1, v2, v1, v2

Duplicates the top two values on the stack.

JSOP_DUPAT [-0, +1] (UINT24)
Value 44 (0x2c)
Operands uint24_t n
Length 4
Stack Uses v[n], v[n-1], ..., v[1], v[0]
Stack Defs v[n], v[n-1], ..., v[1], v[0], v[n]

Duplicates the Nth value from the top onto the stack.

JSOP_PICK [-0, +0] (UINT8)
Value 133 (0x85)
Operands uint8_t n
Length 2
Stack Uses v[n], v[n-1], ..., v[1], v[0]
Stack Defs v[n-1], ..., v[1], v[0], v[n]

Picks the nth element from the stack and moves it to the top of the stack.

JSOP_POP [-1, +0]
Value 81 (0x51)
Operands  
Length 1
Stack Uses v
Stack Defs  

Pops the top value off the stack.

JSOP_POPN [-n, +0] (UINT16)
Value 11 (0x0b)
Operands uint16_t n
Length 3
Stack Uses v[n-1], ..., v[1], v[0]
Stack Defs  

Pops the top n values from the stack.

JSOP_SWAP [-2, +2]
Value 10 (0x0a)
Operands  
Length 1
Stack Uses v1, v2
Stack Defs v2, v1

Swaps the top two values on the stack. This is useful for things like post-increment/decrement.

JSOP_UNPICK [-0, +0] (UINT8)
Value 183 (0xb7)
Operands uint8_t n
Length 2
Stack Uses v[n], v[n-1], ..., v[1], v[0]
Stack Defs v[0], v[n], v[n-1], ..., v[1]

Moves the top of the stack value under the nth element of the stack.

Debugger

JSOP_DEBUGAFTERYIELD [-0, +0]
Value 208 (0xd0)
Operands  
Length 1
Stack Uses  
Stack Defs  

Bytecode emitted after yield expressions to help the Debugger fix up the frame in the JITs. No-op in the interpreter.

Literals

Constants

JSOP_DOUBLE [-0, +1] (DOUBLE)
Value 60 (0x3c)
Operands uint32_t constIndex
Length 5
Stack Uses  
Stack Defs val

Pushes numeric constant onto the stack.

JSOP_FALSE [-0, +1]
JSOP_TRUE [-0, +1]
Value JSOP_FALSE: 66 (0x42)
JSOP_TRUE: 67 (0x43)
Operands  
Length 1
Stack Uses  
Stack Defs true/false

Pushes boolean value onto the stack.

JSOP_INT32 [-0, +1] (INT32)
Value 216 (0xd8)
Operands int32_t val
Length 5
Stack Uses  
Stack Defs val

Pushes 32-bit int immediate integer operand onto the stack.

JSOP_INT8 [-0, +1] (INT8)
Value 215 (0xd7)
Operands int8_t val
Length 2
Stack Uses  
Stack Defs val

Pushes 8-bit int immediate integer operand onto the stack.

JSOP_IS_CONSTRUCTING [-0, +1]
Value 65 (0x41)
Operands  
Length 1
Stack Uses  
Stack Defs JS_IS_CONSTRUCTING

Pushes JS_IS_CONSTRUCTING

JSOP_NULL [-0, +1]
Value 64 (0x40)
Operands  
Length 1
Stack Uses  
Stack Defs null

Pushes null onto the stack.

JSOP_ONE [-0, +1]
Value 63 (0x3f)
Operands  
Length 1
Stack Uses  
Stack Defs 1

Pushes 1 onto the stack.

JSOP_STRING [-0, +1] (ATOM)
Value 61 (0x3d)
Operands uint32_t atomIndex
Length 5
Stack Uses  
Stack Defs string

Pushes string constant onto the stack.

JSOP_SYMBOL [-0, +1] (UINT8)
Value 45 (0x2d)
Operands uint8_t n, the JS::SymbolCode of the symbol to use
Length 2
Stack Uses  
Stack Defs symbol

Push a well-known symbol onto the operand stack.

JSOP_UINT16 [-0, +1] (UINT16)
Value 88 (0x58)
Operands uint16_t val
Length 3
Stack Uses  
Stack Defs val

Pushes unsigned 16-bit int immediate integer operand onto the stack.

JSOP_UINT24 [-0, +1] (UINT24)
Value 188 (0xbc)
Operands uint24_t val
Length 4
Stack Uses  
Stack Defs val

Pushes unsigned 24-bit int immediate integer operand onto the stack.

JSOP_UNDEFINED [-0, +1]
Value 1 (0x01)
Operands  
Length 1
Stack Uses  
Stack Defs undefined

Pushes undefined onto the stack.

JSOP_UNINITIALIZED [-0, +1]
Value 142 (0x8e)
Operands  
Length 1
Stack Uses  
Stack Defs uninitialized

Pushes a JS_UNINITIALIZED_LEXICAL value onto the stack, representing an uninitialized lexical binding.

This opcode is used with the JSOP_INITLET opcode.

JSOP_ZERO [-0, +1]
Value 62 (0x3e)
Operands  
Length 1
Stack Uses  
Stack Defs 0

Pushes 0 onto the stack.

Object

JSOP_CALLELEM [-2, +1] (BYTE , ELEM, TYPESET, LEFTASSOC)
Value 193 (0xc1)
Operands  
Length 1
Stack Uses obj, propval
Stack Defs obj[propval]

Pops the top two values on the stack as propval and obj, pushes propval property of obj onto the stack.

Like JSOP_GETELEM but for call context.

JSOP_CALLPROP [-1, +1] (ATOM, PROP, TYPESET)
Value 184 (0xb8)
Operands uint32_t nameIndex
Length 5
Stack Uses obj
Stack Defs obj[name]

Pops the top of stack value, pushes property of it onto the stack.

Like JSOP_GETPROP but for call context.

JSOP_CALLSITEOBJ [-0, +1] (OBJECT)
Value 101 (0x65)
Operands uint32_t objectIndex
Length 5
Stack Uses  
Stack Defs obj

Pushes the call site object specified by objectIndex onto the stack. Defines the raw property specified by objectIndex + 1 on the call site object and freezes both the call site object as well as its raw property.

JSOP_CHECKOBJCOERCIBLE [-1, +1]
Value 163 (0xa3)
Operands  
Length 1
Stack Uses val
Stack Defs val

Throw if the value on the stack is not coerscible to an object (is |null| or |undefined|).

JSOP_CLASSHERITAGE [-1, +2]
Value 51 (0x33)
Operands  
Length 1
Stack Uses heritage
Stack Defs funcProto, objProto

Writes the [[Prototype]] objects for both a class and its .prototype to the stack, given the result of a heritage expression.

JSOP_GETBOUNDNAME [-1, +1] (ATOM, NAME, TYPESET)
Value 195 (0xc3)
Operands uint32_t nameIndex
Length 5
Stack Uses env
Stack Defs v

Pops an environment, gets the value of a bound name on it. If the name is not bound to the environment, throw a ReferenceError. Used in conjunction with BINDNAME.

JSOP_GETELEM [-2, +1] (BYTE , ELEM, TYPESET, LEFTASSOC)
Value 55 (0x37)
Operands  
Length 1
Stack Uses obj, propval
Stack Defs obj[propval]

Pops the top two values on the stack as propval and obj, pushes propval property of obj onto the stack.

JSOP_GETELEM_SUPER [-3, +1] (BYTE , ELEM, LEFTASSOC)
Value 125 (0x7d)
Operands  
Length 1
Stack Uses receiver, obj, propval
Stack Defs obj[propval]

LIKE JSOP_GETELEM but takes receiver on stack, and the propval is evaluated before the obj.

JSOP_GETPROP [-1, +1] (ATOM, PROP, TYPESET)
Value 53 (0x35)
Operands uint32_t nameIndex
Length 5
Stack Uses obj
Stack Defs obj[name]

Pops the top of stack value, pushes property of it onto the stack.

JSOP_GETPROP_SUPER [-2, +1] (ATOM, PROP)
Value 104 (0x68)
Operands uint32_t nameIndex
Length 5
Stack Uses receiver, obj
Stack Defs obj[name]

Pops the top two values, and pushes the property of one, using the other as the receiver.

JSOP_INITELEM [-3, +1] (ELEM, PROPINIT, DETECTING)
Value 94 (0x5e)
Operands  
Length 1
Stack Uses obj, id, val
Stack Defs obj

Initialize a numeric property in an object literal, like {1: x}.

Pops the top three values on the stack as val, id and obj, defines id property of obj as val, pushes obj onto the stack.

JSOP_INITELEM_GETTER [-3, +1] (ELEM, PROPINIT, DETECTING)
Value 99 (0x63)
Operands  
Length 1
Stack Uses obj, id, val
Stack Defs obj

Initialize a numeric getter in an object literal like {get 2() {}}.

Pops the top three values on the stack as val, id and obj, defines id getter of obj as val, pushes obj onto the stack.

JSOP_INITELEM_SETTER [-3, +1] (ELEM, PROPINIT, DETECTING)
Value 100 (0x64)
Operands  
Length 1
Stack Uses obj, id, val
Stack Defs obj

Initialize a numeric setter in an object literal like {set 2(v) {}}.

Pops the top three values on the stack as val, id and obj, defines id setter of obj as val, pushes obj onto the stack.

JSOP_INITHIDDENELEM [-3, +1] (ELEM, PROPINIT, DETECTING)
Value 175 (0xaf)
Operands  
Length 1
Stack Uses obj, id, val
Stack Defs obj

Initialize a non-enumerable numeric property in an object literal, like {1: x}.

Pops the top three values on the stack as val, id and obj, defines id property of obj as val, pushes obj onto the stack.

JSOP_INITHIDDENELEM_GETTER [-3, +1] (ELEM, PROPINIT, DETECTING)
Value 173 (0xad)
Operands  
Length 1
Stack Uses obj, id, val
Stack Defs obj

Initialize a non-enumerable numeric getter in an object literal like {get 2() {}}.

Pops the top three values on the stack as val, id and obj, defines id getter of obj as val, pushes obj onto the stack.

JSOP_INITHIDDENELEM_SETTER [-3, +1] (ELEM, PROPINIT, DETECTING)
Value 174 (0xae)
Operands  
Length 1
Stack Uses obj, id, val
Stack Defs obj

Initialize a non-enumerable numeric setter in an object literal like {set 2(v) {}}.

Pops the top three values on the stack as val, id and obj, defines id setter of obj as val, pushes obj onto the stack.

JSOP_INITHIDDENPROP [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 147 (0x93)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a non-enumerable data-property on an object.

Pops the top two values on the stack as val and obj, defines nameIndex property of obj as val, pushes obj onto the stack.

JSOP_INITHIDDENPROP_GETTER [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 171 (0xab)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a non-enumerable getter in an object literal.

Pops the top two values on the stack as val and obj, defines getter of obj as val, pushes obj onto the stack.

JSOP_INITHIDDENPROP_SETTER [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 172 (0xac)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a non-enumerable setter in an object literal.

Pops the top two values on the stack as val and obj, defines setter of obj as val, pushes obj onto the stack.

JSOP_INITHOMEOBJECT [-2, +2] (UINT8)
Value 92 (0x5c)
Operands uint8_t n
Length 2
Stack Uses homeObject, [...n], fun
Stack Defs homeObject, [...n], fun

Initialize the home object for functions with super bindings.

This opcode takes the function and the object to be the home object, does the set, and leaves both on the stack.

JSOP_INITLOCKEDPROP [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 146 (0x92)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a non-configurable, non-writable, non-enumerable data-property on an object.

Pops the top two values on the stack as val and obj, defines nameIndex property of obj as val, pushes obj onto the stack.

JSOP_INITPROP [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 93 (0x5d)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a named property in an object literal, like {a: x}.

Pops the top two values on the stack as val and obj, defines nameIndex property of obj as val, pushes obj onto the stack.

JSOP_INITPROP_GETTER [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 97 (0x61)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a getter in an object literal.

Pops the top two values on the stack as val and obj, defines getter of obj as val, pushes obj onto the stack.

JSOP_INITPROP_SETTER [-2, +1] (ATOM, PROP, PROPINIT, DETECTING)
Value 98 (0x62)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize a setter in an object literal.

Pops the top two values on the stack as val and obj, defines setter of obj as val, pushes obj onto the stack.

JSOP_MUTATEPROTO [-2, +1]
Value 194 (0xc2)
Operands  
Length 1
Stack Uses obj, newProto
Stack Defs succeeded

__proto__: v inside an object initializer.

Pops the top two values on the stack as newProto and obj, sets prototype of obj as newProto, pushes true onto the stack if succeeded, false if not.

JSOP_NEWINIT [-0, +1] (UINT8)
Value 89 (0x59)
Operands uint8_t kind (, uint24_t extra)
Length 5
Stack Uses  
Stack Defs obj

Pushes newly created object onto the stack.

This opcode takes the kind of initializer (JSProto_Array or JSProto_Object).

This opcode has three extra bytes so it can be exchanged with JSOP_NEWOBJECT during emit.

JSOP_NEWOBJECT [-0, +1] (OBJECT)
Value 91 (0x5b)
Operands uint32_t baseobjIndex
Length 5
Stack Uses  
Stack Defs obj

Pushes newly created object onto the stack.

This opcode takes an object with the final shape, which can be set at the start and slots then filled in directly.

JSOP_OBJECT [-0, +1] (OBJECT)
Value 80 (0x50)
Operands uint32_t objectIndex
Length 5
Stack Uses  
Stack Defs obj

Pushes deep-cloned object literal or singleton onto the stack.

JSOP_OBJWITHPROTO [-1, +1]
Value 83 (0x53)
Operands  
Length 1
Stack Uses proto
Stack Defs obj

Pushes newly created object onto the stack with provided [[Prototype]].

JSOP_SETELEM [-3, +1] (BYTE , ELEM, PROPSET, DETECTING, CHECKSLOPPY)
Value 56 (0x38)
Operands  
Length 1
Stack Uses obj, propval, val
Stack Defs val

Pops the top three values on the stack as val, propval and obj, sets propval property of obj as val, pushes obj onto the stack.

JSOP_SETELEM_SUPER [-4, +1] (BYTE , ELEM, PROPSET, DETECTING, CHECKSLOPPY)
Value 158 (0x9e)
Operands  
Length 1
Stack Uses propval, receiver, obj, val
Stack Defs val

LIKE JSOP_SETELEM, but takes receiver on the stack, and the propval is evaluated before the base.

JSOP_SETPROP [-2, +1] (ATOM, PROP, PROPSET, DETECTING, CHECKSLOPPY)
Value 54 (0x36)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs val

Pops the top two values on the stack as val and obj and performs obj.prop = val, pushing val back onto the stack.

JSOP_SETPROP_SUPER [-3, +1] (ATOM, PROP, PROPSET, DETECTING, CHECKSLOPPY)
Value 107 (0x6b)
Operands uint32_t nameIndex
Length 5
Stack Uses receiver, obj, val
Stack Defs val

Pops the top three values on the stack as val, obj and receiver, and performs obj.prop = val, pushing val back onto the stack.

JSOP_STRICTDELELEM [-2, +1] (ELEM, CHECKSTRICT)
Value 47 (0x2f)
Operands  
Length 1
Stack Uses obj, propval
Stack Defs succeeded

Pops the top two values on the stack as propval and obj, and attempts to delete propval property from obj. Pushes true onto the stack on success, else throws a TypeError per strict mode property deletion requirements.

JSOP_STRICTSETELEM [-3, +1] (BYTE , ELEM, PROPSET, DETECTING, CHECKSTRICT)
Value 57 (0x39)
Operands  
Length 1
Stack Uses obj, propval, val
Stack Defs val

Pops the top three values on the stack as val, propval and obj, sets propval property of obj as val, pushes obj onto the stack. Throws a TypeError if the set fails, per strict mode semantics.

JSOP_STRICTSETELEM_SUPER [-4, +1] (BYTE , ELEM, PROPSET, DETECTING, CHECKSTRICT)
Value 159 (0x9f)
Operands  
Length 1
Stack Uses propval, receiver, obj, val
Stack Defs val

LIKE JSOP_STRICTSETELEM, but takes receiver on the stack, and the propval is evaluated before the base.

JSOP_STRICTSETPROP [-2, +1] (ATOM, PROP, PROPSET, DETECTING, CHECKSTRICT)
Value 48 (0x30)
Operands uint32_t nameIndex
Length 5
Stack Uses obj, val
Stack Defs val

Pops the top two values on the stack as val and obj, and performs obj.prop = val, pushing val back onto the stack. Throws a TypeError if the set-operation failed (per strict mode semantics).

JSOP_STRICTSETPROP_SUPER [-3, +1] (ATOM, PROP, PROPSET, DETECTING, CHECKSTRICT)
Value 105 (0x69)
Operands uint32_t nameIndex
Length 5
Stack Uses receiver, obj, val
Stack Defs val

Pops the top three values on the stack as val and obj, and receiver, and performs obj.prop = val, pushing val back onto the stack. Throws a TypeError if the set-operation failed (per strict mode semantics).

JSOP_TOID [-1, +1]
Value 225 (0xe1)
Operands  
Length 1
Stack Uses propertyNameValue
Stack Defs propertyKey

Replace the top-of-stack value propertyNameValue with ToPropertyKey(propertyNameValue).

Array

JSOP_ARRAYPUSH [-2, +0]
Value 206 (0xce)
Operands  
Length 1
Stack Uses v, obj
Stack Defs  

Pops the top two values on the stack as obj and v, pushes v to obj.

This opcode is used for Array Comprehension.

JSOP_HOLE [-0, +1]
Value 218 (0xda)
Operands  
Length 1
Stack Uses  
Stack Defs hole

Pushes a JS_ELEMENTS_HOLE value onto the stack, representing an omitted property in an array literal (e.g. property 0 in the array [, 1]).

This opcode is used with the JSOP_NEWARRAY opcode.

JSOP_INITELEM_ARRAY [-2, +1] (UINT32, ELEM, PROPINIT, DETECTING)
Value 96 (0x60)
Operands uint32_t index
Length 5
Stack Uses obj, val
Stack Defs obj

Initialize an array element.

Pops the top two values on the stack as val and obj, sets index property of obj as val, pushes obj onto the stack.

JSOP_INITELEM_INC [-3, +2] (ELEM, PROPINIT)
Value 95 (0x5f)
Operands  
Length 1
Stack Uses obj, index, val
Stack Defs obj, (index + 1)

Pops the top three values on the stack as val, index and obj, sets index property of obj as val, pushes obj and index + 1 onto the stack.

This opcode is used in Array literals with spread and spreadcall arguments.

JSOP_LENGTH [-1, +1] (ATOM, PROP, TYPESET)
Value 217 (0xd9)
Operands uint32_t nameIndex
Length 5
Stack Uses obj
Stack Defs obj['length']

Pops the top of stack value, pushes the length property of it onto the stack.

JSOP_NEWARRAY [-0, +1] (UINT32)
Value 90 (0x5a)
Operands uint32_t length
Length 5
Stack Uses  
Stack Defs obj

Pushes newly created array onto the stack.

This opcode takes the final length, which is preallocated.

JSOP_NEWARRAY_COPYONWRITE [-0, +1] (OBJECT)
Value 102 (0x66)
Operands uint32_t objectIndex
Length 5
Stack Uses  
Stack Defs obj

Pushes a newly created array onto the stack, whose elements are the same as that of a template object's copy on write elements.

JSOP_SPREADCALLARRAY [-0, +1] (UINT32)
Value 126 (0x7e)
Operands uint32_t length
Length 5
Stack Uses  
Stack Defs obj

Pushes newly created array for a spread call onto the stack. This has the same semantics as JSOP_NEWARRAY, but is distinguished to avoid using unboxed arrays in spread calls, which would make compiling spread calls in baseline more complex.

RegExp

JSOP_REGEXP [-0, +1] (REGEXP)
Value 160 (0xa0)
Operands uint32_t regexpIndex
Length 5
Stack Uses  
Stack Defs regexp

Pushes a regular expression literal onto the stack. It requires special "clone on exec" handling.

Class

JSOP_CLASSCONSTRUCTOR [-0, +1] (ATOM)
Value 167 (0xa7)
Operands atom className
Length 5
Stack Uses  
Stack Defs constructor

Push a default constructor for a base class literal.

JSOP_DERIVEDCONSTRUCTOR [-1, +1] (ATOM)
Value 168 (0xa8)
Operands atom className
Length 5
Stack Uses proto
Stack Defs constructor

Push a default constructor for a derived class literal.

Other

JSOP_DEBUGCHECKSELFHOSTED [-1, +1]
Value 177 (0xb1)
Operands  
Length 1
Stack Uses checkVal
Stack Defs checkVal

Examines the top stack value, asserting that it's either a self-hosted function or a self-hosted intrinsic. This opcode does nothing in a non-debug build.

JSOP_FORCEINTERPRETER [-0, +0]
Value 207 (0xcf)
Operands  
Length 1
Stack Uses  
Stack Defs  

No-op bytecode only emitted in some self-hosted functions. Not handled by the JITs so the script always runs in the interpreter.

JSOP_JUMPTARGET [-0, +0]
Value 230 (0xe6)
Operands  
Length 1
Stack Uses  
Stack Defs  

This opcode is a no-op and it indicates the location of a jump instruction target. Some other opcodes act as jump targets, such as LOOPENTRY, as well as all which are matched by BytecodeIsJumpTarget function.

JSOP_LINENO [-0, +0] (UINT32)
Value 119 (0x77)
Operands uint32_t lineno
Length 5
Stack Uses  
Stack Defs  

Embedded lineno to speedup pc->line mapping.

JSOP_NOP [-0, +0]
Value 0 (0x00)
Operands  
Length 1
Stack Uses  
Stack Defs  

No operation is performed.

JSOP_NOP_DESTRUCTURING [-0, +0]
Value 229 (0xe5)
Operands  
Length 1
Stack Uses  
Stack Defs  

No-op used by the decompiler to produce nicer error messages about destructuring code.

JSOP_TOSTRING [-1, +1]
Value 228 (0xe4)
Operands  
Length 1
Stack Uses val
Stack Defs ToString(val)

Converts the value on the top of the stack to a String

Document Tags and Contributors

Tags: 
 Contributors to this page: arai, teoli, h4writer, fscholz, evilpie, guptha, Waldo, cdleary
 Last updated by: arai,