js/src/vm/Opcodes.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/vm/Opcodes.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,1478 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sw=4 et tw=0 ft=c:
     1.6 + *
     1.7 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef vm_Opcodes_h
    1.12 +#define vm_Opcodes_h
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +
    1.16 +#include <stddef.h>
    1.17 +
    1.18 +/*
    1.19 + * JavaScript operation bytecodes.  Add a new bytecode by claiming one of the
    1.20 + * JSOP_UNUSED* here or by extracting the first unused opcode from
    1.21 + * FOR_EACH_TRAILING_UNUSED_OPCODE and updating js::detail::LastDefinedOpcode
    1.22 + * below.
    1.23 + *
    1.24 + * When changing the bytecode, don't forget to update XDR_BYTECODE_VERSION in
    1.25 + * vm/Xdr.h!
    1.26 + *
    1.27 + * Includers must define a macro with the following form:
    1.28 + *
    1.29 + * #define MACRO(op,val,name,image,length,nuses,ndefs,format) ...
    1.30 + *
    1.31 + * Then simply use FOR_EACH_OPCODE(MACRO) to invoke MACRO for every opcode.
    1.32 + * Selected arguments can be expanded in initializers.
    1.33 + *
    1.34 + * Field        Description
    1.35 + * op           Bytecode name, which is the JSOp enumerator name
    1.36 + * value        Bytecode value, which is the JSOp enumerator value
    1.37 + * name         C string containing name for disassembler
    1.38 + * image        C string containing "image" for pretty-printer, null if ugly
    1.39 + * length       Number of bytes including any immediate operands
    1.40 + * nuses        Number of stack slots consumed by bytecode, -1 if variadic
    1.41 + * ndefs        Number of stack slots produced by bytecode, -1 if variadic
    1.42 + * format       Bytecode plus immediate operand encoding format
    1.43 + *
    1.44 + * This file is best viewed with 128 columns:
    1.45 +12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
    1.46 + */
    1.47 +
    1.48 +/*
    1.49 + * SpiderMonkey bytecode categorization (as used in generated documentation):
    1.50 + *
    1.51 + * [Index]
    1.52 + *   [Statements]
    1.53 + *     Jumps
    1.54 + *     Switch Statement
    1.55 + *     For-In Statement
    1.56 + *     With Statement
    1.57 + *     Exception Handling
    1.58 + *     Function
    1.59 + *     Generator
    1.60 + *     Debugger
    1.61 + *   [Variables and Scopes]
    1.62 + *     Variables
    1.63 + *     Free Variables
    1.64 + *     Local Variables
    1.65 + *     Aliased Variables
    1.66 + *     Intrinsics
    1.67 + *     Block-local Scope
    1.68 + *     This
    1.69 + *     Arguments
    1.70 + *   [Operator]
    1.71 + *     Comparison Operators
    1.72 + *     Arithmetic Operators
    1.73 + *     Bitwise Logical Operators
    1.74 + *     Bitwise Shift Operators
    1.75 + *     Logical Operators
    1.76 + *     Special Operators
    1.77 + *     Stack Operations
    1.78 + *   [Literals]
    1.79 + *     Constants
    1.80 + *     Object
    1.81 + *     Array
    1.82 + *     RegExp
    1.83 + *   [Other]
    1.84 + */
    1.85 +
    1.86 +#define FOR_EACH_OPCODE(macro) \
    1.87 +    /* legend:  op      val   name          image       len use def  format */ \
    1.88 +    /*
    1.89 +     * No operation is performed.
    1.90 +     *   Category: Other
    1.91 +     *   Operands:
    1.92 +     *   Stack: =>
    1.93 +     */ \
    1.94 +    macro(JSOP_NOP,       0,  "nop",        NULL,         1,  0,  0, JOF_BYTE) \
    1.95 +    \
    1.96 +    /* Long-standing JavaScript bytecodes. */ \
    1.97 +    /*
    1.98 +     * Pushes 'undefined' onto the stack.
    1.99 +     *   Category: Literals
   1.100 +     *   Type: Constants
   1.101 +     *   Operands:
   1.102 +     *   Stack: => undefined
   1.103 +     */ \
   1.104 +    macro(JSOP_UNDEFINED, 1,  js_undefined_str, "",       1,  0,  1, JOF_BYTE) \
   1.105 +    macro(JSOP_UNUSED2,   2,  "unused2",    NULL,         1,  1,  0, JOF_BYTE) \
   1.106 +    macro(JSOP_ENTERWITH, 3,  "enterwith",  NULL,         5,  1,  0, JOF_OBJECT) \
   1.107 +    macro(JSOP_LEAVEWITH, 4,  "leavewith",  NULL,         1,  0,  0, JOF_BYTE) \
   1.108 +    /*
   1.109 +     * Pops the top of stack value as 'rval', stops interpretation of current
   1.110 +     * script and returns 'rval'.
   1.111 +     *   Category: Statements
   1.112 +     *   Type: Function
   1.113 +     *   Operands:
   1.114 +     *   Stack: rval =>
   1.115 +     */ \
   1.116 +    macro(JSOP_RETURN,    5,  "return",     NULL,         1,  1,  0, JOF_BYTE) \
   1.117 +    macro(JSOP_GOTO,      6,  "goto",       NULL,         5,  0,  0, JOF_JUMP) \
   1.118 +    macro(JSOP_IFEQ,      7,  "ifeq",       NULL,         5,  1,  0, JOF_JUMP|JOF_DETECTING) \
   1.119 +    macro(JSOP_IFNE,      8,  "ifne",       NULL,         5,  1,  0, JOF_JUMP) \
   1.120 +    \
   1.121 +    /*
   1.122 +     * Pushes the 'arguments' object for the current function activation.
   1.123 +     *
   1.124 +     * If 'JSScript' is not marked 'needsArgsObj', then a
   1.125 +     * JS_OPTIMIZED_ARGUMENTS magic value is pushed. Otherwise, a proper
   1.126 +     * arguments object is constructed and pushed.
   1.127 +     *
   1.128 +     * This opcode requires that the function does not have rest parameter.
   1.129 +     *   Category: Variables and Scopes
   1.130 +     *   Type: Arguments
   1.131 +     *   Operands:
   1.132 +     *   Stack: => arguments
   1.133 +     */ \
   1.134 +    macro(JSOP_ARGUMENTS, 9,  "arguments",  NULL,         1,  0,  1, JOF_BYTE) \
   1.135 +    \
   1.136 +    /*
   1.137 +     * Swaps the top two values on the stack. This is useful for things like
   1.138 +     * post-increment/decrement.
   1.139 +     *   Category: Operator
   1.140 +     *   Type: Stack Operations
   1.141 +     *   Operands:
   1.142 +     *   Stack: v1, v2 => v2, v1
   1.143 +     */ \
   1.144 +    macro(JSOP_SWAP,      10, "swap",       NULL,         1,  2,  2, JOF_BYTE) \
   1.145 +    /*
   1.146 +     * Pops the top 'n' values from the stack.
   1.147 +     *   Category: Operator
   1.148 +     *   Type: Stack Operations
   1.149 +     *   Operands: uint16_t n
   1.150 +     *   Stack: v[n-1], ..., v[1], v[0] =>
   1.151 +     *   nuses: n
   1.152 +     */ \
   1.153 +    macro(JSOP_POPN,      11, "popn",       NULL,         3, -1,  0, JOF_UINT16) \
   1.154 +    \
   1.155 +    /* More long-standing bytecodes. */ \
   1.156 +    /*
   1.157 +     * Pushes a copy of the top value on the stack.
   1.158 +     *   Category: Operator
   1.159 +     *   Type: Stack Operations
   1.160 +     *   Operands:
   1.161 +     *   Stack: v => v, v
   1.162 +     */ \
   1.163 +    macro(JSOP_DUP,       12, "dup",        NULL,         1,  1,  2, JOF_BYTE) \
   1.164 +    /*
   1.165 +     * Duplicates the top two values on the stack.
   1.166 +     *   Category: Operator
   1.167 +     *   Type: Stack Operations
   1.168 +     *   Operands:
   1.169 +     *   Stack: v1, v2 => v1, v2, v1, v2
   1.170 +     */ \
   1.171 +    macro(JSOP_DUP2,      13, "dup2",       NULL,         1,  2,  4, JOF_BYTE) \
   1.172 +    /*
   1.173 +     * Defines a readonly property on the frame's current variables-object (the
   1.174 +     * scope object on the scope chain designated to receive new variables).
   1.175 +     *   Category: Variables and Scopes
   1.176 +     *   Type: Variables
   1.177 +     *   Operands: uint32_t nameIndex
   1.178 +     *   Stack: val => val
   1.179 +     */ \
   1.180 +    macro(JSOP_SETCONST,  14, "setconst",   NULL,         5,  1,  1, JOF_ATOM|JOF_NAME|JOF_SET) \
   1.181 +    /*
   1.182 +     * Pops the top two values 'lval' and 'rval' from the stack, then pushes
   1.183 +     * the result of the operation applied to the two operands, converting
   1.184 +     * both to 32-bit signed integers if necessary.
   1.185 +     *   Category: Operator
   1.186 +     *   Type: Bitwise Logical Operators
   1.187 +     *   Operands:
   1.188 +     *   Stack: lval, rval => (lval OP rval)
   1.189 +     */ \
   1.190 +    macro(JSOP_BITOR,     15, "bitor",      "|",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.191 +    macro(JSOP_BITXOR,    16, "bitxor",     "^",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.192 +    macro(JSOP_BITAND,    17, "bitand",     "&",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.193 +    /*
   1.194 +     * Pops the top two values from the stack and pushes the result of
   1.195 +     * comparing them.
   1.196 +     *   Category: Operator
   1.197 +     *   Type: Comparison Operators
   1.198 +     *   Operands:
   1.199 +     *   Stack: lval, rval => (lval OP rval)
   1.200 +     */ \
   1.201 +    macro(JSOP_EQ,        18, "eq",         "==",         1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH|JOF_DETECTING) \
   1.202 +    macro(JSOP_NE,        19, "ne",         "!=",         1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH|JOF_DETECTING) \
   1.203 +    macro(JSOP_LT,        20, "lt",         "<",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.204 +    macro(JSOP_LE,        21, "le",         "<=",         1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.205 +    macro(JSOP_GT,        22, "gt",         ">",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.206 +    macro(JSOP_GE,        23, "ge",         ">=",         1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.207 +    /*
   1.208 +     * Pops the top two values 'lval' and 'rval' from the stack, then pushes
   1.209 +     * the result of the operation applied to the operands.
   1.210 +     *   Category: Operator
   1.211 +     *   Type: Bitwise Shift Operators
   1.212 +     *   Operands:
   1.213 +     *   Stack: lval, rval => (lval OP rval)
   1.214 +     */ \
   1.215 +    macro(JSOP_LSH,       24, "lsh",        "<<",         1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.216 +    macro(JSOP_RSH,       25, "rsh",        ">>",         1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.217 +    /*
   1.218 +     * Pops the top two values 'lval' and 'rval' from the stack, then pushes
   1.219 +     * 'lval >>> rval'.
   1.220 +     *   Category: Operator
   1.221 +     *   Type: Bitwise Shift Operators
   1.222 +     *   Operands:
   1.223 +     *   Stack: lval, rval => (lval >>> rval)
   1.224 +     */ \
   1.225 +    macro(JSOP_URSH,      26, "ursh",       ">>>",        1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.226 +    /*
   1.227 +     * Pops the top two values 'lval' and 'rval' from the stack, then pushes
   1.228 +     * the result of 'lval + rval'.
   1.229 +     *   Category: Operator
   1.230 +     *   Type: Arithmetic Operators
   1.231 +     *   Operands:
   1.232 +     *   Stack: lval, rval => (lval + rval)
   1.233 +     */ \
   1.234 +    macro(JSOP_ADD,       27, "add",        "+",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.235 +    /*
   1.236 +     * Pops the top two values 'lval' and 'rval' from the stack, then pushes
   1.237 +     * the result of applying the arithmetic operation to them.
   1.238 +     *   Category: Operator
   1.239 +     *   Type: Arithmetic Operators
   1.240 +     *   Operands:
   1.241 +     *   Stack: lval, rval => (lval OP rval)
   1.242 +     */ \
   1.243 +    macro(JSOP_SUB,       28, "sub",        "-",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.244 +    macro(JSOP_MUL,       29, "mul",        "*",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.245 +    macro(JSOP_DIV,       30, "div",        "/",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.246 +    macro(JSOP_MOD,       31, "mod",        "%",          1,  2,  1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \
   1.247 +    /*
   1.248 +     * Pops the value 'val' from the stack, then pushes '!val'.
   1.249 +     *   Category: Operator
   1.250 +     *   Type: Logical Operators
   1.251 +     *   Operands:
   1.252 +     *   Stack: val => (!val)
   1.253 +     */ \
   1.254 +    macro(JSOP_NOT,       32, "not",        "!",          1,  1,  1, JOF_BYTE|JOF_ARITH|JOF_DETECTING) \
   1.255 +    /*
   1.256 +     * Pops the value 'val' from the stack, then pushes '~val'.
   1.257 +     *   Category: Operator
   1.258 +     *   Type: Bitwise Logical Operators
   1.259 +     *   Operands:
   1.260 +     *   Stack: val => (~val)
   1.261 +     */ \
   1.262 +    macro(JSOP_BITNOT,    33, "bitnot",     "~",          1,  1,  1, JOF_BYTE|JOF_ARITH) \
   1.263 +    /*
   1.264 +     * Pops the value 'val' from the stack, then pushes '-val'.
   1.265 +     *   Category: Operator
   1.266 +     *   Type: Arithmetic Operators
   1.267 +     *   Operands:
   1.268 +     *   Stack: val => (-val)
   1.269 +     */ \
   1.270 +    macro(JSOP_NEG,       34, "neg",        "- ",         1,  1,  1, JOF_BYTE|JOF_ARITH) \
   1.271 +    /*
   1.272 +     * Pops the value 'val' from the stack, then pushes '+val'.
   1.273 +     * ('+val' is the value converted to a number.)
   1.274 +     *   Category: Operator
   1.275 +     *   Type: Arithmetic Operators
   1.276 +     *   Operands:
   1.277 +     *   Stack: val => (+val)
   1.278 +     */ \
   1.279 +    macro(JSOP_POS,       35, "pos",        "+ ",         1,  1,  1, JOF_BYTE|JOF_ARITH) \
   1.280 +    /*
   1.281 +     * Looks up name on the scope chain and deletes it, pushes 'true' onto the
   1.282 +     * stack if succeeded (if the property was present and deleted or if the
   1.283 +     * property wasn't present in the first place), 'false' if not.
   1.284 +     *
   1.285 +     * Strict mode code should never contain this opcode.
   1.286 +     *   Category: Variables and Scopes
   1.287 +     *   Type: Variables
   1.288 +     *   Operands: uint32_t nameIndex
   1.289 +     *   Stack: => succeeded
   1.290 +     */ \
   1.291 +    macro(JSOP_DELNAME,   36, "delname",    NULL,         5,  0,  1, JOF_ATOM|JOF_NAME) \
   1.292 +    /*
   1.293 +     * Pops the top of stack value, deletes property from it, pushes 'true' onto
   1.294 +     * the stack if succeeded, 'false' if not.
   1.295 +     *   Category: Literals
   1.296 +     *   Type: Object
   1.297 +     *   Operands: uint32_t nameIndex
   1.298 +     *   Stack: obj => succeeded
   1.299 +     */ \
   1.300 +    macro(JSOP_DELPROP,   37, "delprop",    NULL,         5,  1,  1, JOF_ATOM|JOF_PROP) \
   1.301 +    /*
   1.302 +     * Pops the top two values on the stack as 'propval' and 'obj',
   1.303 +     * deletes 'propval' property from 'obj', pushes 'true'  onto the stack if
   1.304 +     * succeeded, 'false' if not.
   1.305 +     *   Category: Literals
   1.306 +     *   Type: Object
   1.307 +     *   Operands:
   1.308 +     *   Stack: obj, propval => succeeded
   1.309 +     */ \
   1.310 +    macro(JSOP_DELELEM,   38, "delelem",    NULL,         1,  2,  1, JOF_BYTE |JOF_ELEM) \
   1.311 +    /*
   1.312 +     * Pops the value 'val' from the stack, then pushes 'typeof val'.
   1.313 +     *   Category: Operator
   1.314 +     *   Type: Special Operators
   1.315 +     *   Operands:
   1.316 +     *   Stack: val => (typeof val)
   1.317 +     */ \
   1.318 +    macro(JSOP_TYPEOF,    39, js_typeof_str,NULL,         1,  1,  1, JOF_BYTE|JOF_DETECTING) \
   1.319 +    /*
   1.320 +     * Pops the top value on the stack and pushes 'undefined'.
   1.321 +     *   Category: Operator
   1.322 +     *   Type: Special Operators
   1.323 +     *   Operands:
   1.324 +     *   Stack: val => undefined
   1.325 +     */ \
   1.326 +    macro(JSOP_VOID,      40, js_void_str,  NULL,         1,  1,  1, JOF_BYTE) \
   1.327 +    \
   1.328 +    /*
   1.329 +     * spreadcall variant of JSOP_CALL.
   1.330 +     *
   1.331 +     * Invokes 'callee' with 'this' and 'args', pushes the return value onto
   1.332 +     * the stack.
   1.333 +     *
   1.334 +     * 'args' is an Array object which contains actual arguments.
   1.335 +     *   Category: Statements
   1.336 +     *   Type: Function
   1.337 +     *   Operands:
   1.338 +     *   Stack: callee, this, args => rval
   1.339 +     */ \
   1.340 +    macro(JSOP_SPREADCALL,41, "spreadcall", NULL,         1,  3,  1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \
   1.341 +    /*
   1.342 +     * spreadcall variant of JSOP_NEW
   1.343 +     *
   1.344 +     * Invokes 'callee' as a constructor with 'this' and 'args', pushes the
   1.345 +     * return value onto the stack.
   1.346 +     *   Category: Statements
   1.347 +     *   Type: Function
   1.348 +     *   Operands:
   1.349 +     *   Stack: callee, this, args => rval
   1.350 +     */ \
   1.351 +    macro(JSOP_SPREADNEW, 42, "spreadnew",  NULL,         1,  3,  1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \
   1.352 +    /*
   1.353 +     * spreadcall variant of JSOP_EVAL
   1.354 +     *
   1.355 +     * Invokes 'eval' with 'args' and pushes the return value onto the stack.
   1.356 +     *
   1.357 +     * If 'eval' in global scope is not original one, invokes the function
   1.358 +     * with 'this' and 'args', and pushes return value onto the stack.
   1.359 +     *   Category: Statements
   1.360 +     *   Type: Function
   1.361 +     *   Operands:
   1.362 +     *   Stack: callee, this, args => rval
   1.363 +     */ \
   1.364 +    macro(JSOP_SPREADEVAL,43, "spreadeval", NULL,         1,  3,  1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \
   1.365 +    \
   1.366 +    /*
   1.367 +     * Duplicates the Nth value from the top onto the stack.
   1.368 +     *   Category: Operator
   1.369 +     *   Type: Stack Operations
   1.370 +     *   Operands: uint24_t n
   1.371 +     *   Stack: v[n], v[n-1], ..., v[1], v[0] =>
   1.372 +     *          v[n], v[n-1], ..., v[1], v[0], v[n]
   1.373 +     */ \
   1.374 +    macro(JSOP_DUPAT,     44, "dupat",      NULL,         4,  0,  1,  JOF_UINT24) \
   1.375 +    \
   1.376 +    macro(JSOP_UNUSED45,  45, "unused45",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.377 +    macro(JSOP_UNUSED46,  46, "unused46",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.378 +    macro(JSOP_UNUSED47,  47, "unused47",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.379 +    macro(JSOP_UNUSED48,  48, "unused48",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.380 +    macro(JSOP_UNUSED49,  49, "unused49",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.381 +    macro(JSOP_UNUSED50,  50, "unused50",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.382 +    macro(JSOP_UNUSED51,  51, "unused51",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.383 +    macro(JSOP_UNUSED52,  52, "unused52",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.384 +    \
   1.385 +    /*
   1.386 +     * Pops the top of stack value, pushes property of it onto the stack.
   1.387 +     *   Category: Literals
   1.388 +     *   Type: Object
   1.389 +     *   Operands: uint32_t nameIndex
   1.390 +     *   Stack: obj => obj[name]
   1.391 +     */ \
   1.392 +    macro(JSOP_GETPROP,   53, "getprop",    NULL,         5,  1,  1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \
   1.393 +    /*
   1.394 +     * Pops the top two values on the stack as 'val' and 'obj', sets property of
   1.395 +     * 'obj' as 'val', pushes 'obj' onto the stack.
   1.396 +     *   Category: Literals
   1.397 +     *   Type: Object
   1.398 +     *   Operands: uint32_t nameIndex
   1.399 +     *   Stack: obj, val => val
   1.400 +     */ \
   1.401 +    macro(JSOP_SETPROP,   54, "setprop",    NULL,         5,  2,  1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \
   1.402 +    /*
   1.403 +     * Pops the top two values on the stack as 'propval' and 'obj', pushes
   1.404 +     * 'propval' property of 'obj' onto the stack.
   1.405 +     *   Category: Literals
   1.406 +     *   Type: Object
   1.407 +     *   Operands:
   1.408 +     *   Stack: obj, propval => obj[propval]
   1.409 +     */ \
   1.410 +    macro(JSOP_GETELEM,   55, "getelem",    NULL,         1,  2,  1, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC) \
   1.411 +    /*
   1.412 +     * Pops the top three values on the stack as 'val', 'propval' and 'obj',
   1.413 +     * sets 'propval' property of 'obj' as 'val', pushes 'obj' onto the
   1.414 +     * stack.
   1.415 +     *   Category: Literals
   1.416 +     *   Type: Object
   1.417 +     *   Operands:
   1.418 +     *   Stack: obj, propval, val => val
   1.419 +     */ \
   1.420 +    macro(JSOP_SETELEM,   56, "setelem",    NULL,         1,  3,  1, JOF_BYTE |JOF_ELEM|JOF_SET|JOF_DETECTING) \
   1.421 +    macro(JSOP_UNUSED57,  57, "unused57",   NULL,         1,  0,  0, JOF_BYTE) \
   1.422 +    /*
   1.423 +     * Invokes 'callee' with 'this' and 'args', pushes return value onto the
   1.424 +     * stack.
   1.425 +     *   Category: Statements
   1.426 +     *   Type: Function
   1.427 +     *   Operands: uint16_t argc
   1.428 +     *   Stack: callee, this, args[0], ..., args[argc-1] => rval
   1.429 +     *   nuses: (argc+2)
   1.430 +     */ \
   1.431 +    macro(JSOP_CALL,      58, "call",       NULL,         3, -1,  1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \
   1.432 +    /*
   1.433 +     * Looks up name on the scope chain and pushes its value onto the stack.
   1.434 +     *   Category: Variables and Scopes
   1.435 +     *   Type: Variables
   1.436 +     *   Operands: uint32_t nameIndex
   1.437 +     *   Stack: => val
   1.438 +     */ \
   1.439 +    macro(JSOP_NAME,      59, "name",       NULL,         5,  0,  1, JOF_ATOM|JOF_NAME|JOF_TYPESET) \
   1.440 +    /*
   1.441 +     * Pushes numeric constant onto the stack.
   1.442 +     *   Category: Literals
   1.443 +     *   Type: Constants
   1.444 +     *   Operands: uint32_t constIndex
   1.445 +     *   Stack: => val
   1.446 +     */ \
   1.447 +    macro(JSOP_DOUBLE,    60, "double",     NULL,         5,  0,  1, JOF_DOUBLE) \
   1.448 +    /*
   1.449 +     * Pushes string constant onto the stack.
   1.450 +     *   Category: Literals
   1.451 +     *   Type: Constants
   1.452 +     *   Operands: uint32_t atomIndex
   1.453 +     *   Stack: => string
   1.454 +     */ \
   1.455 +    macro(JSOP_STRING,    61, "string",     NULL,         5,  0,  1, JOF_ATOM) \
   1.456 +    /*
   1.457 +     * Pushes '0' onto the stack.
   1.458 +     *   Category: Literals
   1.459 +     *   Type: Constants
   1.460 +     *   Operands:
   1.461 +     *   Stack: => 0
   1.462 +     */ \
   1.463 +    macro(JSOP_ZERO,      62, "zero",       "0",          1,  0,  1, JOF_BYTE) \
   1.464 +    /*
   1.465 +     * Pushes '1' onto the stack.
   1.466 +     *   Category: Literals
   1.467 +     *   Type: Constants
   1.468 +     *   Operands:
   1.469 +     *   Stack: => 1
   1.470 +     */ \
   1.471 +    macro(JSOP_ONE,       63, "one",        "1",          1,  0,  1, JOF_BYTE) \
   1.472 +    /*
   1.473 +     * Pushes 'null' onto the stack.
   1.474 +     *   Category: Literals
   1.475 +     *   Type: Constants
   1.476 +     *   Operands:
   1.477 +     *   Stack: => null
   1.478 +     */ \
   1.479 +    macro(JSOP_NULL,      64, js_null_str,  js_null_str,  1,  0,  1, JOF_BYTE) \
   1.480 +    /*
   1.481 +     * Pushes 'this' value for current stack frame onto the stack.
   1.482 +     *   Category: Variables and Scopes
   1.483 +     *   Type: This
   1.484 +     *   Operands:
   1.485 +     *   Stack: => this
   1.486 +     */ \
   1.487 +    macro(JSOP_THIS,      65, js_this_str,  js_this_str,  1,  0,  1, JOF_BYTE) \
   1.488 +    /*
   1.489 +     * Pushes boolean value onto the stack.
   1.490 +     *   Category: Literals
   1.491 +     *   Type: Constants
   1.492 +     *   Operands:
   1.493 +     *   Stack: => true/false
   1.494 +     */ \
   1.495 +    macro(JSOP_FALSE,     66, js_false_str, js_false_str, 1,  0,  1, JOF_BYTE) \
   1.496 +    macro(JSOP_TRUE,      67, js_true_str,  js_true_str,  1,  0,  1, JOF_BYTE) \
   1.497 +    macro(JSOP_OR,        68, "or",         NULL,         5,  1,  1, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC) \
   1.498 +    macro(JSOP_AND,       69, "and",        NULL,         5,  1,  1, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC) \
   1.499 +    \
   1.500 +    /* The switch bytecodes have variable length. */ \
   1.501 +    macro(JSOP_TABLESWITCH, 70, "tableswitch", NULL,     -1,  1,  0,  JOF_TABLESWITCH|JOF_DETECTING) \
   1.502 +    \
   1.503 +    /*
   1.504 +     * Prologue emitted in scripts expected to run once, which deoptimizes code
   1.505 +     * if it executes multiple times.
   1.506 +     *   Category: Statements
   1.507 +     *   Type: Function
   1.508 +     *   Operands:
   1.509 +     *   Stack: =>
   1.510 +     */ \
   1.511 +    macro(JSOP_RUNONCE,   71, "runonce",    NULL,         1,  0,  0,  JOF_BYTE) \
   1.512 +    \
   1.513 +    /* New, infallible/transitive identity ops. */ \
   1.514 +    /*
   1.515 +     * Pops the top two values from the stack, then pushes the result of
   1.516 +     * applying the operator to the two values.
   1.517 +     *   Category: Operator
   1.518 +     *   Type: Comparison Operators
   1.519 +     *   Operands:
   1.520 +     *   Stack: lval, rval => (lval OP rval)
   1.521 +     */ \
   1.522 +    macro(JSOP_STRICTEQ,  72, "stricteq",   "===",        1,  2,  1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \
   1.523 +    macro(JSOP_STRICTNE,  73, "strictne",   "!==",        1,  2,  1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \
   1.524 +    \
   1.525 +    /*
   1.526 +     * Sometimes web pages do 'o.Item(i) = j'. This is not an early SyntaxError,
   1.527 +     * for web compatibility. Instead we emit JSOP_SETCALL after the function
   1.528 +     * call, an opcode that always throws.
   1.529 +     *   Category: Statements
   1.530 +     *   Type: Function
   1.531 +     *   Operands:
   1.532 +     *   Stack: =>
   1.533 +     */ \
   1.534 +    macro(JSOP_SETCALL,   74, "setcall",    NULL,         1,  0,  0, JOF_BYTE) \
   1.535 +    \
   1.536 +    /*
   1.537 +     * JSOP_ITER sets up a for-in or for-each-in loop using the JSITER_* flag bits
   1.538 +     * in this op's uint8_t immediate operand. It replaces the top of stack value
   1.539 +     * with an iterator for that value.
   1.540 +     *
   1.541 +     * JSOP_MOREITER stores the next iterated value into cx->iterValue and pushes
   1.542 +     * true if another value is available, and false otherwise. It is followed
   1.543 +     * immediately by JSOP_IFNE.
   1.544 +     *
   1.545 +     * JSOP_ENDITER cleans up after the loop. It uses the slot above the iterator
   1.546 +     * for temporary GC rooting.
   1.547 +     */ \
   1.548 +    macro(JSOP_ITER,      75, "iter",       NULL,         2,  1,  1,  JOF_UINT8) \
   1.549 +    macro(JSOP_MOREITER,  76, "moreiter",   NULL,         1,  1,  2,  JOF_BYTE) \
   1.550 +    macro(JSOP_ITERNEXT,  77, "iternext",   "<next>",     1,  0,  1,  JOF_BYTE) \
   1.551 +    macro(JSOP_ENDITER,   78, "enditer",    NULL,         1,  1,  0,  JOF_BYTE) \
   1.552 +    \
   1.553 +    /*
   1.554 +     * Invokes 'callee' with 'this' and 'args', pushes return value onto the
   1.555 +     * stack.
   1.556 +     *
   1.557 +     * This is for 'f.apply'.
   1.558 +     *   Category: Statements
   1.559 +     *   Type: Function
   1.560 +     *   Operands: uint16_t argc
   1.561 +     *   Stack: callee, this, args[0], ..., args[argc-1] => rval
   1.562 +     *   nuses: (argc+2)
   1.563 +     */ \
   1.564 +    macro(JSOP_FUNAPPLY,  79, "funapply",   NULL,         3, -1,  1,  JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \
   1.565 +    \
   1.566 +    /*
   1.567 +     * Pushes deep-cloned object literal or singleton onto the stack.
   1.568 +     *   Category: Literals
   1.569 +     *   Type: Object
   1.570 +     *   Operands: uint32_t objectIndex
   1.571 +     *   Stack: => obj
   1.572 +     */ \
   1.573 +    macro(JSOP_OBJECT,    80, "object",     NULL,         5,  0,  1,  JOF_OBJECT) \
   1.574 +    \
   1.575 +    /*
   1.576 +     * Pops the top value off the stack.
   1.577 +     *   Category: Operator
   1.578 +     *   Type: Stack Operations
   1.579 +     *   Operands:
   1.580 +     *   Stack: v =>
   1.581 +     */ \
   1.582 +    macro(JSOP_POP,       81, "pop",        NULL,         1,  1,  0,  JOF_BYTE) \
   1.583 +    \
   1.584 +    /*
   1.585 +     * Invokes 'callee' as a constructor with 'this' and 'args', pushes return
   1.586 +     * value onto the stack.
   1.587 +     *   Category: Statements
   1.588 +     *   Type: Function
   1.589 +     *   Operands: uint16_t argc
   1.590 +     *   Stack: callee, this, args[0], ..., args[argc-1] => rval
   1.591 +     *   nuses: (argc+2)
   1.592 +     */ \
   1.593 +    macro(JSOP_NEW,       82, js_new_str,   NULL,         3, -1,  1,  JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \
   1.594 +    /*
   1.595 +     * Pops the top three values on the stack as 'iterable', 'index' and 'obj',
   1.596 +     * iterates over 'iterable' and stores the iteration values as 'index + i'
   1.597 +     * elements of 'obj', pushes 'obj' and 'index + iteration count' onto the
   1.598 +     * stack.
   1.599 +     *
   1.600 +     * This opcode is used in Array literals with spread and spreadcall
   1.601 +     * arguments.
   1.602 +     *   Category: Literals
   1.603 +     *   Type: Array
   1.604 +     *   Operands:
   1.605 +     *   Stack: obj, index, iterable => obj, (index + iteration count)
   1.606 +     */ \
   1.607 +    macro(JSOP_SPREAD,    83, "spread",     NULL,         1,  3,  2,  JOF_BYTE|JOF_ELEM|JOF_SET) \
   1.608 +    \
   1.609 +    /*
   1.610 +     * Fast get op for function arguments and local variables.
   1.611 +     *
   1.612 +     * Pushes 'arguments[argno]' onto the stack.
   1.613 +     *   Category: Variables and Scopes
   1.614 +     *   Type: Arguments
   1.615 +     *   Operands: uint16_t argno
   1.616 +     *   Stack: => arguments[argno]
   1.617 +     */ \
   1.618 +    macro(JSOP_GETARG,    84, "getarg",     NULL,         3,  0,  1,  JOF_QARG |JOF_NAME) \
   1.619 +    /*
   1.620 +     * Fast set op for function arguments and local variables.
   1.621 +     *
   1.622 +     * Sets 'arguments[argno]' as the top of stack value.
   1.623 +     *   Category: Variables and Scopes
   1.624 +     *   Type: Arguments
   1.625 +     *   Operands: uint16_t argno
   1.626 +     *   Stack: v => v
   1.627 +     */ \
   1.628 +    macro(JSOP_SETARG,    85, "setarg",     NULL,         3,  1,  1,  JOF_QARG |JOF_NAME|JOF_SET) \
   1.629 +    /*
   1.630 +     * Pushes the value of local variable onto the stack.
   1.631 +     *   Category: Variables and Scopes
   1.632 +     *   Type: Local Variables
   1.633 +     *   Operands: uint32_t localno
   1.634 +     *   Stack: => val
   1.635 +     */ \
   1.636 +    macro(JSOP_GETLOCAL,  86,"getlocal",    NULL,         4,  0,  1,  JOF_LOCAL|JOF_NAME) \
   1.637 +    /*
   1.638 +     * Stores the top stack value to the given local.
   1.639 +     *   Category: Variables and Scopes
   1.640 +     *   Type: Local Variables
   1.641 +     *   Operands: uint32_t localno
   1.642 +     *   Stack: v => v
   1.643 +     */ \
   1.644 +    macro(JSOP_SETLOCAL,  87,"setlocal",    NULL,         4,  1,  1,  JOF_LOCAL|JOF_NAME|JOF_SET|JOF_DETECTING) \
   1.645 +    \
   1.646 +    /*
   1.647 +     * Pushes unsigned 16-bit int immediate integer operand onto the stack.
   1.648 +     *   Category: Literals
   1.649 +     *   Type: Constants
   1.650 +     *   Operands: uint16_t val
   1.651 +     *   Stack: => val
   1.652 +     */ \
   1.653 +    macro(JSOP_UINT16,    88, "uint16",     NULL,         3,  0,  1,  JOF_UINT16) \
   1.654 +    \
   1.655 +    /* Object and array literal support. */ \
   1.656 +    /*
   1.657 +     * Pushes newly created object onto the stack.
   1.658 +     *
   1.659 +     * This opcode takes the kind of initializer (JSProto_Array or
   1.660 +     * JSProto_Object).
   1.661 +     *
   1.662 +     * This opcode has an extra byte so it can be exchanged with JSOP_NEWOBJECT
   1.663 +     * during emit.
   1.664 +     *   Category: Literals
   1.665 +     *   Type: Object
   1.666 +     *   Operands: uint8_t kind (, uint24_t extra)
   1.667 +     *   Stack: => obj
   1.668 +     */ \
   1.669 +    macro(JSOP_NEWINIT,   89, "newinit",    NULL,         5,  0,  1, JOF_UINT8) \
   1.670 +    /*
   1.671 +     * Pushes newly created array onto the stack.
   1.672 +     *
   1.673 +     * This opcode takes the final length, which is preallocated.
   1.674 +     *   Category: Literals
   1.675 +     *   Type: Array
   1.676 +     *   Operands: uint24_t length
   1.677 +     *   Stack: => obj
   1.678 +     */ \
   1.679 +    macro(JSOP_NEWARRAY,  90, "newarray",   NULL,         4,  0,  1, JOF_UINT24) \
   1.680 +    /*
   1.681 +     * Pushes newly created object onto the stack.
   1.682 +     *
   1.683 +     * This opcode takes an object with the final shape, which can be set at
   1.684 +     * the start and slots then filled in directly.
   1.685 +     *   Category: Literals
   1.686 +     *   Type: Object
   1.687 +     *   Operands: uint32_t baseobjIndex
   1.688 +     *   Stack: => obj
   1.689 +     */ \
   1.690 +    macro(JSOP_NEWOBJECT, 91, "newobject",  NULL,         5,  0,  1, JOF_OBJECT) \
   1.691 +    /*
   1.692 +     * A no-operation bytecode.
   1.693 +     *
   1.694 +     * Indicates the end of object/array initialization, and used for
   1.695 +     * Type-Inference, decompile, etc.
   1.696 +     *   Category: Literals
   1.697 +     *   Type: Object
   1.698 +     *   Operands:
   1.699 +     *   Stack: =>
   1.700 +     */ \
   1.701 +    macro(JSOP_ENDINIT,   92, "endinit",    NULL,         1,  0,  0, JOF_BYTE) \
   1.702 +    /*
   1.703 +     * Initialize a named property in an object literal, like '{a: x}'.
   1.704 +     *
   1.705 +     * Pops the top two values on the stack as 'val' and 'obj', defines
   1.706 +     * 'nameIndex' property of 'obj' as 'val', pushes 'obj' onto the stack.
   1.707 +     *   Category: Literals
   1.708 +     *   Type: Object
   1.709 +     *   Operands: uint32_t nameIndex
   1.710 +     *   Stack: obj, val => obj
   1.711 +     */ \
   1.712 +    macro(JSOP_INITPROP,  93, "initprop",   NULL,         5,  2,  1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \
   1.713 +    \
   1.714 +    /*
   1.715 +     * Initialize a numeric property in an object literal, like '{1: x}'.
   1.716 +     *
   1.717 +     * Pops the top three values on the stack as 'val', 'id' and 'obj', defines
   1.718 +     * 'id' property of 'obj' as 'val', pushes 'obj' onto the stack.
   1.719 +     *   Category: Literals
   1.720 +     *   Type: Object
   1.721 +     *   Operands:
   1.722 +     *   Stack: obj, id, val => obj
   1.723 +     */ \
   1.724 +    macro(JSOP_INITELEM,  94, "initelem",   NULL,         1,  3,  1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \
   1.725 +    \
   1.726 +    /*
   1.727 +     * Pops the top three values on the stack as 'val', 'index' and 'obj', sets
   1.728 +     * 'index' property of 'obj' as 'val', pushes 'obj' and 'index + 1' onto
   1.729 +     * the stack.
   1.730 +     *
   1.731 +     * This opcode is used in Array literals with spread and spreadcall
   1.732 +     * arguments.
   1.733 +     *   Category: Literals
   1.734 +     *   Type: Array
   1.735 +     *   Operands:
   1.736 +     *   Stack: obj, index, val => obj, (index + 1)
   1.737 +     */ \
   1.738 +    macro(JSOP_INITELEM_INC,95, "initelem_inc", NULL,     1,  3,  2, JOF_BYTE|JOF_ELEM|JOF_SET) \
   1.739 +    \
   1.740 +    /*
   1.741 +     * Initialize an array element.
   1.742 +     *
   1.743 +     * Pops the top two values on the stack as 'val' and 'obj', sets 'index'
   1.744 +     * property of 'obj' as 'val', pushes 'obj' onto the stack.
   1.745 +     *   Category: Literals
   1.746 +     *   Type: Array
   1.747 +     *   Operands: uint24_t index
   1.748 +     *   Stack: obj, val => obj
   1.749 +     */ \
   1.750 +    macro(JSOP_INITELEM_ARRAY,96, "initelem_array", NULL, 4,  2,  1,  JOF_UINT24|JOF_ELEM|JOF_SET|JOF_DETECTING) \
   1.751 +    \
   1.752 +    /*
   1.753 +     * Initialize a getter in an object literal.
   1.754 +     *
   1.755 +     * Pops the top two values on the stack as 'val' and 'obj', defines getter
   1.756 +     * of 'obj' as 'val', pushes 'obj' onto the stack.
   1.757 +     *   Category: Literals
   1.758 +     *   Type: Object
   1.759 +     *   Operands: uint32_t nameIndex
   1.760 +     *   Stack: obj, val => obj
   1.761 +     */ \
   1.762 +    macro(JSOP_INITPROP_GETTER,  97, "initprop_getter",   NULL, 5,  2,  1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \
   1.763 +    /*
   1.764 +     * Initialize a setter in an object literal.
   1.765 +     *
   1.766 +     * Pops the top two values on the stack as 'val' and 'obj', defines setter
   1.767 +     * of 'obj' as 'val', pushes 'obj' onto the stack.
   1.768 +     *   Category: Literals
   1.769 +     *   Type: Object
   1.770 +     *   Operands: uint32_t nameIndex
   1.771 +     *   Stack: obj, val => obj
   1.772 +     */ \
   1.773 +    macro(JSOP_INITPROP_SETTER,  98, "initprop_setter",   NULL, 5,  2,  1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \
   1.774 +    /*
   1.775 +     * Initialize a numeric getter in an object literal like
   1.776 +     * '{get 2() {}}'.
   1.777 +     *
   1.778 +     * Pops the top three values on the stack as 'val', 'id' and 'obj', defines
   1.779 +     * 'id' getter of 'obj' as 'val', pushes 'obj' onto the stack.
   1.780 +     *   Category: Literals
   1.781 +     *   Type: Object
   1.782 +     *   Operands:
   1.783 +     *   Stack: obj, id, val => obj
   1.784 +     */ \
   1.785 +    macro(JSOP_INITELEM_GETTER,  99, "initelem_getter",   NULL, 1,  3,  1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \
   1.786 +    /*
   1.787 +     * Initialize a numeric setter in an object literal like
   1.788 +     * '{set 2(v) {}}'.
   1.789 +     *
   1.790 +     * Pops the top three values on the stack as 'val', 'id' and 'obj', defines
   1.791 +     * 'id' setter of 'obj' as 'val', pushes 'obj' onto the stack.
   1.792 +     *   Category: Literals
   1.793 +     *   Type: Object
   1.794 +     *   Operands:
   1.795 +     *   Stack: obj, id, val => obj
   1.796 +     */ \
   1.797 +    macro(JSOP_INITELEM_SETTER, 100, "initelem_setter",   NULL, 1,  3,  1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \
   1.798 +    \
   1.799 +    macro(JSOP_UNUSED101,  101, "unused101",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.800 +    macro(JSOP_UNUSED102,  102, "unused102",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.801 +    macro(JSOP_UNUSED103,  103, "unused103",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.802 +    macro(JSOP_UNUSED104,  104, "unused104",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.803 +    macro(JSOP_UNUSED105,  105, "unused105",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.804 +    \
   1.805 +    /* The argument is the offset to the next statement and is used by IonMonkey. */ \
   1.806 +    macro(JSOP_LABEL,     106,"label",     NULL,          5,  0,  0,  JOF_JUMP) \
   1.807 +    \
   1.808 +    macro(JSOP_UNUSED107, 107,"unused107",  NULL,         1,  0,  0,  JOF_BYTE) \
   1.809 +    \
   1.810 +    /*
   1.811 +     * Invokes 'callee' with 'this' and 'args', pushes return value onto the
   1.812 +     * stack.
   1.813 +     *
   1.814 +     * If 'callee' is determined to be the canonical 'Function.prototype.call'
   1.815 +     * function, then this operation is optimized to directly call 'callee'
   1.816 +     * with 'args[0]' as 'this', and the remaining arguments as formal args
   1.817 +     * to 'callee'.
   1.818 +     *
   1.819 +     * Like JSOP_FUNAPPLY but for 'f.call' instead of 'f.apply'.
   1.820 +     *   Category: Statements
   1.821 +     *   Type: Function
   1.822 +     *   Operands: uint16_t argc
   1.823 +     *   Stack: callee, this, args[0], ..., args[argc-1] => rval
   1.824 +     *   nuses: (argc+2)
   1.825 +     */ \
   1.826 +    macro(JSOP_FUNCALL,   108,"funcall",    NULL,         3, -1,  1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \
   1.827 +    \
   1.828 +    /* This opcode is the target of the backwards jump for some loop. */ \
   1.829 +    macro(JSOP_LOOPHEAD,  109,"loophead",   NULL,         1,  0,  0,  JOF_BYTE) \
   1.830 +    \
   1.831 +    /* ECMA-compliant assignment ops. */ \
   1.832 +    /*
   1.833 +     * Looks up name on the scope chain and pushes the scope which contains
   1.834 +     * the name onto the stack. If not found, pushes global scope onto the
   1.835 +     * stack.
   1.836 +     *   Category: Variables and Scopes
   1.837 +     *   Type: Variables
   1.838 +     *   Operands: uint32_t nameIndex
   1.839 +     *   Stack: => scope
   1.840 +     */ \
   1.841 +    macro(JSOP_BINDNAME,  110,"bindname",   NULL,         5,  0,  1,  JOF_ATOM|JOF_NAME|JOF_SET) \
   1.842 +    /*
   1.843 +     * Pops a scope and value from the stack, assigns value to the given name,
   1.844 +     * and pushes the value back on the stack
   1.845 +     *   Category: Variables and Scopes
   1.846 +     *   Type: Variables
   1.847 +     *   Operands: uint32_t nameIndex
   1.848 +     *   Stack: scope, val => val
   1.849 +     */ \
   1.850 +    macro(JSOP_SETNAME,   111,"setname",    NULL,         5,  2,  1,  JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING) \
   1.851 +    \
   1.852 +    /* Exception handling ops. */ \
   1.853 +    macro(JSOP_THROW,     112,js_throw_str, NULL,         1,  1,  0,  JOF_BYTE) \
   1.854 +    \
   1.855 +    /*
   1.856 +     * Pops the top two values 'id' and 'obj' from the stack, then pushes
   1.857 +     * 'id in obj'.  This will throw a 'TypeError' if 'obj' is not an object.
   1.858 +     *
   1.859 +     * Note that 'obj' is the top value.
   1.860 +     *   Category: Operator
   1.861 +     *   Type: Special Operators
   1.862 +     *   Operands:
   1.863 +     *   Stack: id, obj => (id in obj)
   1.864 +     */ \
   1.865 +    macro(JSOP_IN,        113,js_in_str,    js_in_str,    1,  2,  1, JOF_BYTE|JOF_LEFTASSOC) \
   1.866 +    /*
   1.867 +     * Pops the top two values 'obj' and 'ctor' from the stack, then pushes
   1.868 +     * 'obj instanceof ctor'.  This will throw a 'TypeError' if 'obj' is not an
   1.869 +     * object.
   1.870 +     *   Category: Operator
   1.871 +     *   Type: Special Operators
   1.872 +     *   Operands:
   1.873 +     *   Stack: obj, ctor => (obj instanceof ctor)
   1.874 +     */ \
   1.875 +    macro(JSOP_INSTANCEOF,114,js_instanceof_str,js_instanceof_str,1,2,1,JOF_BYTE|JOF_LEFTASSOC|JOF_TMPSLOT) \
   1.876 +    \
   1.877 +    /*
   1.878 +     * Invokes debugger.
   1.879 +     *   Category: Statements
   1.880 +     *   Type: Debugger
   1.881 +     *   Operands:
   1.882 +     *   Stack: =>
   1.883 +     */ \
   1.884 +    macro(JSOP_DEBUGGER,  115,"debugger",   NULL,         1,  0,  0, JOF_BYTE) \
   1.885 +    \
   1.886 +    /* gosub/retsub for finally handling */ \
   1.887 +    macro(JSOP_GOSUB,     116,"gosub",      NULL,         5,  0,  0,  JOF_JUMP) \
   1.888 +    macro(JSOP_RETSUB,    117,"retsub",     NULL,         1,  2,  0,  JOF_BYTE) \
   1.889 +    \
   1.890 +    /* More exception handling ops. */ \
   1.891 +    macro(JSOP_EXCEPTION, 118,"exception",  NULL,         1,  0,  1,  JOF_BYTE) \
   1.892 +    \
   1.893 +    /*
   1.894 +     * Embedded lineno to speedup 'pc->line' mapping.
   1.895 +     *   Category: Other
   1.896 +     *   Operands: uint32_t lineno
   1.897 +     *   Stack: =>
   1.898 +     */ \
   1.899 +    macro(JSOP_LINENO,    119,"lineno",     NULL,         3,  0,  0,  JOF_UINT16) \
   1.900 +    \
   1.901 +    /*
   1.902 +     * ECMA-compliant switch statement ops.
   1.903 +     * CONDSWITCH is a decompilable NOP; CASE is ===, POP, jump if true, re-push
   1.904 +     * lval if false; and DEFAULT is POP lval and GOTO.
   1.905 +     */ \
   1.906 +    macro(JSOP_CONDSWITCH,120,"condswitch", NULL,         1,  0,  0,  JOF_BYTE) \
   1.907 +    macro(JSOP_CASE,      121,"case",       NULL,         5,  2,  1,  JOF_JUMP) \
   1.908 +    macro(JSOP_DEFAULT,   122,"default",    NULL,         5,  1,  0,  JOF_JUMP) \
   1.909 +    \
   1.910 +    /* ECMA-compliant call to eval op. */ \
   1.911 +    /*
   1.912 +     * Invokes 'eval' with 'args' and pushes return value onto the stack.
   1.913 +     *
   1.914 +     * If 'eval' in global scope is not original one, invokes the function
   1.915 +     * with 'this' and 'args', and pushes return value onto the stack.
   1.916 +     *   Category: Statements
   1.917 +     *   Type: Function
   1.918 +     *   Operands: uint16_t argc
   1.919 +     *   Stack: callee, this, args[0], ..., args[argc-1] => rval
   1.920 +     *   nuses: (argc+2)
   1.921 +     */ \
   1.922 +    macro(JSOP_EVAL,      123,"eval",       NULL,         3, -1,  1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \
   1.923 +    \
   1.924 +    macro(JSOP_UNUSED124,  124, "unused124", NULL,      1,  0,  0,  JOF_BYTE) \
   1.925 +    macro(JSOP_UNUSED125,  125, "unused125", NULL,      1,  0,  0,  JOF_BYTE) \
   1.926 +    macro(JSOP_UNUSED126,  126, "unused126", NULL,      1,  0,  0,  JOF_BYTE) \
   1.927 +    \
   1.928 +    /*
   1.929 +     * Defines the given function on the current scope.
   1.930 +     *
   1.931 +     * This is used for global scripts and also in some cases for function
   1.932 +     * scripts where use of dynamic scoping inhibits optimization.
   1.933 +     *   Category: Variables and Scopes
   1.934 +     *   Type: Variables
   1.935 +     *   Operands: uint32_t funcIndex
   1.936 +     *   Stack: =>
   1.937 +     */ \
   1.938 +    macro(JSOP_DEFFUN,    127,"deffun",     NULL,         5,  0,  0,  JOF_OBJECT) \
   1.939 +    /*
   1.940 +     * Defines the new binding on the frame's current variables-object (the
   1.941 +     * scope object on the scope chain designated to receive new variables)
   1.942 +     * with 'READONLY' attribute.
   1.943 +     *
   1.944 +     * This is used for global scripts and also in some cases for function
   1.945 +     * scripts where use of dynamic scoping inhibits optimization.
   1.946 +     *   Category: Variables and Scopes
   1.947 +     *   Type: Variables
   1.948 +     *   Operands: uint32_t nameIndex
   1.949 +     *   Stack: =>
   1.950 +     */ \
   1.951 +    macro(JSOP_DEFCONST,  128,"defconst",   NULL,         5,  0,  0,  JOF_ATOM) \
   1.952 +    /*
   1.953 +     * Defines the new binding on the frame's current variables-object (the
   1.954 +     * scope object on the scope chain designated to receive new variables).
   1.955 +     *
   1.956 +     * This is used for global scripts and also in some cases for function
   1.957 +     * scripts where use of dynamic scoping inhibits optimization.
   1.958 +     *   Category: Variables and Scopes
   1.959 +     *   Type: Variables
   1.960 +     *   Operands: uint32_t nameIndex
   1.961 +     *   Stack: =>
   1.962 +     */ \
   1.963 +    macro(JSOP_DEFVAR,    129,"defvar",     NULL,         5,  0,  0,  JOF_ATOM) \
   1.964 +    \
   1.965 +    /*
   1.966 +     * Pushes a closure for a named or anonymous function expression onto the
   1.967 +     * stack.
   1.968 +     *   Category: Statements
   1.969 +     *   Type: Function
   1.970 +     *   Operands: uint32_t funcIndex
   1.971 +     *   Stack: => obj
   1.972 +     */ \
   1.973 +    macro(JSOP_LAMBDA,    130, "lambda",    NULL,         5,  0,  1, JOF_OBJECT) \
   1.974 +    /*
   1.975 +     * Pops the top of stack value as 'this', pushes an arrow function with
   1.976 +     * 'this' onto the stack.
   1.977 +     *   Category: Statements
   1.978 +     *   Type: Function
   1.979 +     *   Operands: uint32_t funcIndex
   1.980 +     *   Stack: this => obj
   1.981 +     */ \
   1.982 +    macro(JSOP_LAMBDA_ARROW, 131, "lambda_arrow", NULL,   5,  1,  1, JOF_OBJECT) \
   1.983 +    \
   1.984 +    /*
   1.985 +     * Pushes current callee onto the stack.
   1.986 +     *
   1.987 +     * Used for named function expression self-naming, if lightweight.
   1.988 +     *   Category: Variables and Scopes
   1.989 +     *   Type: Arguments
   1.990 +     *   Operands:
   1.991 +     *   Stack: => callee
   1.992 +     */ \
   1.993 +    macro(JSOP_CALLEE,    132, "callee",    NULL,         1,  0,  1, JOF_BYTE) \
   1.994 +    \
   1.995 +    /*
   1.996 +     * Picks the nth element from the stack and moves it to the top of the
   1.997 +     * stack.
   1.998 +     *   Category: Operator
   1.999 +     *   Type: Stack Operations
  1.1000 +     *   Operands: uint8_t n
  1.1001 +     *   Stack: v[n], v[n-1], ..., v[1], v[0] => v[n-1], ..., v[1], v[0], v[n]
  1.1002 +     */ \
  1.1003 +    macro(JSOP_PICK,        133, "pick",      NULL,       2,  0,  0,  JOF_UINT8|JOF_TMPSLOT2) \
  1.1004 +    \
  1.1005 +    /*
  1.1006 +     * Exception handling no-op, for more economical byte-coding than SRC_TRYFIN
  1.1007 +     * srcnote-annotated JSOP_NOPs and to simply stack balance handling.
  1.1008 +     */ \
  1.1009 +    macro(JSOP_TRY,         134,"try",        NULL,       1,  0,  0,  JOF_BYTE) \
  1.1010 +    macro(JSOP_FINALLY,     135,"finally",    NULL,       1,  0,  2,  JOF_BYTE) \
  1.1011 +    \
  1.1012 +    /*
  1.1013 +     * Pushes aliased variable onto the stack.
  1.1014 +     *
  1.1015 +     * An "aliased variable" is a var, let, or formal arg that is aliased.
  1.1016 +     * Sources of aliasing include: nested functions accessing the vars of an
  1.1017 +     * enclosing function, function statements that are conditionally executed,
  1.1018 +     * 'eval', 'with', and 'arguments'. All of these cases require creating a
  1.1019 +     * CallObject to own the aliased variable.
  1.1020 +     *
  1.1021 +     * An ALIASEDVAR opcode contains the following immediates:
  1.1022 +     *  uint8 hops:  the number of scope objects to skip to find the ScopeObject
  1.1023 +     *               containing the variable being accessed
  1.1024 +     *  uint24 slot: the slot containing the variable in the ScopeObject (this
  1.1025 +     *               'slot' does not include RESERVED_SLOTS).
  1.1026 +     *   Category: Variables and Scopes
  1.1027 +     *   Type: Aliased Variables
  1.1028 +     *   Operands: uint8_t hops, uint24_t slot
  1.1029 +     *   Stack: => aliasedVar
  1.1030 +     */ \
  1.1031 +    macro(JSOP_GETALIASEDVAR, 136,"getaliasedvar",NULL,      5,  0,  1,  JOF_SCOPECOORD|JOF_NAME|JOF_TYPESET) \
  1.1032 +    /*
  1.1033 +     * Sets aliased variable as the top of stack value.
  1.1034 +     *   Category: Variables and Scopes
  1.1035 +     *   Type: Aliased Variables
  1.1036 +     *   Operands: uint8_t hops, uint24_t slot
  1.1037 +     *   Stack: v => v
  1.1038 +     */ \
  1.1039 +    macro(JSOP_SETALIASEDVAR, 137,"setaliasedvar",NULL,      5,  1,  1,  JOF_SCOPECOORD|JOF_NAME|JOF_SET|JOF_DETECTING) \
  1.1040 +    \
  1.1041 +    macro(JSOP_UNUSED138,  138, "unused138",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1042 +    macro(JSOP_UNUSED139,  139, "unused139",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1043 +    macro(JSOP_UNUSED140,  140, "unused140",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1044 +    macro(JSOP_UNUSED141,  141, "unused141",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1045 +    macro(JSOP_UNUSED142,  142, "unused142",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1046 +    \
  1.1047 +    /*
  1.1048 +     * Pushes the value of the intrinsic onto the stack.
  1.1049 +     *
  1.1050 +     * Intrinsic names are emitted instead of JSOP_*NAME ops when the
  1.1051 +     * 'CompileOptions' flag 'selfHostingMode' is set.
  1.1052 +     *
  1.1053 +     * They are used in self-hosted code to access other self-hosted values and
  1.1054 +     * intrinsic functions the runtime doesn't give client JS code access to.
  1.1055 +     *   Category: Variables and Scopes
  1.1056 +     *   Type: Intrinsics
  1.1057 +     *   Operands: uint32_t nameIndex
  1.1058 +     *   Stack: => intrinsic[name]
  1.1059 +     */ \
  1.1060 +    macro(JSOP_GETINTRINSIC,  143, "getintrinsic",  NULL, 5,  0,  1, JOF_ATOM|JOF_NAME|JOF_TYPESET) \
  1.1061 +    /*
  1.1062 +     * Pops the top two values on the stack as 'val' and 'scope', sets intrinsic
  1.1063 +     * as 'val', and pushes 'val' onto the stack.
  1.1064 +     *
  1.1065 +     * 'scope' is not used.
  1.1066 +     *   Category: Variables and Scopes
  1.1067 +     *   Type: Intrinsics
  1.1068 +     *   Operands: uint32_t nameIndex
  1.1069 +     *   Stack: scope, val => val
  1.1070 +     */ \
  1.1071 +    macro(JSOP_SETINTRINSIC,  144, "setintrinsic",  NULL, 5,  2,  1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING) \
  1.1072 +    /*
  1.1073 +     * Pushes 'intrinsicHolder' onto the stack.
  1.1074 +     *   Category: Variables and Scopes
  1.1075 +     *   Type: Intrinsics
  1.1076 +     *   Operands: uint32_t nameIndex
  1.1077 +     *   Stack: => intrinsicHolder
  1.1078 +     */ \
  1.1079 +    macro(JSOP_BINDINTRINSIC, 145, "bindintrinsic", NULL, 5,  0,  1, JOF_ATOM|JOF_NAME|JOF_SET) \
  1.1080 +    \
  1.1081 +    /* Unused. */ \
  1.1082 +    macro(JSOP_UNUSED146,     146,"unused146", NULL,      1,  0,  0,  JOF_BYTE) \
  1.1083 +    macro(JSOP_UNUSED147,     147,"unused147", NULL,      1,  0,  0,  JOF_BYTE) \
  1.1084 +    macro(JSOP_UNUSED148,     148,"unused148", NULL,      1,  0,  0,  JOF_BYTE) \
  1.1085 +    \
  1.1086 +    /* Placeholders for a real jump opcode set during backpatch chain fixup. */ \
  1.1087 +    macro(JSOP_BACKPATCH,     149,"backpatch", NULL,      5,  0,  0,  JOF_JUMP) \
  1.1088 +    macro(JSOP_UNUSED150,     150,"unused150", NULL,      1,  0,  0,  JOF_BYTE) \
  1.1089 +    \
  1.1090 +    /* Set pending exception from the stack, to trigger rethrow. */ \
  1.1091 +    macro(JSOP_THROWING,      151,"throwing", NULL,       1,  1,  0,  JOF_BYTE) \
  1.1092 +    \
  1.1093 +    /*
  1.1094 +     * Pops the top of stack value as 'rval', sets the return value in stack
  1.1095 +     * frame as 'rval'.
  1.1096 +     *   Category: Statements
  1.1097 +     *   Type: Function
  1.1098 +     *   Operands:
  1.1099 +     *   Stack: rval =>
  1.1100 +     */ \
  1.1101 +    macro(JSOP_SETRVAL,       152,"setrval",    NULL,       1,  1,  0,  JOF_BYTE) \
  1.1102 +    /*
  1.1103 +     * Stops interpretation and returns value set by JSOP_SETRVAL. When not set,
  1.1104 +     * returns 'undefined'.
  1.1105 +     *
  1.1106 +     * Also emitted at end of script so interpreter don't need to check if
  1.1107 +     * opcode is still in script range.
  1.1108 +     *   Category: Statements
  1.1109 +     *   Type: Function
  1.1110 +     *   Operands:
  1.1111 +     *   Stack: =>
  1.1112 +     */ \
  1.1113 +    macro(JSOP_RETRVAL,       153,"retrval",    NULL,       1,  0,  0,  JOF_BYTE) \
  1.1114 +    \
  1.1115 +    /*
  1.1116 +     * Looks up name on global scope and pushes its value onto the stack.
  1.1117 +     *
  1.1118 +     * Free variable references that must either be found on the global or a
  1.1119 +     * ReferenceError.
  1.1120 +     *   Category: Variables and Scopes
  1.1121 +     *   Type: Free Variables
  1.1122 +     *   Operands: uint32_t nameIndex
  1.1123 +     *   Stack: => val
  1.1124 +     */ \
  1.1125 +    macro(JSOP_GETGNAME,      154,"getgname",  NULL,       5,  0,  1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_GNAME) \
  1.1126 +    /*
  1.1127 +     * Pops the top two values on the stack as 'val' and 'scope', sets property
  1.1128 +     * of 'scope' as 'val' and pushes 'val' back on the stack.
  1.1129 +     *
  1.1130 +     * 'scope' should be the global scope.
  1.1131 +     *   Category: Variables and Scopes
  1.1132 +     *   Type: Free Variables
  1.1133 +     *   Operands: uint32_t nameIndex
  1.1134 +     *   Stack: scope, val => val
  1.1135 +     */ \
  1.1136 +    macro(JSOP_SETGNAME,      155,"setgname",  NULL,       5,  2,  1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING|JOF_GNAME) \
  1.1137 +    \
  1.1138 +    macro(JSOP_UNUSED156,  156, "unused156",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1139 +    macro(JSOP_UNUSED157,  157, "unused157",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1140 +    macro(JSOP_UNUSED158,  158, "unused158",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1141 +    macro(JSOP_UNUSED159,  159, "unused159",   NULL,         1,  0,  0,  JOF_BYTE) \
  1.1142 +    \
  1.1143 +    /*
  1.1144 +     * Pushes a regular expression literal onto the stack.
  1.1145 +     * It requires special "clone on exec" handling.
  1.1146 +     *   Category: Literals
  1.1147 +     *   Type: RegExp
  1.1148 +     *   Operands: uint32_t regexpIndex
  1.1149 +     *   Stack: => regexp
  1.1150 +     */ \
  1.1151 +    macro(JSOP_REGEXP,        160,"regexp",   NULL,       5,  0,  1, JOF_REGEXP) \
  1.1152 +    \
  1.1153 +    macro(JSOP_UNUSED161,     161,"unused161",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1154 +    macro(JSOP_UNUSED162,     162,"unused162",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1155 +    macro(JSOP_UNUSED163,     163,"unused163",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1156 +    macro(JSOP_UNUSED164,     164,"unused164",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1157 +    macro(JSOP_UNUSED165,     165,"unused165",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1158 +    macro(JSOP_UNUSED166,     166,"unused166",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1159 +    macro(JSOP_UNUSED167,     167,"unused167",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1160 +    macro(JSOP_UNUSED168,     168,"unused168",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1161 +    macro(JSOP_UNUSED169,     169,"unused169",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1162 +    macro(JSOP_UNUSED170,     170,"unused170",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1163 +    macro(JSOP_UNUSED171,     171,"unused171",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1164 +    macro(JSOP_UNUSED172,     172,"unused172",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1165 +    macro(JSOP_UNUSED173,     173,"unused173",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1166 +    macro(JSOP_UNUSED174,     174,"unused174",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1167 +    macro(JSOP_UNUSED175,     175,"unused175",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1168 +    macro(JSOP_UNUSED176,     176,"unused176",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1169 +    macro(JSOP_UNUSED177,     177,"unused177",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1170 +    macro(JSOP_UNUSED178,     178,"unused178",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1171 +    macro(JSOP_UNUSED179,     179,"unused179",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1172 +    macro(JSOP_UNUSED180,     180,"unused180",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1173 +    macro(JSOP_UNUSED181,     181,"unused181",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1174 +    macro(JSOP_UNUSED182,     182,"unused182",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1175 +    macro(JSOP_UNUSED183,     183,"unused183",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1176 +    \
  1.1177 +    /*
  1.1178 +     * Pops the top of stack value, pushes property of it onto the stack.
  1.1179 +     *
  1.1180 +     * Like JSOP_GETPROP but for call context.
  1.1181 +     *   Category: Literals
  1.1182 +     *   Type: Object
  1.1183 +     *   Operands: uint32_t nameIndex
  1.1184 +     *   Stack: obj => obj[name]
  1.1185 +     */ \
  1.1186 +    macro(JSOP_CALLPROP,      184,"callprop",   NULL,     5,  1,  1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \
  1.1187 +    \
  1.1188 +    macro(JSOP_UNUSED185,     185,"unused185",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1189 +    macro(JSOP_UNUSED186,     186,"unused186",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1190 +    macro(JSOP_UNUSED187,     187,"unused187",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1191 +    \
  1.1192 +    /*
  1.1193 +     * Pushes unsigned 24-bit int immediate integer operand onto the stack.
  1.1194 +     *   Category: Literals
  1.1195 +     *   Type: Constants
  1.1196 +     *   Operands: uint24_t val
  1.1197 +     *   Stack: => val
  1.1198 +     */ \
  1.1199 +    macro(JSOP_UINT24,        188,"uint24",     NULL,     4,  0,  1, JOF_UINT24) \
  1.1200 +    \
  1.1201 +    macro(JSOP_UNUSED189,     189,"unused189",   NULL,    1,  0,  0,  JOF_BYTE) \
  1.1202 +    macro(JSOP_UNUSED190,     190,"unused190",   NULL,    1,  0,  0,  JOF_BYTE) \
  1.1203 +    macro(JSOP_UNUSED191,     191,"unused191",   NULL,    1,  0,  0,  JOF_BYTE) \
  1.1204 +    macro(JSOP_UNUSED192,     192,"unused192",   NULL,    1,  0,  0,  JOF_BYTE) \
  1.1205 +    \
  1.1206 +    /*
  1.1207 +     * Pops the top two values on the stack as 'propval' and 'obj', pushes
  1.1208 +     * 'propval' property of 'obj' onto the stack.
  1.1209 +     *
  1.1210 +     * Like JSOP_GETELEM but for call context.
  1.1211 +     *   Category: Literals
  1.1212 +     *   Type: Object
  1.1213 +     *   Operands:
  1.1214 +     *   Stack: obj, propval => obj[propval]
  1.1215 +     */ \
  1.1216 +    macro(JSOP_CALLELEM,      193, "callelem",   NULL,    1,  2,  1, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC) \
  1.1217 +    \
  1.1218 +    /*
  1.1219 +     * '__proto__: v' inside an object initializer.
  1.1220 +     *
  1.1221 +     * Pops the top two values on the stack as 'newProto' and 'obj', sets
  1.1222 +     * prototype of 'obj' as 'newProto', pushes 'true' onto the stack if
  1.1223 +     * succeeded, 'false' if not.
  1.1224 +     *   Category: Literals
  1.1225 +     *   Type: Object
  1.1226 +     *   Operands:
  1.1227 +     *   Stack: obj, newProto => succeeded
  1.1228 +     */ \
  1.1229 +    macro(JSOP_MUTATEPROTO,   194, "mutateproto",NULL,    1,  2,  1, JOF_BYTE) \
  1.1230 +    \
  1.1231 +    /*
  1.1232 +     * Pops the top of stack value, gets an extant property value of it,
  1.1233 +     * throwing ReferenceError if the identified property does not exist.
  1.1234 +     *   Category: Literals
  1.1235 +     *   Type: Object
  1.1236 +     *   Operands: uint32_t nameIndex
  1.1237 +     *   Stack: obj => obj[name]
  1.1238 +     */ \
  1.1239 +    macro(JSOP_GETXPROP,      195,"getxprop",    NULL,    5,  1,  1, JOF_ATOM|JOF_PROP|JOF_TYPESET) \
  1.1240 +    \
  1.1241 +    macro(JSOP_UNUSED196,     196,"unused196",   NULL,    1,  0,  0, JOF_BYTE) \
  1.1242 +    \
  1.1243 +    /*
  1.1244 +     * Pops the top stack value as 'val' and pushes 'typeof val'.  Note that
  1.1245 +     * this opcode isn't used when, in the original source code, 'val' is a
  1.1246 +     * name -- see 'JSOP_TYPEOF' for that.
  1.1247 +     * (This is because 'typeof undefinedName === "undefined"'.)
  1.1248 +     *   Category: Operator
  1.1249 +     *   Type: Special Operators
  1.1250 +     *   Operands:
  1.1251 +     *   Stack: val => (typeof val)
  1.1252 +     */ \
  1.1253 +    macro(JSOP_TYPEOFEXPR,    197,"typeofexpr",  NULL,    1,  1,  1, JOF_BYTE|JOF_DETECTING) \
  1.1254 +    \
  1.1255 +    /* Block-local scope support. */ \
  1.1256 +    /*
  1.1257 +     * Pushes block onto the scope chain.
  1.1258 +     *   Category: Variables and Scopes
  1.1259 +     *   Type: Block-local Scope
  1.1260 +     *   Operands: uint32_t staticBlockObjectIndex
  1.1261 +     *   Stack: =>
  1.1262 +     */ \
  1.1263 +    macro(JSOP_PUSHBLOCKSCOPE,198,"pushblockscope", NULL, 5,  0,  0,  JOF_OBJECT) \
  1.1264 +    /*
  1.1265 +     * Pops block from the scope chain.
  1.1266 +     *   Category: Variables and Scopes
  1.1267 +     *   Type: Block-local Scope
  1.1268 +     *   Operands:
  1.1269 +     *   Stack: =>
  1.1270 +     */ \
  1.1271 +    macro(JSOP_POPBLOCKSCOPE, 199,"popblockscope", NULL,  1,  0,  0,  JOF_BYTE) \
  1.1272 +    /*
  1.1273 +     * The opcode to assist the debugger.
  1.1274 +     *   Category: Statements
  1.1275 +     *   Type: Debugger
  1.1276 +     *   Operands:
  1.1277 +     *   Stack: =>
  1.1278 +     */ \
  1.1279 +    macro(JSOP_DEBUGLEAVEBLOCK, 200,"debugleaveblock", NULL, 1,  0,  0,  JOF_BYTE) \
  1.1280 +    \
  1.1281 +    macro(JSOP_UNUSED201,     201,"unused201",  NULL,     1,  0,  0,  JOF_BYTE) \
  1.1282 +    \
  1.1283 +    /*
  1.1284 +     * Initializes generator frame, creates a generator, sets 'YIELDING' flag,
  1.1285 +     * stops interpretation and returns the generator.
  1.1286 +     *   Category: Statements
  1.1287 +     *   Type: Generator
  1.1288 +     *   Operands:
  1.1289 +     *   Stack: =>
  1.1290 +     */ \
  1.1291 +    macro(JSOP_GENERATOR,     202,"generator",   NULL,    1,  0,  0,  JOF_BYTE) \
  1.1292 +    /*
  1.1293 +     * Pops the top of stack value as 'rval1', sets 'YIELDING' flag,
  1.1294 +     * stops interpretation and returns 'rval1', pushes sent value from
  1.1295 +     * 'send()' onto the stack.
  1.1296 +     *   Category: Statements
  1.1297 +     *   Type: Generator
  1.1298 +     *   Operands:
  1.1299 +     *   Stack: rval1 => rval2
  1.1300 +     */ \
  1.1301 +    macro(JSOP_YIELD,         203,"yield",       NULL,    1,  1,  1,  JOF_BYTE) \
  1.1302 +    /*
  1.1303 +     * Pops the top two values on the stack as 'obj' and 'v', pushes 'v' to
  1.1304 +     * 'obj'.
  1.1305 +     *
  1.1306 +     * This opcode is used for Array Comprehension.
  1.1307 +     *   Category: Literals
  1.1308 +     *   Type: Array
  1.1309 +     *   Operands:
  1.1310 +     *   Stack: v, obj =>
  1.1311 +     */ \
  1.1312 +    macro(JSOP_ARRAYPUSH,     204,"arraypush",   NULL,    1,  2,  0,  JOF_BYTE) \
  1.1313 +    \
  1.1314 +    macro(JSOP_UNUSED205,     205, "unused205",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1315 +    macro(JSOP_UNUSED206,     206, "unused206",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1316 +    \
  1.1317 +    macro(JSOP_UNUSED207,     207, "unused207",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1318 +    macro(JSOP_UNUSED208,     208, "unused208",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1319 +    macro(JSOP_UNUSED209,     209, "unused209",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1320 +    macro(JSOP_UNUSED210,     210, "unused210",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1321 +    macro(JSOP_UNUSED211,     211, "unused211",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1322 +    macro(JSOP_UNUSED212,     212, "unused212",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1323 +    macro(JSOP_UNUSED213,     213, "unused213",    NULL,  1,  0,  0,  JOF_BYTE) \
  1.1324 +    /*
  1.1325 +     * Pushes the global scope onto the stack.
  1.1326 +     *
  1.1327 +     * 'nameIndex' is not used.
  1.1328 +     *   Category: Variables and Scopes
  1.1329 +     *   Type: Free Variables
  1.1330 +     *   Operands: uint32_t nameIndex
  1.1331 +     *   Stack: => global
  1.1332 +     */ \
  1.1333 +    macro(JSOP_BINDGNAME,     214, "bindgname",    NULL,  5,  0,  1,  JOF_ATOM|JOF_NAME|JOF_SET|JOF_GNAME) \
  1.1334 +    \
  1.1335 +    /*
  1.1336 +     * Pushes 8-bit int immediate integer operand onto the stack.
  1.1337 +     *   Category: Literals
  1.1338 +     *   Type: Constants
  1.1339 +     *   Operands: int8_t val
  1.1340 +     *   Stack: => val
  1.1341 +     */ \
  1.1342 +    macro(JSOP_INT8,          215, "int8",         NULL,  2,  0,  1, JOF_INT8) \
  1.1343 +    /*
  1.1344 +     * Pushes 32-bit int immediate integer operand onto the stack.
  1.1345 +     *   Category: Literals
  1.1346 +     *   Type: Constants
  1.1347 +     *   Operands: int32_t val
  1.1348 +     *   Stack: => val
  1.1349 +     */ \
  1.1350 +    macro(JSOP_INT32,         216, "int32",        NULL,  5,  0,  1, JOF_INT32) \
  1.1351 +    \
  1.1352 +    /*
  1.1353 +     * Pops the top of stack value, pushes the 'length' property of it onto the
  1.1354 +     * stack.
  1.1355 +     *   Category: Literals
  1.1356 +     *   Type: Array
  1.1357 +     *   Operands: uint32_t nameIndex
  1.1358 +     *   Stack: obj => obj['length']
  1.1359 +     */ \
  1.1360 +    macro(JSOP_LENGTH,        217, "length",       NULL,  5,  1,  1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \
  1.1361 +    \
  1.1362 +    /*
  1.1363 +     * Pushes a JS_ELEMENTS_HOLE value onto the stack, representing an omitted
  1.1364 +     * property in an array literal (e.g. property 0 in the array '[, 1]').
  1.1365 +     *
  1.1366 +     * This opcode is used with the JSOP_NEWARRAY opcode.
  1.1367 +     *   Category: Literals
  1.1368 +     *   Type: Array
  1.1369 +     *   Operands:
  1.1370 +     *   Stack: => hole
  1.1371 +     */ \
  1.1372 +    macro(JSOP_HOLE,          218, "hole",         NULL,  1,  0,  1,  JOF_BYTE) \
  1.1373 +    \
  1.1374 +    macro(JSOP_UNUSED219,     219,"unused219",     NULL,  1,  0,  0,  JOF_BYTE) \
  1.1375 +    macro(JSOP_UNUSED220,     220,"unused220",     NULL,  1,  0,  0,  JOF_BYTE) \
  1.1376 +    macro(JSOP_UNUSED221,     221,"unused221",     NULL,  1,  0,  0,  JOF_BYTE) \
  1.1377 +    macro(JSOP_UNUSED222,     222,"unused222",     NULL,  1,  0,  0,  JOF_BYTE) \
  1.1378 +    macro(JSOP_UNUSED223,     223,"unused223",     NULL,  1,  0,  0,  JOF_BYTE) \
  1.1379 +    \
  1.1380 +    /*
  1.1381 +     * Creates rest parameter array for current function call, and pushes it
  1.1382 +     * onto the stack.
  1.1383 +     *   Category: Variables and Scopes
  1.1384 +     *   Type: Arguments
  1.1385 +     *   Operands:
  1.1386 +     *   Stack: => rest
  1.1387 +     */ \
  1.1388 +    macro(JSOP_REST,          224, "rest",         NULL,  1,  0,  1,  JOF_BYTE|JOF_TYPESET) \
  1.1389 +    \
  1.1390 +    /*
  1.1391 +     * Pops the top of stack value, converts it into a jsid (int or string), and
  1.1392 +     * pushes it onto the stack.
  1.1393 +     *   Category: Literals
  1.1394 +     *   Type: Object
  1.1395 +     *   Operands:
  1.1396 +     *   Stack: obj, id => obj, (jsid of id)
  1.1397 +     */ \
  1.1398 +    macro(JSOP_TOID,          225, "toid",         NULL,  1,  1,  1,  JOF_BYTE) \
  1.1399 +    \
  1.1400 +    /*
  1.1401 +     * Pushes the implicit 'this' value for calls to the associated name onto
  1.1402 +     * the stack.
  1.1403 +     *   Category: Variables and Scopes
  1.1404 +     *   Type: This
  1.1405 +     *   Operands: uint32_t nameIndex
  1.1406 +     *   Stack: => this
  1.1407 +     */                                                                 \
  1.1408 +    macro(JSOP_IMPLICITTHIS,  226, "implicitthis", "",    5,  0,  1,  JOF_ATOM) \
  1.1409 +    \
  1.1410 +    /*
  1.1411 +     * This opcode is the target of the entry jump for some loop. The uint8
  1.1412 +     * argument is a bitfield. The lower 7 bits of the argument indicate the
  1.1413 +     * loop depth. This value starts at 1 and is just a hint: deeply nested
  1.1414 +     * loops all have the same value.  The upper bit is set if Ion should be
  1.1415 +     * able to OSR at this point, which is true unless there is non-loop state
  1.1416 +     * on the stack.
  1.1417 +     */ \
  1.1418 +    macro(JSOP_LOOPENTRY,     227, "loopentry",    NULL,  2,  0,  0,  JOF_UINT8)
  1.1419 +
  1.1420 +/*
  1.1421 + * In certain circumstances it may be useful to "pad out" the opcode space to
  1.1422 + * a power of two.  Use this macro to do so.
  1.1423 + */
  1.1424 +#define FOR_EACH_TRAILING_UNUSED_OPCODE(macro) \
  1.1425 +    macro(228) \
  1.1426 +    macro(229) \
  1.1427 +    macro(230) \
  1.1428 +    macro(231) \
  1.1429 +    macro(232) \
  1.1430 +    macro(233) \
  1.1431 +    macro(234) \
  1.1432 +    macro(235) \
  1.1433 +    macro(236) \
  1.1434 +    macro(237) \
  1.1435 +    macro(238) \
  1.1436 +    macro(239) \
  1.1437 +    macro(240) \
  1.1438 +    macro(241) \
  1.1439 +    macro(242) \
  1.1440 +    macro(243) \
  1.1441 +    macro(244) \
  1.1442 +    macro(245) \
  1.1443 +    macro(246) \
  1.1444 +    macro(247) \
  1.1445 +    macro(248) \
  1.1446 +    macro(249) \
  1.1447 +    macro(250) \
  1.1448 +    macro(251) \
  1.1449 +    macro(252) \
  1.1450 +    macro(253) \
  1.1451 +    macro(254) \
  1.1452 +    macro(255)
  1.1453 +
  1.1454 +namespace js {
  1.1455 +
  1.1456 +// Sanity check that opcode values and trailing unused opcodes completely cover
  1.1457 +// the [0, 256) range.  Avert your eyes!  You don't want to know how the
  1.1458 +// sausage gets made.
  1.1459 +
  1.1460 +#define VALUE_AND_VALUE_PLUS_ONE(op, val, ...) \
  1.1461 +    val) && (val + 1 ==
  1.1462 +#define TRAILING_VALUE_AND_VALUE_PLUS_ONE(val) \
  1.1463 +    val) && (val + 1 ==
  1.1464 +static_assert((0 ==
  1.1465 +               FOR_EACH_OPCODE(VALUE_AND_VALUE_PLUS_ONE)
  1.1466 +               FOR_EACH_TRAILING_UNUSED_OPCODE(TRAILING_VALUE_AND_VALUE_PLUS_ONE)
  1.1467 +               256),
  1.1468 +              "opcode values and trailing unused opcode values monotonically "
  1.1469 +              "increase from zero to 255");
  1.1470 +#undef TRAILING_VALUE_AND_VALUE_PLUS_ONE
  1.1471 +#undef VALUE_AND_VALUE_PLUS_ONE
  1.1472 +
  1.1473 +// Define JSOP_*_LENGTH constants for all ops.
  1.1474 +#define DEFINE_LENGTH_CONSTANT(op, val, name, image, len, ...) \
  1.1475 +    MOZ_CONSTEXPR_VAR size_t op##_LENGTH = len;
  1.1476 +FOR_EACH_OPCODE(DEFINE_LENGTH_CONSTANT)
  1.1477 +#undef DEFINE_LENGTH_CONSTANT
  1.1478 +
  1.1479 +} // namespace js
  1.1480 +
  1.1481 +#endif // vm_Opcodes_h

mercurial