michael@0: /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sw=4 et tw=0 ft=c: michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef vm_Opcodes_h michael@0: #define vm_Opcodes_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #include michael@0: michael@0: /* michael@0: * JavaScript operation bytecodes. Add a new bytecode by claiming one of the michael@0: * JSOP_UNUSED* here or by extracting the first unused opcode from michael@0: * FOR_EACH_TRAILING_UNUSED_OPCODE and updating js::detail::LastDefinedOpcode michael@0: * below. michael@0: * michael@0: * When changing the bytecode, don't forget to update XDR_BYTECODE_VERSION in michael@0: * vm/Xdr.h! michael@0: * michael@0: * Includers must define a macro with the following form: michael@0: * michael@0: * #define MACRO(op,val,name,image,length,nuses,ndefs,format) ... michael@0: * michael@0: * Then simply use FOR_EACH_OPCODE(MACRO) to invoke MACRO for every opcode. michael@0: * Selected arguments can be expanded in initializers. michael@0: * michael@0: * Field Description michael@0: * op Bytecode name, which is the JSOp enumerator name michael@0: * value Bytecode value, which is the JSOp enumerator value michael@0: * name C string containing name for disassembler michael@0: * image C string containing "image" for pretty-printer, null if ugly michael@0: * length Number of bytes including any immediate operands michael@0: * nuses Number of stack slots consumed by bytecode, -1 if variadic michael@0: * ndefs Number of stack slots produced by bytecode, -1 if variadic michael@0: * format Bytecode plus immediate operand encoding format michael@0: * michael@0: * This file is best viewed with 128 columns: michael@0: 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 michael@0: */ michael@0: michael@0: /* michael@0: * SpiderMonkey bytecode categorization (as used in generated documentation): michael@0: * michael@0: * [Index] michael@0: * [Statements] michael@0: * Jumps michael@0: * Switch Statement michael@0: * For-In Statement michael@0: * With Statement michael@0: * Exception Handling michael@0: * Function michael@0: * Generator michael@0: * Debugger michael@0: * [Variables and Scopes] michael@0: * Variables michael@0: * Free Variables michael@0: * Local Variables michael@0: * Aliased Variables michael@0: * Intrinsics michael@0: * Block-local Scope michael@0: * This michael@0: * Arguments michael@0: * [Operator] michael@0: * Comparison Operators michael@0: * Arithmetic Operators michael@0: * Bitwise Logical Operators michael@0: * Bitwise Shift Operators michael@0: * Logical Operators michael@0: * Special Operators michael@0: * Stack Operations michael@0: * [Literals] michael@0: * Constants michael@0: * Object michael@0: * Array michael@0: * RegExp michael@0: * [Other] michael@0: */ michael@0: michael@0: #define FOR_EACH_OPCODE(macro) \ michael@0: /* legend: op val name image len use def format */ \ michael@0: /* michael@0: * No operation is performed. michael@0: * Category: Other michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_NOP, 0, "nop", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* Long-standing JavaScript bytecodes. */ \ michael@0: /* michael@0: * Pushes 'undefined' onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: michael@0: * Stack: => undefined michael@0: */ \ michael@0: macro(JSOP_UNDEFINED, 1, js_undefined_str, "", 1, 0, 1, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED2, 2, "unused2", NULL, 1, 1, 0, JOF_BYTE) \ michael@0: macro(JSOP_ENTERWITH, 3, "enterwith", NULL, 5, 1, 0, JOF_OBJECT) \ michael@0: macro(JSOP_LEAVEWITH, 4, "leavewith", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: /* michael@0: * Pops the top of stack value as 'rval', stops interpretation of current michael@0: * script and returns 'rval'. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: rval => michael@0: */ \ michael@0: macro(JSOP_RETURN, 5, "return", NULL, 1, 1, 0, JOF_BYTE) \ michael@0: macro(JSOP_GOTO, 6, "goto", NULL, 5, 0, 0, JOF_JUMP) \ michael@0: macro(JSOP_IFEQ, 7, "ifeq", NULL, 5, 1, 0, JOF_JUMP|JOF_DETECTING) \ michael@0: macro(JSOP_IFNE, 8, "ifne", NULL, 5, 1, 0, JOF_JUMP) \ michael@0: \ michael@0: /* michael@0: * Pushes the 'arguments' object for the current function activation. michael@0: * michael@0: * If 'JSScript' is not marked 'needsArgsObj', then a michael@0: * JS_OPTIMIZED_ARGUMENTS magic value is pushed. Otherwise, a proper michael@0: * arguments object is constructed and pushed. michael@0: * michael@0: * This opcode requires that the function does not have rest parameter. michael@0: * Category: Variables and Scopes michael@0: * Type: Arguments michael@0: * Operands: michael@0: * Stack: => arguments michael@0: */ \ michael@0: macro(JSOP_ARGUMENTS, 9, "arguments", NULL, 1, 0, 1, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Swaps the top two values on the stack. This is useful for things like michael@0: * post-increment/decrement. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: michael@0: * Stack: v1, v2 => v2, v1 michael@0: */ \ michael@0: macro(JSOP_SWAP, 10, "swap", NULL, 1, 2, 2, JOF_BYTE) \ michael@0: /* michael@0: * Pops the top 'n' values from the stack. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: uint16_t n michael@0: * Stack: v[n-1], ..., v[1], v[0] => michael@0: * nuses: n michael@0: */ \ michael@0: macro(JSOP_POPN, 11, "popn", NULL, 3, -1, 0, JOF_UINT16) \ michael@0: \ michael@0: /* More long-standing bytecodes. */ \ michael@0: /* michael@0: * Pushes a copy of the top value on the stack. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: michael@0: * Stack: v => v, v michael@0: */ \ michael@0: macro(JSOP_DUP, 12, "dup", NULL, 1, 1, 2, JOF_BYTE) \ michael@0: /* michael@0: * Duplicates the top two values on the stack. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: michael@0: * Stack: v1, v2 => v1, v2, v1, v2 michael@0: */ \ michael@0: macro(JSOP_DUP2, 13, "dup2", NULL, 1, 2, 4, JOF_BYTE) \ michael@0: /* michael@0: * Defines a readonly property on the frame's current variables-object (the michael@0: * scope object on the scope chain designated to receive new variables). michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: val => val michael@0: */ \ michael@0: macro(JSOP_SETCONST, 14, "setconst", NULL, 5, 1, 1, JOF_ATOM|JOF_NAME|JOF_SET) \ michael@0: /* michael@0: * Pops the top two values 'lval' and 'rval' from the stack, then pushes michael@0: * the result of the operation applied to the two operands, converting michael@0: * both to 32-bit signed integers if necessary. michael@0: * Category: Operator michael@0: * Type: Bitwise Logical Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval OP rval) michael@0: */ \ michael@0: macro(JSOP_BITOR, 15, "bitor", "|", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_BITXOR, 16, "bitxor", "^", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_BITAND, 17, "bitand", "&", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: /* michael@0: * Pops the top two values from the stack and pushes the result of michael@0: * comparing them. michael@0: * Category: Operator michael@0: * Type: Comparison Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval OP rval) michael@0: */ \ michael@0: macro(JSOP_EQ, 18, "eq", "==", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH|JOF_DETECTING) \ michael@0: macro(JSOP_NE, 19, "ne", "!=", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH|JOF_DETECTING) \ michael@0: macro(JSOP_LT, 20, "lt", "<", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_LE, 21, "le", "<=", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_GT, 22, "gt", ">", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_GE, 23, "ge", ">=", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: /* michael@0: * Pops the top two values 'lval' and 'rval' from the stack, then pushes michael@0: * the result of the operation applied to the operands. michael@0: * Category: Operator michael@0: * Type: Bitwise Shift Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval OP rval) michael@0: */ \ michael@0: macro(JSOP_LSH, 24, "lsh", "<<", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_RSH, 25, "rsh", ">>", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: /* michael@0: * Pops the top two values 'lval' and 'rval' from the stack, then pushes michael@0: * 'lval >>> rval'. michael@0: * Category: Operator michael@0: * Type: Bitwise Shift Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval >>> rval) michael@0: */ \ michael@0: macro(JSOP_URSH, 26, "ursh", ">>>", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: /* michael@0: * Pops the top two values 'lval' and 'rval' from the stack, then pushes michael@0: * the result of 'lval + rval'. michael@0: * Category: Operator michael@0: * Type: Arithmetic Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval + rval) michael@0: */ \ michael@0: macro(JSOP_ADD, 27, "add", "+", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: /* michael@0: * Pops the top two values 'lval' and 'rval' from the stack, then pushes michael@0: * the result of applying the arithmetic operation to them. michael@0: * Category: Operator michael@0: * Type: Arithmetic Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval OP rval) michael@0: */ \ michael@0: macro(JSOP_SUB, 28, "sub", "-", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_MUL, 29, "mul", "*", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_DIV, 30, "div", "/", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_MOD, 31, "mod", "%", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: /* michael@0: * Pops the value 'val' from the stack, then pushes '!val'. michael@0: * Category: Operator michael@0: * Type: Logical Operators michael@0: * Operands: michael@0: * Stack: val => (!val) michael@0: */ \ michael@0: macro(JSOP_NOT, 32, "not", "!", 1, 1, 1, JOF_BYTE|JOF_ARITH|JOF_DETECTING) \ michael@0: /* michael@0: * Pops the value 'val' from the stack, then pushes '~val'. michael@0: * Category: Operator michael@0: * Type: Bitwise Logical Operators michael@0: * Operands: michael@0: * Stack: val => (~val) michael@0: */ \ michael@0: macro(JSOP_BITNOT, 33, "bitnot", "~", 1, 1, 1, JOF_BYTE|JOF_ARITH) \ michael@0: /* michael@0: * Pops the value 'val' from the stack, then pushes '-val'. michael@0: * Category: Operator michael@0: * Type: Arithmetic Operators michael@0: * Operands: michael@0: * Stack: val => (-val) michael@0: */ \ michael@0: macro(JSOP_NEG, 34, "neg", "- ", 1, 1, 1, JOF_BYTE|JOF_ARITH) \ michael@0: /* michael@0: * Pops the value 'val' from the stack, then pushes '+val'. michael@0: * ('+val' is the value converted to a number.) michael@0: * Category: Operator michael@0: * Type: Arithmetic Operators michael@0: * Operands: michael@0: * Stack: val => (+val) michael@0: */ \ michael@0: macro(JSOP_POS, 35, "pos", "+ ", 1, 1, 1, JOF_BYTE|JOF_ARITH) \ michael@0: /* michael@0: * Looks up name on the scope chain and deletes it, pushes 'true' onto the michael@0: * stack if succeeded (if the property was present and deleted or if the michael@0: * property wasn't present in the first place), 'false' if not. michael@0: * michael@0: * Strict mode code should never contain this opcode. michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => succeeded michael@0: */ \ michael@0: macro(JSOP_DELNAME, 36, "delname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME) \ michael@0: /* michael@0: * Pops the top of stack value, deletes property from it, pushes 'true' onto michael@0: * the stack if succeeded, 'false' if not. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj => succeeded michael@0: */ \ michael@0: macro(JSOP_DELPROP, 37, "delprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP) \ michael@0: /* michael@0: * Pops the top two values on the stack as 'propval' and 'obj', michael@0: * deletes 'propval' property from 'obj', pushes 'true' onto the stack if michael@0: * succeeded, 'false' if not. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, propval => succeeded michael@0: */ \ michael@0: macro(JSOP_DELELEM, 38, "delelem", NULL, 1, 2, 1, JOF_BYTE |JOF_ELEM) \ michael@0: /* michael@0: * Pops the value 'val' from the stack, then pushes 'typeof val'. michael@0: * Category: Operator michael@0: * Type: Special Operators michael@0: * Operands: michael@0: * Stack: val => (typeof val) michael@0: */ \ michael@0: macro(JSOP_TYPEOF, 39, js_typeof_str,NULL, 1, 1, 1, JOF_BYTE|JOF_DETECTING) \ michael@0: /* michael@0: * Pops the top value on the stack and pushes 'undefined'. michael@0: * Category: Operator michael@0: * Type: Special Operators michael@0: * Operands: michael@0: * Stack: val => undefined michael@0: */ \ michael@0: macro(JSOP_VOID, 40, js_void_str, NULL, 1, 1, 1, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * spreadcall variant of JSOP_CALL. michael@0: * michael@0: * Invokes 'callee' with 'this' and 'args', pushes the return value onto michael@0: * the stack. michael@0: * michael@0: * 'args' is an Array object which contains actual arguments. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: callee, this, args => rval michael@0: */ \ michael@0: macro(JSOP_SPREADCALL,41, "spreadcall", NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \ michael@0: /* michael@0: * spreadcall variant of JSOP_NEW michael@0: * michael@0: * Invokes 'callee' as a constructor with 'this' and 'args', pushes the michael@0: * return value onto the stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: callee, this, args => rval michael@0: */ \ michael@0: macro(JSOP_SPREADNEW, 42, "spreadnew", NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \ michael@0: /* michael@0: * spreadcall variant of JSOP_EVAL michael@0: * michael@0: * Invokes 'eval' with 'args' and pushes the return value onto the stack. michael@0: * michael@0: * If 'eval' in global scope is not original one, invokes the function michael@0: * with 'this' and 'args', and pushes return value onto the stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: callee, this, args => rval michael@0: */ \ michael@0: macro(JSOP_SPREADEVAL,43, "spreadeval", NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \ michael@0: \ michael@0: /* michael@0: * Duplicates the Nth value from the top onto the stack. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: uint24_t n michael@0: * Stack: v[n], v[n-1], ..., v[1], v[0] => michael@0: * v[n], v[n-1], ..., v[1], v[0], v[n] michael@0: */ \ michael@0: macro(JSOP_DUPAT, 44, "dupat", NULL, 4, 0, 1, JOF_UINT24) \ michael@0: \ michael@0: macro(JSOP_UNUSED45, 45, "unused45", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED46, 46, "unused46", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED47, 47, "unused47", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED48, 48, "unused48", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED49, 49, "unused49", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED50, 50, "unused50", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED51, 51, "unused51", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED52, 52, "unused52", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top of stack value, pushes property of it onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj => obj[name] michael@0: */ \ michael@0: macro(JSOP_GETPROP, 53, "getprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \ michael@0: /* michael@0: * Pops the top two values on the stack as 'val' and 'obj', sets property of michael@0: * 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj, val => val michael@0: */ \ michael@0: macro(JSOP_SETPROP, 54, "setprop", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ michael@0: /* michael@0: * Pops the top two values on the stack as 'propval' and 'obj', pushes michael@0: * 'propval' property of 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, propval => obj[propval] michael@0: */ \ michael@0: macro(JSOP_GETELEM, 55, "getelem", NULL, 1, 2, 1, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC) \ michael@0: /* michael@0: * Pops the top three values on the stack as 'val', 'propval' and 'obj', michael@0: * sets 'propval' property of 'obj' as 'val', pushes 'obj' onto the michael@0: * stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, propval, val => val michael@0: */ \ michael@0: macro(JSOP_SETELEM, 56, "setelem", NULL, 1, 3, 1, JOF_BYTE |JOF_ELEM|JOF_SET|JOF_DETECTING) \ michael@0: macro(JSOP_UNUSED57, 57, "unused57", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: /* michael@0: * Invokes 'callee' with 'this' and 'args', pushes return value onto the michael@0: * stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint16_t argc michael@0: * Stack: callee, this, args[0], ..., args[argc-1] => rval michael@0: * nuses: (argc+2) michael@0: */ \ michael@0: macro(JSOP_CALL, 58, "call", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ michael@0: /* michael@0: * Looks up name on the scope chain and pushes its value onto the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_NAME, 59, "name", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET) \ michael@0: /* michael@0: * Pushes numeric constant onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: uint32_t constIndex michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_DOUBLE, 60, "double", NULL, 5, 0, 1, JOF_DOUBLE) \ michael@0: /* michael@0: * Pushes string constant onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: uint32_t atomIndex michael@0: * Stack: => string michael@0: */ \ michael@0: macro(JSOP_STRING, 61, "string", NULL, 5, 0, 1, JOF_ATOM) \ michael@0: /* michael@0: * Pushes '0' onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: michael@0: * Stack: => 0 michael@0: */ \ michael@0: macro(JSOP_ZERO, 62, "zero", "0", 1, 0, 1, JOF_BYTE) \ michael@0: /* michael@0: * Pushes '1' onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: michael@0: * Stack: => 1 michael@0: */ \ michael@0: macro(JSOP_ONE, 63, "one", "1", 1, 0, 1, JOF_BYTE) \ michael@0: /* michael@0: * Pushes 'null' onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: michael@0: * Stack: => null michael@0: */ \ michael@0: macro(JSOP_NULL, 64, js_null_str, js_null_str, 1, 0, 1, JOF_BYTE) \ michael@0: /* michael@0: * Pushes 'this' value for current stack frame onto the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: This michael@0: * Operands: michael@0: * Stack: => this michael@0: */ \ michael@0: macro(JSOP_THIS, 65, js_this_str, js_this_str, 1, 0, 1, JOF_BYTE) \ michael@0: /* michael@0: * Pushes boolean value onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: michael@0: * Stack: => true/false michael@0: */ \ michael@0: macro(JSOP_FALSE, 66, js_false_str, js_false_str, 1, 0, 1, JOF_BYTE) \ michael@0: macro(JSOP_TRUE, 67, js_true_str, js_true_str, 1, 0, 1, JOF_BYTE) \ michael@0: macro(JSOP_OR, 68, "or", NULL, 5, 1, 1, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC) \ michael@0: macro(JSOP_AND, 69, "and", NULL, 5, 1, 1, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC) \ michael@0: \ michael@0: /* The switch bytecodes have variable length. */ \ michael@0: macro(JSOP_TABLESWITCH, 70, "tableswitch", NULL, -1, 1, 0, JOF_TABLESWITCH|JOF_DETECTING) \ michael@0: \ michael@0: /* michael@0: * Prologue emitted in scripts expected to run once, which deoptimizes code michael@0: * if it executes multiple times. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_RUNONCE, 71, "runonce", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* New, infallible/transitive identity ops. */ \ michael@0: /* michael@0: * Pops the top two values from the stack, then pushes the result of michael@0: * applying the operator to the two values. michael@0: * Category: Operator michael@0: * Type: Comparison Operators michael@0: * Operands: michael@0: * Stack: lval, rval => (lval OP rval) michael@0: */ \ michael@0: macro(JSOP_STRICTEQ, 72, "stricteq", "===", 1, 2, 1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: macro(JSOP_STRICTNE, 73, "strictne", "!==", 1, 2, 1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \ michael@0: \ michael@0: /* michael@0: * Sometimes web pages do 'o.Item(i) = j'. This is not an early SyntaxError, michael@0: * for web compatibility. Instead we emit JSOP_SETCALL after the function michael@0: * call, an opcode that always throws. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_SETCALL, 74, "setcall", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * JSOP_ITER sets up a for-in or for-each-in loop using the JSITER_* flag bits michael@0: * in this op's uint8_t immediate operand. It replaces the top of stack value michael@0: * with an iterator for that value. michael@0: * michael@0: * JSOP_MOREITER stores the next iterated value into cx->iterValue and pushes michael@0: * true if another value is available, and false otherwise. It is followed michael@0: * immediately by JSOP_IFNE. michael@0: * michael@0: * JSOP_ENDITER cleans up after the loop. It uses the slot above the iterator michael@0: * for temporary GC rooting. michael@0: */ \ michael@0: macro(JSOP_ITER, 75, "iter", NULL, 2, 1, 1, JOF_UINT8) \ michael@0: macro(JSOP_MOREITER, 76, "moreiter", NULL, 1, 1, 2, JOF_BYTE) \ michael@0: macro(JSOP_ITERNEXT, 77, "iternext", "", 1, 0, 1, JOF_BYTE) \ michael@0: macro(JSOP_ENDITER, 78, "enditer", NULL, 1, 1, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Invokes 'callee' with 'this' and 'args', pushes return value onto the michael@0: * stack. michael@0: * michael@0: * This is for 'f.apply'. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint16_t argc michael@0: * Stack: callee, this, args[0], ..., args[argc-1] => rval michael@0: * nuses: (argc+2) michael@0: */ \ michael@0: macro(JSOP_FUNAPPLY, 79, "funapply", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ michael@0: \ michael@0: /* michael@0: * Pushes deep-cloned object literal or singleton onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t objectIndex michael@0: * Stack: => obj michael@0: */ \ michael@0: macro(JSOP_OBJECT, 80, "object", NULL, 5, 0, 1, JOF_OBJECT) \ michael@0: \ michael@0: /* michael@0: * Pops the top value off the stack. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: michael@0: * Stack: v => michael@0: */ \ michael@0: macro(JSOP_POP, 81, "pop", NULL, 1, 1, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Invokes 'callee' as a constructor with 'this' and 'args', pushes return michael@0: * value onto the stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint16_t argc michael@0: * Stack: callee, this, args[0], ..., args[argc-1] => rval michael@0: * nuses: (argc+2) michael@0: */ \ michael@0: macro(JSOP_NEW, 82, js_new_str, NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ michael@0: /* michael@0: * Pops the top three values on the stack as 'iterable', 'index' and 'obj', michael@0: * iterates over 'iterable' and stores the iteration values as 'index + i' michael@0: * elements of 'obj', pushes 'obj' and 'index + iteration count' onto the michael@0: * stack. michael@0: * michael@0: * This opcode is used in Array literals with spread and spreadcall michael@0: * arguments. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: michael@0: * Stack: obj, index, iterable => obj, (index + iteration count) michael@0: */ \ michael@0: macro(JSOP_SPREAD, 83, "spread", NULL, 1, 3, 2, JOF_BYTE|JOF_ELEM|JOF_SET) \ michael@0: \ michael@0: /* michael@0: * Fast get op for function arguments and local variables. michael@0: * michael@0: * Pushes 'arguments[argno]' onto the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: Arguments michael@0: * Operands: uint16_t argno michael@0: * Stack: => arguments[argno] michael@0: */ \ michael@0: macro(JSOP_GETARG, 84, "getarg", NULL, 3, 0, 1, JOF_QARG |JOF_NAME) \ michael@0: /* michael@0: * Fast set op for function arguments and local variables. michael@0: * michael@0: * Sets 'arguments[argno]' as the top of stack value. michael@0: * Category: Variables and Scopes michael@0: * Type: Arguments michael@0: * Operands: uint16_t argno michael@0: * Stack: v => v michael@0: */ \ michael@0: macro(JSOP_SETARG, 85, "setarg", NULL, 3, 1, 1, JOF_QARG |JOF_NAME|JOF_SET) \ michael@0: /* michael@0: * Pushes the value of local variable onto the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: Local Variables michael@0: * Operands: uint32_t localno michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_GETLOCAL, 86,"getlocal", NULL, 4, 0, 1, JOF_LOCAL|JOF_NAME) \ michael@0: /* michael@0: * Stores the top stack value to the given local. michael@0: * Category: Variables and Scopes michael@0: * Type: Local Variables michael@0: * Operands: uint32_t localno michael@0: * Stack: v => v michael@0: */ \ michael@0: macro(JSOP_SETLOCAL, 87,"setlocal", NULL, 4, 1, 1, JOF_LOCAL|JOF_NAME|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: /* michael@0: * Pushes unsigned 16-bit int immediate integer operand onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: uint16_t val michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_UINT16, 88, "uint16", NULL, 3, 0, 1, JOF_UINT16) \ michael@0: \ michael@0: /* Object and array literal support. */ \ michael@0: /* michael@0: * Pushes newly created object onto the stack. michael@0: * michael@0: * This opcode takes the kind of initializer (JSProto_Array or michael@0: * JSProto_Object). michael@0: * michael@0: * This opcode has an extra byte so it can be exchanged with JSOP_NEWOBJECT michael@0: * during emit. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint8_t kind (, uint24_t extra) michael@0: * Stack: => obj michael@0: */ \ michael@0: macro(JSOP_NEWINIT, 89, "newinit", NULL, 5, 0, 1, JOF_UINT8) \ michael@0: /* michael@0: * Pushes newly created array onto the stack. michael@0: * michael@0: * This opcode takes the final length, which is preallocated. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: uint24_t length michael@0: * Stack: => obj michael@0: */ \ michael@0: macro(JSOP_NEWARRAY, 90, "newarray", NULL, 4, 0, 1, JOF_UINT24) \ michael@0: /* michael@0: * Pushes newly created object onto the stack. michael@0: * michael@0: * This opcode takes an object with the final shape, which can be set at michael@0: * the start and slots then filled in directly. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t baseobjIndex michael@0: * Stack: => obj michael@0: */ \ michael@0: macro(JSOP_NEWOBJECT, 91, "newobject", NULL, 5, 0, 1, JOF_OBJECT) \ michael@0: /* michael@0: * A no-operation bytecode. michael@0: * michael@0: * Indicates the end of object/array initialization, and used for michael@0: * Type-Inference, decompile, etc. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_ENDINIT, 92, "endinit", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: /* michael@0: * Initialize a named property in an object literal, like '{a: x}'. michael@0: * michael@0: * Pops the top two values on the stack as 'val' and 'obj', defines michael@0: * 'nameIndex' property of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj, val => obj michael@0: */ \ michael@0: macro(JSOP_INITPROP, 93, "initprop", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: /* michael@0: * Initialize a numeric property in an object literal, like '{1: x}'. michael@0: * michael@0: * Pops the top three values on the stack as 'val', 'id' and 'obj', defines michael@0: * 'id' property of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, id, val => obj michael@0: */ \ michael@0: macro(JSOP_INITELEM, 94, "initelem", NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: /* michael@0: * Pops the top three values on the stack as 'val', 'index' and 'obj', sets michael@0: * 'index' property of 'obj' as 'val', pushes 'obj' and 'index + 1' onto michael@0: * the stack. michael@0: * michael@0: * This opcode is used in Array literals with spread and spreadcall michael@0: * arguments. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: michael@0: * Stack: obj, index, val => obj, (index + 1) michael@0: */ \ michael@0: macro(JSOP_INITELEM_INC,95, "initelem_inc", NULL, 1, 3, 2, JOF_BYTE|JOF_ELEM|JOF_SET) \ michael@0: \ michael@0: /* michael@0: * Initialize an array element. michael@0: * michael@0: * Pops the top two values on the stack as 'val' and 'obj', sets 'index' michael@0: * property of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: uint24_t index michael@0: * Stack: obj, val => obj michael@0: */ \ michael@0: macro(JSOP_INITELEM_ARRAY,96, "initelem_array", NULL, 4, 2, 1, JOF_UINT24|JOF_ELEM|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: /* michael@0: * Initialize a getter in an object literal. michael@0: * michael@0: * Pops the top two values on the stack as 'val' and 'obj', defines getter michael@0: * of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj, val => obj michael@0: */ \ michael@0: macro(JSOP_INITPROP_GETTER, 97, "initprop_getter", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ michael@0: /* michael@0: * Initialize a setter in an object literal. michael@0: * michael@0: * Pops the top two values on the stack as 'val' and 'obj', defines setter michael@0: * of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj, val => obj michael@0: */ \ michael@0: macro(JSOP_INITPROP_SETTER, 98, "initprop_setter", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ michael@0: /* michael@0: * Initialize a numeric getter in an object literal like michael@0: * '{get 2() {}}'. michael@0: * michael@0: * Pops the top three values on the stack as 'val', 'id' and 'obj', defines michael@0: * 'id' getter of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, id, val => obj michael@0: */ \ michael@0: macro(JSOP_INITELEM_GETTER, 99, "initelem_getter", NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \ michael@0: /* michael@0: * Initialize a numeric setter in an object literal like michael@0: * '{set 2(v) {}}'. michael@0: * michael@0: * Pops the top three values on the stack as 'val', 'id' and 'obj', defines michael@0: * 'id' setter of 'obj' as 'val', pushes 'obj' onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, id, val => obj michael@0: */ \ michael@0: macro(JSOP_INITELEM_SETTER, 100, "initelem_setter", NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: macro(JSOP_UNUSED101, 101, "unused101", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED102, 102, "unused102", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED103, 103, "unused103", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED104, 104, "unused104", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED105, 105, "unused105", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* The argument is the offset to the next statement and is used by IonMonkey. */ \ michael@0: macro(JSOP_LABEL, 106,"label", NULL, 5, 0, 0, JOF_JUMP) \ michael@0: \ michael@0: macro(JSOP_UNUSED107, 107,"unused107", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Invokes 'callee' with 'this' and 'args', pushes return value onto the michael@0: * stack. michael@0: * michael@0: * If 'callee' is determined to be the canonical 'Function.prototype.call' michael@0: * function, then this operation is optimized to directly call 'callee' michael@0: * with 'args[0]' as 'this', and the remaining arguments as formal args michael@0: * to 'callee'. michael@0: * michael@0: * Like JSOP_FUNAPPLY but for 'f.call' instead of 'f.apply'. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint16_t argc michael@0: * Stack: callee, this, args[0], ..., args[argc-1] => rval michael@0: * nuses: (argc+2) michael@0: */ \ michael@0: macro(JSOP_FUNCALL, 108,"funcall", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ michael@0: \ michael@0: /* This opcode is the target of the backwards jump for some loop. */ \ michael@0: macro(JSOP_LOOPHEAD, 109,"loophead", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* ECMA-compliant assignment ops. */ \ michael@0: /* michael@0: * Looks up name on the scope chain and pushes the scope which contains michael@0: * the name onto the stack. If not found, pushes global scope onto the michael@0: * stack. michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => scope michael@0: */ \ michael@0: macro(JSOP_BINDNAME, 110,"bindname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_SET) \ michael@0: /* michael@0: * Pops a scope and value from the stack, assigns value to the given name, michael@0: * and pushes the value back on the stack michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: scope, val => val michael@0: */ \ michael@0: macro(JSOP_SETNAME, 111,"setname", NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: /* Exception handling ops. */ \ michael@0: macro(JSOP_THROW, 112,js_throw_str, NULL, 1, 1, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top two values 'id' and 'obj' from the stack, then pushes michael@0: * 'id in obj'. This will throw a 'TypeError' if 'obj' is not an object. michael@0: * michael@0: * Note that 'obj' is the top value. michael@0: * Category: Operator michael@0: * Type: Special Operators michael@0: * Operands: michael@0: * Stack: id, obj => (id in obj) michael@0: */ \ michael@0: macro(JSOP_IN, 113,js_in_str, js_in_str, 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC) \ michael@0: /* michael@0: * Pops the top two values 'obj' and 'ctor' from the stack, then pushes michael@0: * 'obj instanceof ctor'. This will throw a 'TypeError' if 'obj' is not an michael@0: * object. michael@0: * Category: Operator michael@0: * Type: Special Operators michael@0: * Operands: michael@0: * Stack: obj, ctor => (obj instanceof ctor) michael@0: */ \ michael@0: macro(JSOP_INSTANCEOF,114,js_instanceof_str,js_instanceof_str,1,2,1,JOF_BYTE|JOF_LEFTASSOC|JOF_TMPSLOT) \ michael@0: \ michael@0: /* michael@0: * Invokes debugger. michael@0: * Category: Statements michael@0: * Type: Debugger michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_DEBUGGER, 115,"debugger", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* gosub/retsub for finally handling */ \ michael@0: macro(JSOP_GOSUB, 116,"gosub", NULL, 5, 0, 0, JOF_JUMP) \ michael@0: macro(JSOP_RETSUB, 117,"retsub", NULL, 1, 2, 0, JOF_BYTE) \ michael@0: \ michael@0: /* More exception handling ops. */ \ michael@0: macro(JSOP_EXCEPTION, 118,"exception", NULL, 1, 0, 1, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Embedded lineno to speedup 'pc->line' mapping. michael@0: * Category: Other michael@0: * Operands: uint32_t lineno michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_LINENO, 119,"lineno", NULL, 3, 0, 0, JOF_UINT16) \ michael@0: \ michael@0: /* michael@0: * ECMA-compliant switch statement ops. michael@0: * CONDSWITCH is a decompilable NOP; CASE is ===, POP, jump if true, re-push michael@0: * lval if false; and DEFAULT is POP lval and GOTO. michael@0: */ \ michael@0: macro(JSOP_CONDSWITCH,120,"condswitch", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_CASE, 121,"case", NULL, 5, 2, 1, JOF_JUMP) \ michael@0: macro(JSOP_DEFAULT, 122,"default", NULL, 5, 1, 0, JOF_JUMP) \ michael@0: \ michael@0: /* ECMA-compliant call to eval op. */ \ michael@0: /* michael@0: * Invokes 'eval' with 'args' and pushes return value onto the stack. michael@0: * michael@0: * If 'eval' in global scope is not original one, invokes the function michael@0: * with 'this' and 'args', and pushes return value onto the stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint16_t argc michael@0: * Stack: callee, this, args[0], ..., args[argc-1] => rval michael@0: * nuses: (argc+2) michael@0: */ \ michael@0: macro(JSOP_EVAL, 123,"eval", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ michael@0: \ michael@0: macro(JSOP_UNUSED124, 124, "unused124", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED125, 125, "unused125", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED126, 126, "unused126", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Defines the given function on the current scope. michael@0: * michael@0: * This is used for global scripts and also in some cases for function michael@0: * scripts where use of dynamic scoping inhibits optimization. michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t funcIndex michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_DEFFUN, 127,"deffun", NULL, 5, 0, 0, JOF_OBJECT) \ michael@0: /* michael@0: * Defines the new binding on the frame's current variables-object (the michael@0: * scope object on the scope chain designated to receive new variables) michael@0: * with 'READONLY' attribute. michael@0: * michael@0: * This is used for global scripts and also in some cases for function michael@0: * scripts where use of dynamic scoping inhibits optimization. michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_DEFCONST, 128,"defconst", NULL, 5, 0, 0, JOF_ATOM) \ michael@0: /* michael@0: * Defines the new binding on the frame's current variables-object (the michael@0: * scope object on the scope chain designated to receive new variables). michael@0: * michael@0: * This is used for global scripts and also in some cases for function michael@0: * scripts where use of dynamic scoping inhibits optimization. michael@0: * Category: Variables and Scopes michael@0: * Type: Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_DEFVAR, 129,"defvar", NULL, 5, 0, 0, JOF_ATOM) \ michael@0: \ michael@0: /* michael@0: * Pushes a closure for a named or anonymous function expression onto the michael@0: * stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint32_t funcIndex michael@0: * Stack: => obj michael@0: */ \ michael@0: macro(JSOP_LAMBDA, 130, "lambda", NULL, 5, 0, 1, JOF_OBJECT) \ michael@0: /* michael@0: * Pops the top of stack value as 'this', pushes an arrow function with michael@0: * 'this' onto the stack. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: uint32_t funcIndex michael@0: * Stack: this => obj michael@0: */ \ michael@0: macro(JSOP_LAMBDA_ARROW, 131, "lambda_arrow", NULL, 5, 1, 1, JOF_OBJECT) \ michael@0: \ michael@0: /* michael@0: * Pushes current callee onto the stack. michael@0: * michael@0: * Used for named function expression self-naming, if lightweight. michael@0: * Category: Variables and Scopes michael@0: * Type: Arguments michael@0: * Operands: michael@0: * Stack: => callee michael@0: */ \ michael@0: macro(JSOP_CALLEE, 132, "callee", NULL, 1, 0, 1, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Picks the nth element from the stack and moves it to the top of the michael@0: * stack. michael@0: * Category: Operator michael@0: * Type: Stack Operations michael@0: * Operands: uint8_t n michael@0: * Stack: v[n], v[n-1], ..., v[1], v[0] => v[n-1], ..., v[1], v[0], v[n] michael@0: */ \ michael@0: macro(JSOP_PICK, 133, "pick", NULL, 2, 0, 0, JOF_UINT8|JOF_TMPSLOT2) \ michael@0: \ michael@0: /* michael@0: * Exception handling no-op, for more economical byte-coding than SRC_TRYFIN michael@0: * srcnote-annotated JSOP_NOPs and to simply stack balance handling. michael@0: */ \ michael@0: macro(JSOP_TRY, 134,"try", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_FINALLY, 135,"finally", NULL, 1, 0, 2, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pushes aliased variable onto the stack. michael@0: * michael@0: * An "aliased variable" is a var, let, or formal arg that is aliased. michael@0: * Sources of aliasing include: nested functions accessing the vars of an michael@0: * enclosing function, function statements that are conditionally executed, michael@0: * 'eval', 'with', and 'arguments'. All of these cases require creating a michael@0: * CallObject to own the aliased variable. michael@0: * michael@0: * An ALIASEDVAR opcode contains the following immediates: michael@0: * uint8 hops: the number of scope objects to skip to find the ScopeObject michael@0: * containing the variable being accessed michael@0: * uint24 slot: the slot containing the variable in the ScopeObject (this michael@0: * 'slot' does not include RESERVED_SLOTS). michael@0: * Category: Variables and Scopes michael@0: * Type: Aliased Variables michael@0: * Operands: uint8_t hops, uint24_t slot michael@0: * Stack: => aliasedVar michael@0: */ \ michael@0: macro(JSOP_GETALIASEDVAR, 136,"getaliasedvar",NULL, 5, 0, 1, JOF_SCOPECOORD|JOF_NAME|JOF_TYPESET) \ michael@0: /* michael@0: * Sets aliased variable as the top of stack value. michael@0: * Category: Variables and Scopes michael@0: * Type: Aliased Variables michael@0: * Operands: uint8_t hops, uint24_t slot michael@0: * Stack: v => v michael@0: */ \ michael@0: macro(JSOP_SETALIASEDVAR, 137,"setaliasedvar",NULL, 5, 1, 1, JOF_SCOPECOORD|JOF_NAME|JOF_SET|JOF_DETECTING) \ michael@0: \ michael@0: macro(JSOP_UNUSED138, 138, "unused138", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED139, 139, "unused139", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED140, 140, "unused140", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED141, 141, "unused141", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED142, 142, "unused142", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pushes the value of the intrinsic onto the stack. michael@0: * michael@0: * Intrinsic names are emitted instead of JSOP_*NAME ops when the michael@0: * 'CompileOptions' flag 'selfHostingMode' is set. michael@0: * michael@0: * They are used in self-hosted code to access other self-hosted values and michael@0: * intrinsic functions the runtime doesn't give client JS code access to. michael@0: * Category: Variables and Scopes michael@0: * Type: Intrinsics michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => intrinsic[name] michael@0: */ \ michael@0: macro(JSOP_GETINTRINSIC, 143, "getintrinsic", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET) \ michael@0: /* michael@0: * Pops the top two values on the stack as 'val' and 'scope', sets intrinsic michael@0: * as 'val', and pushes 'val' onto the stack. michael@0: * michael@0: * 'scope' is not used. michael@0: * Category: Variables and Scopes michael@0: * Type: Intrinsics michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: scope, val => val michael@0: */ \ michael@0: macro(JSOP_SETINTRINSIC, 144, "setintrinsic", NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING) \ michael@0: /* michael@0: * Pushes 'intrinsicHolder' onto the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: Intrinsics michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => intrinsicHolder michael@0: */ \ michael@0: macro(JSOP_BINDINTRINSIC, 145, "bindintrinsic", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_SET) \ michael@0: \ michael@0: /* Unused. */ \ michael@0: macro(JSOP_UNUSED146, 146,"unused146", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED147, 147,"unused147", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED148, 148,"unused148", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* Placeholders for a real jump opcode set during backpatch chain fixup. */ \ michael@0: macro(JSOP_BACKPATCH, 149,"backpatch", NULL, 5, 0, 0, JOF_JUMP) \ michael@0: macro(JSOP_UNUSED150, 150,"unused150", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* Set pending exception from the stack, to trigger rethrow. */ \ michael@0: macro(JSOP_THROWING, 151,"throwing", NULL, 1, 1, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top of stack value as 'rval', sets the return value in stack michael@0: * frame as 'rval'. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: rval => michael@0: */ \ michael@0: macro(JSOP_SETRVAL, 152,"setrval", NULL, 1, 1, 0, JOF_BYTE) \ michael@0: /* michael@0: * Stops interpretation and returns value set by JSOP_SETRVAL. When not set, michael@0: * returns 'undefined'. michael@0: * michael@0: * Also emitted at end of script so interpreter don't need to check if michael@0: * opcode is still in script range. michael@0: * Category: Statements michael@0: * Type: Function michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_RETRVAL, 153,"retrval", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Looks up name on global scope and pushes its value onto the stack. michael@0: * michael@0: * Free variable references that must either be found on the global or a michael@0: * ReferenceError. michael@0: * Category: Variables and Scopes michael@0: * Type: Free Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_GETGNAME, 154,"getgname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_GNAME) \ michael@0: /* michael@0: * Pops the top two values on the stack as 'val' and 'scope', sets property michael@0: * of 'scope' as 'val' and pushes 'val' back on the stack. michael@0: * michael@0: * 'scope' should be the global scope. michael@0: * Category: Variables and Scopes michael@0: * Type: Free Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: scope, val => val michael@0: */ \ michael@0: macro(JSOP_SETGNAME, 155,"setgname", NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING|JOF_GNAME) \ michael@0: \ michael@0: macro(JSOP_UNUSED156, 156, "unused156", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED157, 157, "unused157", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED158, 158, "unused158", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED159, 159, "unused159", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pushes a regular expression literal onto the stack. michael@0: * It requires special "clone on exec" handling. michael@0: * Category: Literals michael@0: * Type: RegExp michael@0: * Operands: uint32_t regexpIndex michael@0: * Stack: => regexp michael@0: */ \ michael@0: macro(JSOP_REGEXP, 160,"regexp", NULL, 5, 0, 1, JOF_REGEXP) \ michael@0: \ michael@0: macro(JSOP_UNUSED161, 161,"unused161", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED162, 162,"unused162", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED163, 163,"unused163", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED164, 164,"unused164", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED165, 165,"unused165", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED166, 166,"unused166", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED167, 167,"unused167", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED168, 168,"unused168", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED169, 169,"unused169", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED170, 170,"unused170", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED171, 171,"unused171", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED172, 172,"unused172", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED173, 173,"unused173", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED174, 174,"unused174", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED175, 175,"unused175", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED176, 176,"unused176", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED177, 177,"unused177", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED178, 178,"unused178", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED179, 179,"unused179", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED180, 180,"unused180", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED181, 181,"unused181", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED182, 182,"unused182", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED183, 183,"unused183", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top of stack value, pushes property of it onto the stack. michael@0: * michael@0: * Like JSOP_GETPROP but for call context. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj => obj[name] michael@0: */ \ michael@0: macro(JSOP_CALLPROP, 184,"callprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \ michael@0: \ michael@0: macro(JSOP_UNUSED185, 185,"unused185", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED186, 186,"unused186", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED187, 187,"unused187", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pushes unsigned 24-bit int immediate integer operand onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: uint24_t val michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_UINT24, 188,"uint24", NULL, 4, 0, 1, JOF_UINT24) \ michael@0: \ michael@0: macro(JSOP_UNUSED189, 189,"unused189", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED190, 190,"unused190", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED191, 191,"unused191", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED192, 192,"unused192", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top two values on the stack as 'propval' and 'obj', pushes michael@0: * 'propval' property of 'obj' onto the stack. michael@0: * michael@0: * Like JSOP_GETELEM but for call context. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, propval => obj[propval] michael@0: */ \ michael@0: macro(JSOP_CALLELEM, 193, "callelem", NULL, 1, 2, 1, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC) \ michael@0: \ michael@0: /* michael@0: * '__proto__: v' inside an object initializer. michael@0: * michael@0: * Pops the top two values on the stack as 'newProto' and 'obj', sets michael@0: * prototype of 'obj' as 'newProto', pushes 'true' onto the stack if michael@0: * succeeded, 'false' if not. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, newProto => succeeded michael@0: */ \ michael@0: macro(JSOP_MUTATEPROTO, 194, "mutateproto",NULL, 1, 2, 1, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top of stack value, gets an extant property value of it, michael@0: * throwing ReferenceError if the identified property does not exist. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj => obj[name] michael@0: */ \ michael@0: macro(JSOP_GETXPROP, 195,"getxprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET) \ michael@0: \ michael@0: macro(JSOP_UNUSED196, 196,"unused196", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pops the top stack value as 'val' and pushes 'typeof val'. Note that michael@0: * this opcode isn't used when, in the original source code, 'val' is a michael@0: * name -- see 'JSOP_TYPEOF' for that. michael@0: * (This is because 'typeof undefinedName === "undefined"'.) michael@0: * Category: Operator michael@0: * Type: Special Operators michael@0: * Operands: michael@0: * Stack: val => (typeof val) michael@0: */ \ michael@0: macro(JSOP_TYPEOFEXPR, 197,"typeofexpr", NULL, 1, 1, 1, JOF_BYTE|JOF_DETECTING) \ michael@0: \ michael@0: /* Block-local scope support. */ \ michael@0: /* michael@0: * Pushes block onto the scope chain. michael@0: * Category: Variables and Scopes michael@0: * Type: Block-local Scope michael@0: * Operands: uint32_t staticBlockObjectIndex michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_PUSHBLOCKSCOPE,198,"pushblockscope", NULL, 5, 0, 0, JOF_OBJECT) \ michael@0: /* michael@0: * Pops block from the scope chain. michael@0: * Category: Variables and Scopes michael@0: * Type: Block-local Scope michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_POPBLOCKSCOPE, 199,"popblockscope", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: /* michael@0: * The opcode to assist the debugger. michael@0: * Category: Statements michael@0: * Type: Debugger michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_DEBUGLEAVEBLOCK, 200,"debugleaveblock", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: macro(JSOP_UNUSED201, 201,"unused201", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Initializes generator frame, creates a generator, sets 'YIELDING' flag, michael@0: * stops interpretation and returns the generator. michael@0: * Category: Statements michael@0: * Type: Generator michael@0: * Operands: michael@0: * Stack: => michael@0: */ \ michael@0: macro(JSOP_GENERATOR, 202,"generator", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: /* michael@0: * Pops the top of stack value as 'rval1', sets 'YIELDING' flag, michael@0: * stops interpretation and returns 'rval1', pushes sent value from michael@0: * 'send()' onto the stack. michael@0: * Category: Statements michael@0: * Type: Generator michael@0: * Operands: michael@0: * Stack: rval1 => rval2 michael@0: */ \ michael@0: macro(JSOP_YIELD, 203,"yield", NULL, 1, 1, 1, JOF_BYTE) \ michael@0: /* michael@0: * Pops the top two values on the stack as 'obj' and 'v', pushes 'v' to michael@0: * 'obj'. michael@0: * michael@0: * This opcode is used for Array Comprehension. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: michael@0: * Stack: v, obj => michael@0: */ \ michael@0: macro(JSOP_ARRAYPUSH, 204,"arraypush", NULL, 1, 2, 0, JOF_BYTE) \ michael@0: \ michael@0: macro(JSOP_UNUSED205, 205, "unused205", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED206, 206, "unused206", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: macro(JSOP_UNUSED207, 207, "unused207", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED208, 208, "unused208", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED209, 209, "unused209", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED210, 210, "unused210", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED211, 211, "unused211", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED212, 212, "unused212", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED213, 213, "unused213", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: /* michael@0: * Pushes the global scope onto the stack. michael@0: * michael@0: * 'nameIndex' is not used. michael@0: * Category: Variables and Scopes michael@0: * Type: Free Variables michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => global michael@0: */ \ michael@0: macro(JSOP_BINDGNAME, 214, "bindgname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_GNAME) \ michael@0: \ michael@0: /* michael@0: * Pushes 8-bit int immediate integer operand onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: int8_t val michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_INT8, 215, "int8", NULL, 2, 0, 1, JOF_INT8) \ michael@0: /* michael@0: * Pushes 32-bit int immediate integer operand onto the stack. michael@0: * Category: Literals michael@0: * Type: Constants michael@0: * Operands: int32_t val michael@0: * Stack: => val michael@0: */ \ michael@0: macro(JSOP_INT32, 216, "int32", NULL, 5, 0, 1, JOF_INT32) \ michael@0: \ michael@0: /* michael@0: * Pops the top of stack value, pushes the 'length' property of it onto the michael@0: * stack. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: obj => obj['length'] michael@0: */ \ michael@0: macro(JSOP_LENGTH, 217, "length", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \ michael@0: \ michael@0: /* michael@0: * Pushes a JS_ELEMENTS_HOLE value onto the stack, representing an omitted michael@0: * property in an array literal (e.g. property 0 in the array '[, 1]'). michael@0: * michael@0: * This opcode is used with the JSOP_NEWARRAY opcode. michael@0: * Category: Literals michael@0: * Type: Array michael@0: * Operands: michael@0: * Stack: => hole michael@0: */ \ michael@0: macro(JSOP_HOLE, 218, "hole", NULL, 1, 0, 1, JOF_BYTE) \ michael@0: \ michael@0: macro(JSOP_UNUSED219, 219,"unused219", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED220, 220,"unused220", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED221, 221,"unused221", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED222, 222,"unused222", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: macro(JSOP_UNUSED223, 223,"unused223", NULL, 1, 0, 0, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Creates rest parameter array for current function call, and pushes it michael@0: * onto the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: Arguments michael@0: * Operands: michael@0: * Stack: => rest michael@0: */ \ michael@0: macro(JSOP_REST, 224, "rest", NULL, 1, 0, 1, JOF_BYTE|JOF_TYPESET) \ michael@0: \ michael@0: /* michael@0: * Pops the top of stack value, converts it into a jsid (int or string), and michael@0: * pushes it onto the stack. michael@0: * Category: Literals michael@0: * Type: Object michael@0: * Operands: michael@0: * Stack: obj, id => obj, (jsid of id) michael@0: */ \ michael@0: macro(JSOP_TOID, 225, "toid", NULL, 1, 1, 1, JOF_BYTE) \ michael@0: \ michael@0: /* michael@0: * Pushes the implicit 'this' value for calls to the associated name onto michael@0: * the stack. michael@0: * Category: Variables and Scopes michael@0: * Type: This michael@0: * Operands: uint32_t nameIndex michael@0: * Stack: => this michael@0: */ \ michael@0: macro(JSOP_IMPLICITTHIS, 226, "implicitthis", "", 5, 0, 1, JOF_ATOM) \ michael@0: \ michael@0: /* michael@0: * This opcode is the target of the entry jump for some loop. The uint8 michael@0: * argument is a bitfield. The lower 7 bits of the argument indicate the michael@0: * loop depth. This value starts at 1 and is just a hint: deeply nested michael@0: * loops all have the same value. The upper bit is set if Ion should be michael@0: * able to OSR at this point, which is true unless there is non-loop state michael@0: * on the stack. michael@0: */ \ michael@0: macro(JSOP_LOOPENTRY, 227, "loopentry", NULL, 2, 0, 0, JOF_UINT8) michael@0: michael@0: /* michael@0: * In certain circumstances it may be useful to "pad out" the opcode space to michael@0: * a power of two. Use this macro to do so. michael@0: */ michael@0: #define FOR_EACH_TRAILING_UNUSED_OPCODE(macro) \ michael@0: macro(228) \ michael@0: macro(229) \ michael@0: macro(230) \ michael@0: macro(231) \ michael@0: macro(232) \ michael@0: macro(233) \ michael@0: macro(234) \ michael@0: macro(235) \ michael@0: macro(236) \ michael@0: macro(237) \ michael@0: macro(238) \ michael@0: macro(239) \ michael@0: macro(240) \ michael@0: macro(241) \ michael@0: macro(242) \ michael@0: macro(243) \ michael@0: macro(244) \ michael@0: macro(245) \ michael@0: macro(246) \ michael@0: macro(247) \ michael@0: macro(248) \ michael@0: macro(249) \ michael@0: macro(250) \ michael@0: macro(251) \ michael@0: macro(252) \ michael@0: macro(253) \ michael@0: macro(254) \ michael@0: macro(255) michael@0: michael@0: namespace js { michael@0: michael@0: // Sanity check that opcode values and trailing unused opcodes completely cover michael@0: // the [0, 256) range. Avert your eyes! You don't want to know how the michael@0: // sausage gets made. michael@0: michael@0: #define VALUE_AND_VALUE_PLUS_ONE(op, val, ...) \ michael@0: val) && (val + 1 == michael@0: #define TRAILING_VALUE_AND_VALUE_PLUS_ONE(val) \ michael@0: val) && (val + 1 == michael@0: static_assert((0 == michael@0: FOR_EACH_OPCODE(VALUE_AND_VALUE_PLUS_ONE) michael@0: FOR_EACH_TRAILING_UNUSED_OPCODE(TRAILING_VALUE_AND_VALUE_PLUS_ONE) michael@0: 256), michael@0: "opcode values and trailing unused opcode values monotonically " michael@0: "increase from zero to 255"); michael@0: #undef TRAILING_VALUE_AND_VALUE_PLUS_ONE michael@0: #undef VALUE_AND_VALUE_PLUS_ONE michael@0: michael@0: // Define JSOP_*_LENGTH constants for all ops. michael@0: #define DEFINE_LENGTH_CONSTANT(op, val, name, image, len, ...) \ michael@0: MOZ_CONSTEXPR_VAR size_t op##_LENGTH = len; michael@0: FOR_EACH_OPCODE(DEFINE_LENGTH_CONSTANT) michael@0: #undef DEFINE_LENGTH_CONSTANT michael@0: michael@0: } // namespace js michael@0: michael@0: #endif // vm_Opcodes_h