Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sw=4 et tw=0 ft=c: |
michael@0 | 3 | * |
michael@0 | 4 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef vm_Opcodes_h |
michael@0 | 9 | #define vm_Opcodes_h |
michael@0 | 10 | |
michael@0 | 11 | #include "mozilla/Attributes.h" |
michael@0 | 12 | |
michael@0 | 13 | #include <stddef.h> |
michael@0 | 14 | |
michael@0 | 15 | /* |
michael@0 | 16 | * JavaScript operation bytecodes. Add a new bytecode by claiming one of the |
michael@0 | 17 | * JSOP_UNUSED* here or by extracting the first unused opcode from |
michael@0 | 18 | * FOR_EACH_TRAILING_UNUSED_OPCODE and updating js::detail::LastDefinedOpcode |
michael@0 | 19 | * below. |
michael@0 | 20 | * |
michael@0 | 21 | * When changing the bytecode, don't forget to update XDR_BYTECODE_VERSION in |
michael@0 | 22 | * vm/Xdr.h! |
michael@0 | 23 | * |
michael@0 | 24 | * Includers must define a macro with the following form: |
michael@0 | 25 | * |
michael@0 | 26 | * #define MACRO(op,val,name,image,length,nuses,ndefs,format) ... |
michael@0 | 27 | * |
michael@0 | 28 | * Then simply use FOR_EACH_OPCODE(MACRO) to invoke MACRO for every opcode. |
michael@0 | 29 | * Selected arguments can be expanded in initializers. |
michael@0 | 30 | * |
michael@0 | 31 | * Field Description |
michael@0 | 32 | * op Bytecode name, which is the JSOp enumerator name |
michael@0 | 33 | * value Bytecode value, which is the JSOp enumerator value |
michael@0 | 34 | * name C string containing name for disassembler |
michael@0 | 35 | * image C string containing "image" for pretty-printer, null if ugly |
michael@0 | 36 | * length Number of bytes including any immediate operands |
michael@0 | 37 | * nuses Number of stack slots consumed by bytecode, -1 if variadic |
michael@0 | 38 | * ndefs Number of stack slots produced by bytecode, -1 if variadic |
michael@0 | 39 | * format Bytecode plus immediate operand encoding format |
michael@0 | 40 | * |
michael@0 | 41 | * This file is best viewed with 128 columns: |
michael@0 | 42 | 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 |
michael@0 | 43 | */ |
michael@0 | 44 | |
michael@0 | 45 | /* |
michael@0 | 46 | * SpiderMonkey bytecode categorization (as used in generated documentation): |
michael@0 | 47 | * |
michael@0 | 48 | * [Index] |
michael@0 | 49 | * [Statements] |
michael@0 | 50 | * Jumps |
michael@0 | 51 | * Switch Statement |
michael@0 | 52 | * For-In Statement |
michael@0 | 53 | * With Statement |
michael@0 | 54 | * Exception Handling |
michael@0 | 55 | * Function |
michael@0 | 56 | * Generator |
michael@0 | 57 | * Debugger |
michael@0 | 58 | * [Variables and Scopes] |
michael@0 | 59 | * Variables |
michael@0 | 60 | * Free Variables |
michael@0 | 61 | * Local Variables |
michael@0 | 62 | * Aliased Variables |
michael@0 | 63 | * Intrinsics |
michael@0 | 64 | * Block-local Scope |
michael@0 | 65 | * This |
michael@0 | 66 | * Arguments |
michael@0 | 67 | * [Operator] |
michael@0 | 68 | * Comparison Operators |
michael@0 | 69 | * Arithmetic Operators |
michael@0 | 70 | * Bitwise Logical Operators |
michael@0 | 71 | * Bitwise Shift Operators |
michael@0 | 72 | * Logical Operators |
michael@0 | 73 | * Special Operators |
michael@0 | 74 | * Stack Operations |
michael@0 | 75 | * [Literals] |
michael@0 | 76 | * Constants |
michael@0 | 77 | * Object |
michael@0 | 78 | * Array |
michael@0 | 79 | * RegExp |
michael@0 | 80 | * [Other] |
michael@0 | 81 | */ |
michael@0 | 82 | |
michael@0 | 83 | #define FOR_EACH_OPCODE(macro) \ |
michael@0 | 84 | /* legend: op val name image len use def format */ \ |
michael@0 | 85 | /* |
michael@0 | 86 | * No operation is performed. |
michael@0 | 87 | * Category: Other |
michael@0 | 88 | * Operands: |
michael@0 | 89 | * Stack: => |
michael@0 | 90 | */ \ |
michael@0 | 91 | macro(JSOP_NOP, 0, "nop", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 92 | \ |
michael@0 | 93 | /* Long-standing JavaScript bytecodes. */ \ |
michael@0 | 94 | /* |
michael@0 | 95 | * Pushes 'undefined' onto the stack. |
michael@0 | 96 | * Category: Literals |
michael@0 | 97 | * Type: Constants |
michael@0 | 98 | * Operands: |
michael@0 | 99 | * Stack: => undefined |
michael@0 | 100 | */ \ |
michael@0 | 101 | macro(JSOP_UNDEFINED, 1, js_undefined_str, "", 1, 0, 1, JOF_BYTE) \ |
michael@0 | 102 | macro(JSOP_UNUSED2, 2, "unused2", NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 103 | macro(JSOP_ENTERWITH, 3, "enterwith", NULL, 5, 1, 0, JOF_OBJECT) \ |
michael@0 | 104 | macro(JSOP_LEAVEWITH, 4, "leavewith", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 105 | /* |
michael@0 | 106 | * Pops the top of stack value as 'rval', stops interpretation of current |
michael@0 | 107 | * script and returns 'rval'. |
michael@0 | 108 | * Category: Statements |
michael@0 | 109 | * Type: Function |
michael@0 | 110 | * Operands: |
michael@0 | 111 | * Stack: rval => |
michael@0 | 112 | */ \ |
michael@0 | 113 | macro(JSOP_RETURN, 5, "return", NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 114 | macro(JSOP_GOTO, 6, "goto", NULL, 5, 0, 0, JOF_JUMP) \ |
michael@0 | 115 | macro(JSOP_IFEQ, 7, "ifeq", NULL, 5, 1, 0, JOF_JUMP|JOF_DETECTING) \ |
michael@0 | 116 | macro(JSOP_IFNE, 8, "ifne", NULL, 5, 1, 0, JOF_JUMP) \ |
michael@0 | 117 | \ |
michael@0 | 118 | /* |
michael@0 | 119 | * Pushes the 'arguments' object for the current function activation. |
michael@0 | 120 | * |
michael@0 | 121 | * If 'JSScript' is not marked 'needsArgsObj', then a |
michael@0 | 122 | * JS_OPTIMIZED_ARGUMENTS magic value is pushed. Otherwise, a proper |
michael@0 | 123 | * arguments object is constructed and pushed. |
michael@0 | 124 | * |
michael@0 | 125 | * This opcode requires that the function does not have rest parameter. |
michael@0 | 126 | * Category: Variables and Scopes |
michael@0 | 127 | * Type: Arguments |
michael@0 | 128 | * Operands: |
michael@0 | 129 | * Stack: => arguments |
michael@0 | 130 | */ \ |
michael@0 | 131 | macro(JSOP_ARGUMENTS, 9, "arguments", NULL, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 132 | \ |
michael@0 | 133 | /* |
michael@0 | 134 | * Swaps the top two values on the stack. This is useful for things like |
michael@0 | 135 | * post-increment/decrement. |
michael@0 | 136 | * Category: Operator |
michael@0 | 137 | * Type: Stack Operations |
michael@0 | 138 | * Operands: |
michael@0 | 139 | * Stack: v1, v2 => v2, v1 |
michael@0 | 140 | */ \ |
michael@0 | 141 | macro(JSOP_SWAP, 10, "swap", NULL, 1, 2, 2, JOF_BYTE) \ |
michael@0 | 142 | /* |
michael@0 | 143 | * Pops the top 'n' values from the stack. |
michael@0 | 144 | * Category: Operator |
michael@0 | 145 | * Type: Stack Operations |
michael@0 | 146 | * Operands: uint16_t n |
michael@0 | 147 | * Stack: v[n-1], ..., v[1], v[0] => |
michael@0 | 148 | * nuses: n |
michael@0 | 149 | */ \ |
michael@0 | 150 | macro(JSOP_POPN, 11, "popn", NULL, 3, -1, 0, JOF_UINT16) \ |
michael@0 | 151 | \ |
michael@0 | 152 | /* More long-standing bytecodes. */ \ |
michael@0 | 153 | /* |
michael@0 | 154 | * Pushes a copy of the top value on the stack. |
michael@0 | 155 | * Category: Operator |
michael@0 | 156 | * Type: Stack Operations |
michael@0 | 157 | * Operands: |
michael@0 | 158 | * Stack: v => v, v |
michael@0 | 159 | */ \ |
michael@0 | 160 | macro(JSOP_DUP, 12, "dup", NULL, 1, 1, 2, JOF_BYTE) \ |
michael@0 | 161 | /* |
michael@0 | 162 | * Duplicates the top two values on the stack. |
michael@0 | 163 | * Category: Operator |
michael@0 | 164 | * Type: Stack Operations |
michael@0 | 165 | * Operands: |
michael@0 | 166 | * Stack: v1, v2 => v1, v2, v1, v2 |
michael@0 | 167 | */ \ |
michael@0 | 168 | macro(JSOP_DUP2, 13, "dup2", NULL, 1, 2, 4, JOF_BYTE) \ |
michael@0 | 169 | /* |
michael@0 | 170 | * Defines a readonly property on the frame's current variables-object (the |
michael@0 | 171 | * scope object on the scope chain designated to receive new variables). |
michael@0 | 172 | * Category: Variables and Scopes |
michael@0 | 173 | * Type: Variables |
michael@0 | 174 | * Operands: uint32_t nameIndex |
michael@0 | 175 | * Stack: val => val |
michael@0 | 176 | */ \ |
michael@0 | 177 | macro(JSOP_SETCONST, 14, "setconst", NULL, 5, 1, 1, JOF_ATOM|JOF_NAME|JOF_SET) \ |
michael@0 | 178 | /* |
michael@0 | 179 | * Pops the top two values 'lval' and 'rval' from the stack, then pushes |
michael@0 | 180 | * the result of the operation applied to the two operands, converting |
michael@0 | 181 | * both to 32-bit signed integers if necessary. |
michael@0 | 182 | * Category: Operator |
michael@0 | 183 | * Type: Bitwise Logical Operators |
michael@0 | 184 | * Operands: |
michael@0 | 185 | * Stack: lval, rval => (lval OP rval) |
michael@0 | 186 | */ \ |
michael@0 | 187 | macro(JSOP_BITOR, 15, "bitor", "|", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 188 | macro(JSOP_BITXOR, 16, "bitxor", "^", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 189 | macro(JSOP_BITAND, 17, "bitand", "&", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 190 | /* |
michael@0 | 191 | * Pops the top two values from the stack and pushes the result of |
michael@0 | 192 | * comparing them. |
michael@0 | 193 | * Category: Operator |
michael@0 | 194 | * Type: Comparison Operators |
michael@0 | 195 | * Operands: |
michael@0 | 196 | * Stack: lval, rval => (lval OP rval) |
michael@0 | 197 | */ \ |
michael@0 | 198 | macro(JSOP_EQ, 18, "eq", "==", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH|JOF_DETECTING) \ |
michael@0 | 199 | macro(JSOP_NE, 19, "ne", "!=", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH|JOF_DETECTING) \ |
michael@0 | 200 | macro(JSOP_LT, 20, "lt", "<", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 201 | macro(JSOP_LE, 21, "le", "<=", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 202 | macro(JSOP_GT, 22, "gt", ">", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 203 | macro(JSOP_GE, 23, "ge", ">=", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 204 | /* |
michael@0 | 205 | * Pops the top two values 'lval' and 'rval' from the stack, then pushes |
michael@0 | 206 | * the result of the operation applied to the operands. |
michael@0 | 207 | * Category: Operator |
michael@0 | 208 | * Type: Bitwise Shift Operators |
michael@0 | 209 | * Operands: |
michael@0 | 210 | * Stack: lval, rval => (lval OP rval) |
michael@0 | 211 | */ \ |
michael@0 | 212 | macro(JSOP_LSH, 24, "lsh", "<<", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 213 | macro(JSOP_RSH, 25, "rsh", ">>", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 214 | /* |
michael@0 | 215 | * Pops the top two values 'lval' and 'rval' from the stack, then pushes |
michael@0 | 216 | * 'lval >>> rval'. |
michael@0 | 217 | * Category: Operator |
michael@0 | 218 | * Type: Bitwise Shift Operators |
michael@0 | 219 | * Operands: |
michael@0 | 220 | * Stack: lval, rval => (lval >>> rval) |
michael@0 | 221 | */ \ |
michael@0 | 222 | macro(JSOP_URSH, 26, "ursh", ">>>", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 223 | /* |
michael@0 | 224 | * Pops the top two values 'lval' and 'rval' from the stack, then pushes |
michael@0 | 225 | * the result of 'lval + rval'. |
michael@0 | 226 | * Category: Operator |
michael@0 | 227 | * Type: Arithmetic Operators |
michael@0 | 228 | * Operands: |
michael@0 | 229 | * Stack: lval, rval => (lval + rval) |
michael@0 | 230 | */ \ |
michael@0 | 231 | macro(JSOP_ADD, 27, "add", "+", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 232 | /* |
michael@0 | 233 | * Pops the top two values 'lval' and 'rval' from the stack, then pushes |
michael@0 | 234 | * the result of applying the arithmetic operation to them. |
michael@0 | 235 | * Category: Operator |
michael@0 | 236 | * Type: Arithmetic Operators |
michael@0 | 237 | * Operands: |
michael@0 | 238 | * Stack: lval, rval => (lval OP rval) |
michael@0 | 239 | */ \ |
michael@0 | 240 | macro(JSOP_SUB, 28, "sub", "-", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 241 | macro(JSOP_MUL, 29, "mul", "*", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 242 | macro(JSOP_DIV, 30, "div", "/", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 243 | macro(JSOP_MOD, 31, "mod", "%", 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 244 | /* |
michael@0 | 245 | * Pops the value 'val' from the stack, then pushes '!val'. |
michael@0 | 246 | * Category: Operator |
michael@0 | 247 | * Type: Logical Operators |
michael@0 | 248 | * Operands: |
michael@0 | 249 | * Stack: val => (!val) |
michael@0 | 250 | */ \ |
michael@0 | 251 | macro(JSOP_NOT, 32, "not", "!", 1, 1, 1, JOF_BYTE|JOF_ARITH|JOF_DETECTING) \ |
michael@0 | 252 | /* |
michael@0 | 253 | * Pops the value 'val' from the stack, then pushes '~val'. |
michael@0 | 254 | * Category: Operator |
michael@0 | 255 | * Type: Bitwise Logical Operators |
michael@0 | 256 | * Operands: |
michael@0 | 257 | * Stack: val => (~val) |
michael@0 | 258 | */ \ |
michael@0 | 259 | macro(JSOP_BITNOT, 33, "bitnot", "~", 1, 1, 1, JOF_BYTE|JOF_ARITH) \ |
michael@0 | 260 | /* |
michael@0 | 261 | * Pops the value 'val' from the stack, then pushes '-val'. |
michael@0 | 262 | * Category: Operator |
michael@0 | 263 | * Type: Arithmetic Operators |
michael@0 | 264 | * Operands: |
michael@0 | 265 | * Stack: val => (-val) |
michael@0 | 266 | */ \ |
michael@0 | 267 | macro(JSOP_NEG, 34, "neg", "- ", 1, 1, 1, JOF_BYTE|JOF_ARITH) \ |
michael@0 | 268 | /* |
michael@0 | 269 | * Pops the value 'val' from the stack, then pushes '+val'. |
michael@0 | 270 | * ('+val' is the value converted to a number.) |
michael@0 | 271 | * Category: Operator |
michael@0 | 272 | * Type: Arithmetic Operators |
michael@0 | 273 | * Operands: |
michael@0 | 274 | * Stack: val => (+val) |
michael@0 | 275 | */ \ |
michael@0 | 276 | macro(JSOP_POS, 35, "pos", "+ ", 1, 1, 1, JOF_BYTE|JOF_ARITH) \ |
michael@0 | 277 | /* |
michael@0 | 278 | * Looks up name on the scope chain and deletes it, pushes 'true' onto the |
michael@0 | 279 | * stack if succeeded (if the property was present and deleted or if the |
michael@0 | 280 | * property wasn't present in the first place), 'false' if not. |
michael@0 | 281 | * |
michael@0 | 282 | * Strict mode code should never contain this opcode. |
michael@0 | 283 | * Category: Variables and Scopes |
michael@0 | 284 | * Type: Variables |
michael@0 | 285 | * Operands: uint32_t nameIndex |
michael@0 | 286 | * Stack: => succeeded |
michael@0 | 287 | */ \ |
michael@0 | 288 | macro(JSOP_DELNAME, 36, "delname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME) \ |
michael@0 | 289 | /* |
michael@0 | 290 | * Pops the top of stack value, deletes property from it, pushes 'true' onto |
michael@0 | 291 | * the stack if succeeded, 'false' if not. |
michael@0 | 292 | * Category: Literals |
michael@0 | 293 | * Type: Object |
michael@0 | 294 | * Operands: uint32_t nameIndex |
michael@0 | 295 | * Stack: obj => succeeded |
michael@0 | 296 | */ \ |
michael@0 | 297 | macro(JSOP_DELPROP, 37, "delprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP) \ |
michael@0 | 298 | /* |
michael@0 | 299 | * Pops the top two values on the stack as 'propval' and 'obj', |
michael@0 | 300 | * deletes 'propval' property from 'obj', pushes 'true' onto the stack if |
michael@0 | 301 | * succeeded, 'false' if not. |
michael@0 | 302 | * Category: Literals |
michael@0 | 303 | * Type: Object |
michael@0 | 304 | * Operands: |
michael@0 | 305 | * Stack: obj, propval => succeeded |
michael@0 | 306 | */ \ |
michael@0 | 307 | macro(JSOP_DELELEM, 38, "delelem", NULL, 1, 2, 1, JOF_BYTE |JOF_ELEM) \ |
michael@0 | 308 | /* |
michael@0 | 309 | * Pops the value 'val' from the stack, then pushes 'typeof val'. |
michael@0 | 310 | * Category: Operator |
michael@0 | 311 | * Type: Special Operators |
michael@0 | 312 | * Operands: |
michael@0 | 313 | * Stack: val => (typeof val) |
michael@0 | 314 | */ \ |
michael@0 | 315 | macro(JSOP_TYPEOF, 39, js_typeof_str,NULL, 1, 1, 1, JOF_BYTE|JOF_DETECTING) \ |
michael@0 | 316 | /* |
michael@0 | 317 | * Pops the top value on the stack and pushes 'undefined'. |
michael@0 | 318 | * Category: Operator |
michael@0 | 319 | * Type: Special Operators |
michael@0 | 320 | * Operands: |
michael@0 | 321 | * Stack: val => undefined |
michael@0 | 322 | */ \ |
michael@0 | 323 | macro(JSOP_VOID, 40, js_void_str, NULL, 1, 1, 1, JOF_BYTE) \ |
michael@0 | 324 | \ |
michael@0 | 325 | /* |
michael@0 | 326 | * spreadcall variant of JSOP_CALL. |
michael@0 | 327 | * |
michael@0 | 328 | * Invokes 'callee' with 'this' and 'args', pushes the return value onto |
michael@0 | 329 | * the stack. |
michael@0 | 330 | * |
michael@0 | 331 | * 'args' is an Array object which contains actual arguments. |
michael@0 | 332 | * Category: Statements |
michael@0 | 333 | * Type: Function |
michael@0 | 334 | * Operands: |
michael@0 | 335 | * Stack: callee, this, args => rval |
michael@0 | 336 | */ \ |
michael@0 | 337 | macro(JSOP_SPREADCALL,41, "spreadcall", NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 338 | /* |
michael@0 | 339 | * spreadcall variant of JSOP_NEW |
michael@0 | 340 | * |
michael@0 | 341 | * Invokes 'callee' as a constructor with 'this' and 'args', pushes the |
michael@0 | 342 | * return value onto the stack. |
michael@0 | 343 | * Category: Statements |
michael@0 | 344 | * Type: Function |
michael@0 | 345 | * Operands: |
michael@0 | 346 | * Stack: callee, this, args => rval |
michael@0 | 347 | */ \ |
michael@0 | 348 | macro(JSOP_SPREADNEW, 42, "spreadnew", NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 349 | /* |
michael@0 | 350 | * spreadcall variant of JSOP_EVAL |
michael@0 | 351 | * |
michael@0 | 352 | * Invokes 'eval' with 'args' and pushes the return value onto the stack. |
michael@0 | 353 | * |
michael@0 | 354 | * If 'eval' in global scope is not original one, invokes the function |
michael@0 | 355 | * with 'this' and 'args', and pushes return value onto the stack. |
michael@0 | 356 | * Category: Statements |
michael@0 | 357 | * Type: Function |
michael@0 | 358 | * Operands: |
michael@0 | 359 | * Stack: callee, this, args => rval |
michael@0 | 360 | */ \ |
michael@0 | 361 | macro(JSOP_SPREADEVAL,43, "spreadeval", NULL, 1, 3, 1, JOF_BYTE|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 362 | \ |
michael@0 | 363 | /* |
michael@0 | 364 | * Duplicates the Nth value from the top onto the stack. |
michael@0 | 365 | * Category: Operator |
michael@0 | 366 | * Type: Stack Operations |
michael@0 | 367 | * Operands: uint24_t n |
michael@0 | 368 | * Stack: v[n], v[n-1], ..., v[1], v[0] => |
michael@0 | 369 | * v[n], v[n-1], ..., v[1], v[0], v[n] |
michael@0 | 370 | */ \ |
michael@0 | 371 | macro(JSOP_DUPAT, 44, "dupat", NULL, 4, 0, 1, JOF_UINT24) \ |
michael@0 | 372 | \ |
michael@0 | 373 | macro(JSOP_UNUSED45, 45, "unused45", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 374 | macro(JSOP_UNUSED46, 46, "unused46", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 375 | macro(JSOP_UNUSED47, 47, "unused47", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 376 | macro(JSOP_UNUSED48, 48, "unused48", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 377 | macro(JSOP_UNUSED49, 49, "unused49", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 378 | macro(JSOP_UNUSED50, 50, "unused50", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 379 | macro(JSOP_UNUSED51, 51, "unused51", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 380 | macro(JSOP_UNUSED52, 52, "unused52", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 381 | \ |
michael@0 | 382 | /* |
michael@0 | 383 | * Pops the top of stack value, pushes property of it onto the stack. |
michael@0 | 384 | * Category: Literals |
michael@0 | 385 | * Type: Object |
michael@0 | 386 | * Operands: uint32_t nameIndex |
michael@0 | 387 | * Stack: obj => obj[name] |
michael@0 | 388 | */ \ |
michael@0 | 389 | macro(JSOP_GETPROP, 53, "getprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \ |
michael@0 | 390 | /* |
michael@0 | 391 | * Pops the top two values on the stack as 'val' and 'obj', sets property of |
michael@0 | 392 | * 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 393 | * Category: Literals |
michael@0 | 394 | * Type: Object |
michael@0 | 395 | * Operands: uint32_t nameIndex |
michael@0 | 396 | * Stack: obj, val => val |
michael@0 | 397 | */ \ |
michael@0 | 398 | macro(JSOP_SETPROP, 54, "setprop", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ |
michael@0 | 399 | /* |
michael@0 | 400 | * Pops the top two values on the stack as 'propval' and 'obj', pushes |
michael@0 | 401 | * 'propval' property of 'obj' onto the stack. |
michael@0 | 402 | * Category: Literals |
michael@0 | 403 | * Type: Object |
michael@0 | 404 | * Operands: |
michael@0 | 405 | * Stack: obj, propval => obj[propval] |
michael@0 | 406 | */ \ |
michael@0 | 407 | macro(JSOP_GETELEM, 55, "getelem", NULL, 1, 2, 1, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC) \ |
michael@0 | 408 | /* |
michael@0 | 409 | * Pops the top three values on the stack as 'val', 'propval' and 'obj', |
michael@0 | 410 | * sets 'propval' property of 'obj' as 'val', pushes 'obj' onto the |
michael@0 | 411 | * stack. |
michael@0 | 412 | * Category: Literals |
michael@0 | 413 | * Type: Object |
michael@0 | 414 | * Operands: |
michael@0 | 415 | * Stack: obj, propval, val => val |
michael@0 | 416 | */ \ |
michael@0 | 417 | macro(JSOP_SETELEM, 56, "setelem", NULL, 1, 3, 1, JOF_BYTE |JOF_ELEM|JOF_SET|JOF_DETECTING) \ |
michael@0 | 418 | macro(JSOP_UNUSED57, 57, "unused57", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 419 | /* |
michael@0 | 420 | * Invokes 'callee' with 'this' and 'args', pushes return value onto the |
michael@0 | 421 | * stack. |
michael@0 | 422 | * Category: Statements |
michael@0 | 423 | * Type: Function |
michael@0 | 424 | * Operands: uint16_t argc |
michael@0 | 425 | * Stack: callee, this, args[0], ..., args[argc-1] => rval |
michael@0 | 426 | * nuses: (argc+2) |
michael@0 | 427 | */ \ |
michael@0 | 428 | macro(JSOP_CALL, 58, "call", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 429 | /* |
michael@0 | 430 | * Looks up name on the scope chain and pushes its value onto the stack. |
michael@0 | 431 | * Category: Variables and Scopes |
michael@0 | 432 | * Type: Variables |
michael@0 | 433 | * Operands: uint32_t nameIndex |
michael@0 | 434 | * Stack: => val |
michael@0 | 435 | */ \ |
michael@0 | 436 | macro(JSOP_NAME, 59, "name", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET) \ |
michael@0 | 437 | /* |
michael@0 | 438 | * Pushes numeric constant onto the stack. |
michael@0 | 439 | * Category: Literals |
michael@0 | 440 | * Type: Constants |
michael@0 | 441 | * Operands: uint32_t constIndex |
michael@0 | 442 | * Stack: => val |
michael@0 | 443 | */ \ |
michael@0 | 444 | macro(JSOP_DOUBLE, 60, "double", NULL, 5, 0, 1, JOF_DOUBLE) \ |
michael@0 | 445 | /* |
michael@0 | 446 | * Pushes string constant onto the stack. |
michael@0 | 447 | * Category: Literals |
michael@0 | 448 | * Type: Constants |
michael@0 | 449 | * Operands: uint32_t atomIndex |
michael@0 | 450 | * Stack: => string |
michael@0 | 451 | */ \ |
michael@0 | 452 | macro(JSOP_STRING, 61, "string", NULL, 5, 0, 1, JOF_ATOM) \ |
michael@0 | 453 | /* |
michael@0 | 454 | * Pushes '0' onto the stack. |
michael@0 | 455 | * Category: Literals |
michael@0 | 456 | * Type: Constants |
michael@0 | 457 | * Operands: |
michael@0 | 458 | * Stack: => 0 |
michael@0 | 459 | */ \ |
michael@0 | 460 | macro(JSOP_ZERO, 62, "zero", "0", 1, 0, 1, JOF_BYTE) \ |
michael@0 | 461 | /* |
michael@0 | 462 | * Pushes '1' onto the stack. |
michael@0 | 463 | * Category: Literals |
michael@0 | 464 | * Type: Constants |
michael@0 | 465 | * Operands: |
michael@0 | 466 | * Stack: => 1 |
michael@0 | 467 | */ \ |
michael@0 | 468 | macro(JSOP_ONE, 63, "one", "1", 1, 0, 1, JOF_BYTE) \ |
michael@0 | 469 | /* |
michael@0 | 470 | * Pushes 'null' onto the stack. |
michael@0 | 471 | * Category: Literals |
michael@0 | 472 | * Type: Constants |
michael@0 | 473 | * Operands: |
michael@0 | 474 | * Stack: => null |
michael@0 | 475 | */ \ |
michael@0 | 476 | macro(JSOP_NULL, 64, js_null_str, js_null_str, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 477 | /* |
michael@0 | 478 | * Pushes 'this' value for current stack frame onto the stack. |
michael@0 | 479 | * Category: Variables and Scopes |
michael@0 | 480 | * Type: This |
michael@0 | 481 | * Operands: |
michael@0 | 482 | * Stack: => this |
michael@0 | 483 | */ \ |
michael@0 | 484 | macro(JSOP_THIS, 65, js_this_str, js_this_str, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 485 | /* |
michael@0 | 486 | * Pushes boolean value onto the stack. |
michael@0 | 487 | * Category: Literals |
michael@0 | 488 | * Type: Constants |
michael@0 | 489 | * Operands: |
michael@0 | 490 | * Stack: => true/false |
michael@0 | 491 | */ \ |
michael@0 | 492 | macro(JSOP_FALSE, 66, js_false_str, js_false_str, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 493 | macro(JSOP_TRUE, 67, js_true_str, js_true_str, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 494 | macro(JSOP_OR, 68, "or", NULL, 5, 1, 1, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC) \ |
michael@0 | 495 | macro(JSOP_AND, 69, "and", NULL, 5, 1, 1, JOF_JUMP|JOF_DETECTING|JOF_LEFTASSOC) \ |
michael@0 | 496 | \ |
michael@0 | 497 | /* The switch bytecodes have variable length. */ \ |
michael@0 | 498 | macro(JSOP_TABLESWITCH, 70, "tableswitch", NULL, -1, 1, 0, JOF_TABLESWITCH|JOF_DETECTING) \ |
michael@0 | 499 | \ |
michael@0 | 500 | /* |
michael@0 | 501 | * Prologue emitted in scripts expected to run once, which deoptimizes code |
michael@0 | 502 | * if it executes multiple times. |
michael@0 | 503 | * Category: Statements |
michael@0 | 504 | * Type: Function |
michael@0 | 505 | * Operands: |
michael@0 | 506 | * Stack: => |
michael@0 | 507 | */ \ |
michael@0 | 508 | macro(JSOP_RUNONCE, 71, "runonce", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 509 | \ |
michael@0 | 510 | /* New, infallible/transitive identity ops. */ \ |
michael@0 | 511 | /* |
michael@0 | 512 | * Pops the top two values from the stack, then pushes the result of |
michael@0 | 513 | * applying the operator to the two values. |
michael@0 | 514 | * Category: Operator |
michael@0 | 515 | * Type: Comparison Operators |
michael@0 | 516 | * Operands: |
michael@0 | 517 | * Stack: lval, rval => (lval OP rval) |
michael@0 | 518 | */ \ |
michael@0 | 519 | macro(JSOP_STRICTEQ, 72, "stricteq", "===", 1, 2, 1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 520 | macro(JSOP_STRICTNE, 73, "strictne", "!==", 1, 2, 1, JOF_BYTE|JOF_DETECTING|JOF_LEFTASSOC|JOF_ARITH) \ |
michael@0 | 521 | \ |
michael@0 | 522 | /* |
michael@0 | 523 | * Sometimes web pages do 'o.Item(i) = j'. This is not an early SyntaxError, |
michael@0 | 524 | * for web compatibility. Instead we emit JSOP_SETCALL after the function |
michael@0 | 525 | * call, an opcode that always throws. |
michael@0 | 526 | * Category: Statements |
michael@0 | 527 | * Type: Function |
michael@0 | 528 | * Operands: |
michael@0 | 529 | * Stack: => |
michael@0 | 530 | */ \ |
michael@0 | 531 | macro(JSOP_SETCALL, 74, "setcall", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 532 | \ |
michael@0 | 533 | /* |
michael@0 | 534 | * JSOP_ITER sets up a for-in or for-each-in loop using the JSITER_* flag bits |
michael@0 | 535 | * in this op's uint8_t immediate operand. It replaces the top of stack value |
michael@0 | 536 | * with an iterator for that value. |
michael@0 | 537 | * |
michael@0 | 538 | * JSOP_MOREITER stores the next iterated value into cx->iterValue and pushes |
michael@0 | 539 | * true if another value is available, and false otherwise. It is followed |
michael@0 | 540 | * immediately by JSOP_IFNE. |
michael@0 | 541 | * |
michael@0 | 542 | * JSOP_ENDITER cleans up after the loop. It uses the slot above the iterator |
michael@0 | 543 | * for temporary GC rooting. |
michael@0 | 544 | */ \ |
michael@0 | 545 | macro(JSOP_ITER, 75, "iter", NULL, 2, 1, 1, JOF_UINT8) \ |
michael@0 | 546 | macro(JSOP_MOREITER, 76, "moreiter", NULL, 1, 1, 2, JOF_BYTE) \ |
michael@0 | 547 | macro(JSOP_ITERNEXT, 77, "iternext", "<next>", 1, 0, 1, JOF_BYTE) \ |
michael@0 | 548 | macro(JSOP_ENDITER, 78, "enditer", NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 549 | \ |
michael@0 | 550 | /* |
michael@0 | 551 | * Invokes 'callee' with 'this' and 'args', pushes return value onto the |
michael@0 | 552 | * stack. |
michael@0 | 553 | * |
michael@0 | 554 | * This is for 'f.apply'. |
michael@0 | 555 | * Category: Statements |
michael@0 | 556 | * Type: Function |
michael@0 | 557 | * Operands: uint16_t argc |
michael@0 | 558 | * Stack: callee, this, args[0], ..., args[argc-1] => rval |
michael@0 | 559 | * nuses: (argc+2) |
michael@0 | 560 | */ \ |
michael@0 | 561 | macro(JSOP_FUNAPPLY, 79, "funapply", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 562 | \ |
michael@0 | 563 | /* |
michael@0 | 564 | * Pushes deep-cloned object literal or singleton onto the stack. |
michael@0 | 565 | * Category: Literals |
michael@0 | 566 | * Type: Object |
michael@0 | 567 | * Operands: uint32_t objectIndex |
michael@0 | 568 | * Stack: => obj |
michael@0 | 569 | */ \ |
michael@0 | 570 | macro(JSOP_OBJECT, 80, "object", NULL, 5, 0, 1, JOF_OBJECT) \ |
michael@0 | 571 | \ |
michael@0 | 572 | /* |
michael@0 | 573 | * Pops the top value off the stack. |
michael@0 | 574 | * Category: Operator |
michael@0 | 575 | * Type: Stack Operations |
michael@0 | 576 | * Operands: |
michael@0 | 577 | * Stack: v => |
michael@0 | 578 | */ \ |
michael@0 | 579 | macro(JSOP_POP, 81, "pop", NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 580 | \ |
michael@0 | 581 | /* |
michael@0 | 582 | * Invokes 'callee' as a constructor with 'this' and 'args', pushes return |
michael@0 | 583 | * value onto the stack. |
michael@0 | 584 | * Category: Statements |
michael@0 | 585 | * Type: Function |
michael@0 | 586 | * Operands: uint16_t argc |
michael@0 | 587 | * Stack: callee, this, args[0], ..., args[argc-1] => rval |
michael@0 | 588 | * nuses: (argc+2) |
michael@0 | 589 | */ \ |
michael@0 | 590 | macro(JSOP_NEW, 82, js_new_str, NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 591 | /* |
michael@0 | 592 | * Pops the top three values on the stack as 'iterable', 'index' and 'obj', |
michael@0 | 593 | * iterates over 'iterable' and stores the iteration values as 'index + i' |
michael@0 | 594 | * elements of 'obj', pushes 'obj' and 'index + iteration count' onto the |
michael@0 | 595 | * stack. |
michael@0 | 596 | * |
michael@0 | 597 | * This opcode is used in Array literals with spread and spreadcall |
michael@0 | 598 | * arguments. |
michael@0 | 599 | * Category: Literals |
michael@0 | 600 | * Type: Array |
michael@0 | 601 | * Operands: |
michael@0 | 602 | * Stack: obj, index, iterable => obj, (index + iteration count) |
michael@0 | 603 | */ \ |
michael@0 | 604 | macro(JSOP_SPREAD, 83, "spread", NULL, 1, 3, 2, JOF_BYTE|JOF_ELEM|JOF_SET) \ |
michael@0 | 605 | \ |
michael@0 | 606 | /* |
michael@0 | 607 | * Fast get op for function arguments and local variables. |
michael@0 | 608 | * |
michael@0 | 609 | * Pushes 'arguments[argno]' onto the stack. |
michael@0 | 610 | * Category: Variables and Scopes |
michael@0 | 611 | * Type: Arguments |
michael@0 | 612 | * Operands: uint16_t argno |
michael@0 | 613 | * Stack: => arguments[argno] |
michael@0 | 614 | */ \ |
michael@0 | 615 | macro(JSOP_GETARG, 84, "getarg", NULL, 3, 0, 1, JOF_QARG |JOF_NAME) \ |
michael@0 | 616 | /* |
michael@0 | 617 | * Fast set op for function arguments and local variables. |
michael@0 | 618 | * |
michael@0 | 619 | * Sets 'arguments[argno]' as the top of stack value. |
michael@0 | 620 | * Category: Variables and Scopes |
michael@0 | 621 | * Type: Arguments |
michael@0 | 622 | * Operands: uint16_t argno |
michael@0 | 623 | * Stack: v => v |
michael@0 | 624 | */ \ |
michael@0 | 625 | macro(JSOP_SETARG, 85, "setarg", NULL, 3, 1, 1, JOF_QARG |JOF_NAME|JOF_SET) \ |
michael@0 | 626 | /* |
michael@0 | 627 | * Pushes the value of local variable onto the stack. |
michael@0 | 628 | * Category: Variables and Scopes |
michael@0 | 629 | * Type: Local Variables |
michael@0 | 630 | * Operands: uint32_t localno |
michael@0 | 631 | * Stack: => val |
michael@0 | 632 | */ \ |
michael@0 | 633 | macro(JSOP_GETLOCAL, 86,"getlocal", NULL, 4, 0, 1, JOF_LOCAL|JOF_NAME) \ |
michael@0 | 634 | /* |
michael@0 | 635 | * Stores the top stack value to the given local. |
michael@0 | 636 | * Category: Variables and Scopes |
michael@0 | 637 | * Type: Local Variables |
michael@0 | 638 | * Operands: uint32_t localno |
michael@0 | 639 | * Stack: v => v |
michael@0 | 640 | */ \ |
michael@0 | 641 | macro(JSOP_SETLOCAL, 87,"setlocal", NULL, 4, 1, 1, JOF_LOCAL|JOF_NAME|JOF_SET|JOF_DETECTING) \ |
michael@0 | 642 | \ |
michael@0 | 643 | /* |
michael@0 | 644 | * Pushes unsigned 16-bit int immediate integer operand onto the stack. |
michael@0 | 645 | * Category: Literals |
michael@0 | 646 | * Type: Constants |
michael@0 | 647 | * Operands: uint16_t val |
michael@0 | 648 | * Stack: => val |
michael@0 | 649 | */ \ |
michael@0 | 650 | macro(JSOP_UINT16, 88, "uint16", NULL, 3, 0, 1, JOF_UINT16) \ |
michael@0 | 651 | \ |
michael@0 | 652 | /* Object and array literal support. */ \ |
michael@0 | 653 | /* |
michael@0 | 654 | * Pushes newly created object onto the stack. |
michael@0 | 655 | * |
michael@0 | 656 | * This opcode takes the kind of initializer (JSProto_Array or |
michael@0 | 657 | * JSProto_Object). |
michael@0 | 658 | * |
michael@0 | 659 | * This opcode has an extra byte so it can be exchanged with JSOP_NEWOBJECT |
michael@0 | 660 | * during emit. |
michael@0 | 661 | * Category: Literals |
michael@0 | 662 | * Type: Object |
michael@0 | 663 | * Operands: uint8_t kind (, uint24_t extra) |
michael@0 | 664 | * Stack: => obj |
michael@0 | 665 | */ \ |
michael@0 | 666 | macro(JSOP_NEWINIT, 89, "newinit", NULL, 5, 0, 1, JOF_UINT8) \ |
michael@0 | 667 | /* |
michael@0 | 668 | * Pushes newly created array onto the stack. |
michael@0 | 669 | * |
michael@0 | 670 | * This opcode takes the final length, which is preallocated. |
michael@0 | 671 | * Category: Literals |
michael@0 | 672 | * Type: Array |
michael@0 | 673 | * Operands: uint24_t length |
michael@0 | 674 | * Stack: => obj |
michael@0 | 675 | */ \ |
michael@0 | 676 | macro(JSOP_NEWARRAY, 90, "newarray", NULL, 4, 0, 1, JOF_UINT24) \ |
michael@0 | 677 | /* |
michael@0 | 678 | * Pushes newly created object onto the stack. |
michael@0 | 679 | * |
michael@0 | 680 | * This opcode takes an object with the final shape, which can be set at |
michael@0 | 681 | * the start and slots then filled in directly. |
michael@0 | 682 | * Category: Literals |
michael@0 | 683 | * Type: Object |
michael@0 | 684 | * Operands: uint32_t baseobjIndex |
michael@0 | 685 | * Stack: => obj |
michael@0 | 686 | */ \ |
michael@0 | 687 | macro(JSOP_NEWOBJECT, 91, "newobject", NULL, 5, 0, 1, JOF_OBJECT) \ |
michael@0 | 688 | /* |
michael@0 | 689 | * A no-operation bytecode. |
michael@0 | 690 | * |
michael@0 | 691 | * Indicates the end of object/array initialization, and used for |
michael@0 | 692 | * Type-Inference, decompile, etc. |
michael@0 | 693 | * Category: Literals |
michael@0 | 694 | * Type: Object |
michael@0 | 695 | * Operands: |
michael@0 | 696 | * Stack: => |
michael@0 | 697 | */ \ |
michael@0 | 698 | macro(JSOP_ENDINIT, 92, "endinit", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 699 | /* |
michael@0 | 700 | * Initialize a named property in an object literal, like '{a: x}'. |
michael@0 | 701 | * |
michael@0 | 702 | * Pops the top two values on the stack as 'val' and 'obj', defines |
michael@0 | 703 | * 'nameIndex' property of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 704 | * Category: Literals |
michael@0 | 705 | * Type: Object |
michael@0 | 706 | * Operands: uint32_t nameIndex |
michael@0 | 707 | * Stack: obj, val => obj |
michael@0 | 708 | */ \ |
michael@0 | 709 | macro(JSOP_INITPROP, 93, "initprop", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ |
michael@0 | 710 | \ |
michael@0 | 711 | /* |
michael@0 | 712 | * Initialize a numeric property in an object literal, like '{1: x}'. |
michael@0 | 713 | * |
michael@0 | 714 | * Pops the top three values on the stack as 'val', 'id' and 'obj', defines |
michael@0 | 715 | * 'id' property of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 716 | * Category: Literals |
michael@0 | 717 | * Type: Object |
michael@0 | 718 | * Operands: |
michael@0 | 719 | * Stack: obj, id, val => obj |
michael@0 | 720 | */ \ |
michael@0 | 721 | macro(JSOP_INITELEM, 94, "initelem", NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \ |
michael@0 | 722 | \ |
michael@0 | 723 | /* |
michael@0 | 724 | * Pops the top three values on the stack as 'val', 'index' and 'obj', sets |
michael@0 | 725 | * 'index' property of 'obj' as 'val', pushes 'obj' and 'index + 1' onto |
michael@0 | 726 | * the stack. |
michael@0 | 727 | * |
michael@0 | 728 | * This opcode is used in Array literals with spread and spreadcall |
michael@0 | 729 | * arguments. |
michael@0 | 730 | * Category: Literals |
michael@0 | 731 | * Type: Array |
michael@0 | 732 | * Operands: |
michael@0 | 733 | * Stack: obj, index, val => obj, (index + 1) |
michael@0 | 734 | */ \ |
michael@0 | 735 | macro(JSOP_INITELEM_INC,95, "initelem_inc", NULL, 1, 3, 2, JOF_BYTE|JOF_ELEM|JOF_SET) \ |
michael@0 | 736 | \ |
michael@0 | 737 | /* |
michael@0 | 738 | * Initialize an array element. |
michael@0 | 739 | * |
michael@0 | 740 | * Pops the top two values on the stack as 'val' and 'obj', sets 'index' |
michael@0 | 741 | * property of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 742 | * Category: Literals |
michael@0 | 743 | * Type: Array |
michael@0 | 744 | * Operands: uint24_t index |
michael@0 | 745 | * Stack: obj, val => obj |
michael@0 | 746 | */ \ |
michael@0 | 747 | macro(JSOP_INITELEM_ARRAY,96, "initelem_array", NULL, 4, 2, 1, JOF_UINT24|JOF_ELEM|JOF_SET|JOF_DETECTING) \ |
michael@0 | 748 | \ |
michael@0 | 749 | /* |
michael@0 | 750 | * Initialize a getter in an object literal. |
michael@0 | 751 | * |
michael@0 | 752 | * Pops the top two values on the stack as 'val' and 'obj', defines getter |
michael@0 | 753 | * of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 754 | * Category: Literals |
michael@0 | 755 | * Type: Object |
michael@0 | 756 | * Operands: uint32_t nameIndex |
michael@0 | 757 | * Stack: obj, val => obj |
michael@0 | 758 | */ \ |
michael@0 | 759 | macro(JSOP_INITPROP_GETTER, 97, "initprop_getter", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ |
michael@0 | 760 | /* |
michael@0 | 761 | * Initialize a setter in an object literal. |
michael@0 | 762 | * |
michael@0 | 763 | * Pops the top two values on the stack as 'val' and 'obj', defines setter |
michael@0 | 764 | * of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 765 | * Category: Literals |
michael@0 | 766 | * Type: Object |
michael@0 | 767 | * Operands: uint32_t nameIndex |
michael@0 | 768 | * Stack: obj, val => obj |
michael@0 | 769 | */ \ |
michael@0 | 770 | macro(JSOP_INITPROP_SETTER, 98, "initprop_setter", NULL, 5, 2, 1, JOF_ATOM|JOF_PROP|JOF_SET|JOF_DETECTING) \ |
michael@0 | 771 | /* |
michael@0 | 772 | * Initialize a numeric getter in an object literal like |
michael@0 | 773 | * '{get 2() {}}'. |
michael@0 | 774 | * |
michael@0 | 775 | * Pops the top three values on the stack as 'val', 'id' and 'obj', defines |
michael@0 | 776 | * 'id' getter of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 777 | * Category: Literals |
michael@0 | 778 | * Type: Object |
michael@0 | 779 | * Operands: |
michael@0 | 780 | * Stack: obj, id, val => obj |
michael@0 | 781 | */ \ |
michael@0 | 782 | macro(JSOP_INITELEM_GETTER, 99, "initelem_getter", NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \ |
michael@0 | 783 | /* |
michael@0 | 784 | * Initialize a numeric setter in an object literal like |
michael@0 | 785 | * '{set 2(v) {}}'. |
michael@0 | 786 | * |
michael@0 | 787 | * Pops the top three values on the stack as 'val', 'id' and 'obj', defines |
michael@0 | 788 | * 'id' setter of 'obj' as 'val', pushes 'obj' onto the stack. |
michael@0 | 789 | * Category: Literals |
michael@0 | 790 | * Type: Object |
michael@0 | 791 | * Operands: |
michael@0 | 792 | * Stack: obj, id, val => obj |
michael@0 | 793 | */ \ |
michael@0 | 794 | macro(JSOP_INITELEM_SETTER, 100, "initelem_setter", NULL, 1, 3, 1, JOF_BYTE|JOF_ELEM|JOF_SET|JOF_DETECTING) \ |
michael@0 | 795 | \ |
michael@0 | 796 | macro(JSOP_UNUSED101, 101, "unused101", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 797 | macro(JSOP_UNUSED102, 102, "unused102", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 798 | macro(JSOP_UNUSED103, 103, "unused103", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 799 | macro(JSOP_UNUSED104, 104, "unused104", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 800 | macro(JSOP_UNUSED105, 105, "unused105", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 801 | \ |
michael@0 | 802 | /* The argument is the offset to the next statement and is used by IonMonkey. */ \ |
michael@0 | 803 | macro(JSOP_LABEL, 106,"label", NULL, 5, 0, 0, JOF_JUMP) \ |
michael@0 | 804 | \ |
michael@0 | 805 | macro(JSOP_UNUSED107, 107,"unused107", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 806 | \ |
michael@0 | 807 | /* |
michael@0 | 808 | * Invokes 'callee' with 'this' and 'args', pushes return value onto the |
michael@0 | 809 | * stack. |
michael@0 | 810 | * |
michael@0 | 811 | * If 'callee' is determined to be the canonical 'Function.prototype.call' |
michael@0 | 812 | * function, then this operation is optimized to directly call 'callee' |
michael@0 | 813 | * with 'args[0]' as 'this', and the remaining arguments as formal args |
michael@0 | 814 | * to 'callee'. |
michael@0 | 815 | * |
michael@0 | 816 | * Like JSOP_FUNAPPLY but for 'f.call' instead of 'f.apply'. |
michael@0 | 817 | * Category: Statements |
michael@0 | 818 | * Type: Function |
michael@0 | 819 | * Operands: uint16_t argc |
michael@0 | 820 | * Stack: callee, this, args[0], ..., args[argc-1] => rval |
michael@0 | 821 | * nuses: (argc+2) |
michael@0 | 822 | */ \ |
michael@0 | 823 | macro(JSOP_FUNCALL, 108,"funcall", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 824 | \ |
michael@0 | 825 | /* This opcode is the target of the backwards jump for some loop. */ \ |
michael@0 | 826 | macro(JSOP_LOOPHEAD, 109,"loophead", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 827 | \ |
michael@0 | 828 | /* ECMA-compliant assignment ops. */ \ |
michael@0 | 829 | /* |
michael@0 | 830 | * Looks up name on the scope chain and pushes the scope which contains |
michael@0 | 831 | * the name onto the stack. If not found, pushes global scope onto the |
michael@0 | 832 | * stack. |
michael@0 | 833 | * Category: Variables and Scopes |
michael@0 | 834 | * Type: Variables |
michael@0 | 835 | * Operands: uint32_t nameIndex |
michael@0 | 836 | * Stack: => scope |
michael@0 | 837 | */ \ |
michael@0 | 838 | macro(JSOP_BINDNAME, 110,"bindname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_SET) \ |
michael@0 | 839 | /* |
michael@0 | 840 | * Pops a scope and value from the stack, assigns value to the given name, |
michael@0 | 841 | * and pushes the value back on the stack |
michael@0 | 842 | * Category: Variables and Scopes |
michael@0 | 843 | * Type: Variables |
michael@0 | 844 | * Operands: uint32_t nameIndex |
michael@0 | 845 | * Stack: scope, val => val |
michael@0 | 846 | */ \ |
michael@0 | 847 | macro(JSOP_SETNAME, 111,"setname", NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING) \ |
michael@0 | 848 | \ |
michael@0 | 849 | /* Exception handling ops. */ \ |
michael@0 | 850 | macro(JSOP_THROW, 112,js_throw_str, NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 851 | \ |
michael@0 | 852 | /* |
michael@0 | 853 | * Pops the top two values 'id' and 'obj' from the stack, then pushes |
michael@0 | 854 | * 'id in obj'. This will throw a 'TypeError' if 'obj' is not an object. |
michael@0 | 855 | * |
michael@0 | 856 | * Note that 'obj' is the top value. |
michael@0 | 857 | * Category: Operator |
michael@0 | 858 | * Type: Special Operators |
michael@0 | 859 | * Operands: |
michael@0 | 860 | * Stack: id, obj => (id in obj) |
michael@0 | 861 | */ \ |
michael@0 | 862 | macro(JSOP_IN, 113,js_in_str, js_in_str, 1, 2, 1, JOF_BYTE|JOF_LEFTASSOC) \ |
michael@0 | 863 | /* |
michael@0 | 864 | * Pops the top two values 'obj' and 'ctor' from the stack, then pushes |
michael@0 | 865 | * 'obj instanceof ctor'. This will throw a 'TypeError' if 'obj' is not an |
michael@0 | 866 | * object. |
michael@0 | 867 | * Category: Operator |
michael@0 | 868 | * Type: Special Operators |
michael@0 | 869 | * Operands: |
michael@0 | 870 | * Stack: obj, ctor => (obj instanceof ctor) |
michael@0 | 871 | */ \ |
michael@0 | 872 | macro(JSOP_INSTANCEOF,114,js_instanceof_str,js_instanceof_str,1,2,1,JOF_BYTE|JOF_LEFTASSOC|JOF_TMPSLOT) \ |
michael@0 | 873 | \ |
michael@0 | 874 | /* |
michael@0 | 875 | * Invokes debugger. |
michael@0 | 876 | * Category: Statements |
michael@0 | 877 | * Type: Debugger |
michael@0 | 878 | * Operands: |
michael@0 | 879 | * Stack: => |
michael@0 | 880 | */ \ |
michael@0 | 881 | macro(JSOP_DEBUGGER, 115,"debugger", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 882 | \ |
michael@0 | 883 | /* gosub/retsub for finally handling */ \ |
michael@0 | 884 | macro(JSOP_GOSUB, 116,"gosub", NULL, 5, 0, 0, JOF_JUMP) \ |
michael@0 | 885 | macro(JSOP_RETSUB, 117,"retsub", NULL, 1, 2, 0, JOF_BYTE) \ |
michael@0 | 886 | \ |
michael@0 | 887 | /* More exception handling ops. */ \ |
michael@0 | 888 | macro(JSOP_EXCEPTION, 118,"exception", NULL, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 889 | \ |
michael@0 | 890 | /* |
michael@0 | 891 | * Embedded lineno to speedup 'pc->line' mapping. |
michael@0 | 892 | * Category: Other |
michael@0 | 893 | * Operands: uint32_t lineno |
michael@0 | 894 | * Stack: => |
michael@0 | 895 | */ \ |
michael@0 | 896 | macro(JSOP_LINENO, 119,"lineno", NULL, 3, 0, 0, JOF_UINT16) \ |
michael@0 | 897 | \ |
michael@0 | 898 | /* |
michael@0 | 899 | * ECMA-compliant switch statement ops. |
michael@0 | 900 | * CONDSWITCH is a decompilable NOP; CASE is ===, POP, jump if true, re-push |
michael@0 | 901 | * lval if false; and DEFAULT is POP lval and GOTO. |
michael@0 | 902 | */ \ |
michael@0 | 903 | macro(JSOP_CONDSWITCH,120,"condswitch", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 904 | macro(JSOP_CASE, 121,"case", NULL, 5, 2, 1, JOF_JUMP) \ |
michael@0 | 905 | macro(JSOP_DEFAULT, 122,"default", NULL, 5, 1, 0, JOF_JUMP) \ |
michael@0 | 906 | \ |
michael@0 | 907 | /* ECMA-compliant call to eval op. */ \ |
michael@0 | 908 | /* |
michael@0 | 909 | * Invokes 'eval' with 'args' and pushes return value onto the stack. |
michael@0 | 910 | * |
michael@0 | 911 | * If 'eval' in global scope is not original one, invokes the function |
michael@0 | 912 | * with 'this' and 'args', and pushes return value onto the stack. |
michael@0 | 913 | * Category: Statements |
michael@0 | 914 | * Type: Function |
michael@0 | 915 | * Operands: uint16_t argc |
michael@0 | 916 | * Stack: callee, this, args[0], ..., args[argc-1] => rval |
michael@0 | 917 | * nuses: (argc+2) |
michael@0 | 918 | */ \ |
michael@0 | 919 | macro(JSOP_EVAL, 123,"eval", NULL, 3, -1, 1, JOF_UINT16|JOF_INVOKE|JOF_TYPESET) \ |
michael@0 | 920 | \ |
michael@0 | 921 | macro(JSOP_UNUSED124, 124, "unused124", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 922 | macro(JSOP_UNUSED125, 125, "unused125", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 923 | macro(JSOP_UNUSED126, 126, "unused126", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 924 | \ |
michael@0 | 925 | /* |
michael@0 | 926 | * Defines the given function on the current scope. |
michael@0 | 927 | * |
michael@0 | 928 | * This is used for global scripts and also in some cases for function |
michael@0 | 929 | * scripts where use of dynamic scoping inhibits optimization. |
michael@0 | 930 | * Category: Variables and Scopes |
michael@0 | 931 | * Type: Variables |
michael@0 | 932 | * Operands: uint32_t funcIndex |
michael@0 | 933 | * Stack: => |
michael@0 | 934 | */ \ |
michael@0 | 935 | macro(JSOP_DEFFUN, 127,"deffun", NULL, 5, 0, 0, JOF_OBJECT) \ |
michael@0 | 936 | /* |
michael@0 | 937 | * Defines the new binding on the frame's current variables-object (the |
michael@0 | 938 | * scope object on the scope chain designated to receive new variables) |
michael@0 | 939 | * with 'READONLY' attribute. |
michael@0 | 940 | * |
michael@0 | 941 | * This is used for global scripts and also in some cases for function |
michael@0 | 942 | * scripts where use of dynamic scoping inhibits optimization. |
michael@0 | 943 | * Category: Variables and Scopes |
michael@0 | 944 | * Type: Variables |
michael@0 | 945 | * Operands: uint32_t nameIndex |
michael@0 | 946 | * Stack: => |
michael@0 | 947 | */ \ |
michael@0 | 948 | macro(JSOP_DEFCONST, 128,"defconst", NULL, 5, 0, 0, JOF_ATOM) \ |
michael@0 | 949 | /* |
michael@0 | 950 | * Defines the new binding on the frame's current variables-object (the |
michael@0 | 951 | * scope object on the scope chain designated to receive new variables). |
michael@0 | 952 | * |
michael@0 | 953 | * This is used for global scripts and also in some cases for function |
michael@0 | 954 | * scripts where use of dynamic scoping inhibits optimization. |
michael@0 | 955 | * Category: Variables and Scopes |
michael@0 | 956 | * Type: Variables |
michael@0 | 957 | * Operands: uint32_t nameIndex |
michael@0 | 958 | * Stack: => |
michael@0 | 959 | */ \ |
michael@0 | 960 | macro(JSOP_DEFVAR, 129,"defvar", NULL, 5, 0, 0, JOF_ATOM) \ |
michael@0 | 961 | \ |
michael@0 | 962 | /* |
michael@0 | 963 | * Pushes a closure for a named or anonymous function expression onto the |
michael@0 | 964 | * stack. |
michael@0 | 965 | * Category: Statements |
michael@0 | 966 | * Type: Function |
michael@0 | 967 | * Operands: uint32_t funcIndex |
michael@0 | 968 | * Stack: => obj |
michael@0 | 969 | */ \ |
michael@0 | 970 | macro(JSOP_LAMBDA, 130, "lambda", NULL, 5, 0, 1, JOF_OBJECT) \ |
michael@0 | 971 | /* |
michael@0 | 972 | * Pops the top of stack value as 'this', pushes an arrow function with |
michael@0 | 973 | * 'this' onto the stack. |
michael@0 | 974 | * Category: Statements |
michael@0 | 975 | * Type: Function |
michael@0 | 976 | * Operands: uint32_t funcIndex |
michael@0 | 977 | * Stack: this => obj |
michael@0 | 978 | */ \ |
michael@0 | 979 | macro(JSOP_LAMBDA_ARROW, 131, "lambda_arrow", NULL, 5, 1, 1, JOF_OBJECT) \ |
michael@0 | 980 | \ |
michael@0 | 981 | /* |
michael@0 | 982 | * Pushes current callee onto the stack. |
michael@0 | 983 | * |
michael@0 | 984 | * Used for named function expression self-naming, if lightweight. |
michael@0 | 985 | * Category: Variables and Scopes |
michael@0 | 986 | * Type: Arguments |
michael@0 | 987 | * Operands: |
michael@0 | 988 | * Stack: => callee |
michael@0 | 989 | */ \ |
michael@0 | 990 | macro(JSOP_CALLEE, 132, "callee", NULL, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 991 | \ |
michael@0 | 992 | /* |
michael@0 | 993 | * Picks the nth element from the stack and moves it to the top of the |
michael@0 | 994 | * stack. |
michael@0 | 995 | * Category: Operator |
michael@0 | 996 | * Type: Stack Operations |
michael@0 | 997 | * Operands: uint8_t n |
michael@0 | 998 | * Stack: v[n], v[n-1], ..., v[1], v[0] => v[n-1], ..., v[1], v[0], v[n] |
michael@0 | 999 | */ \ |
michael@0 | 1000 | macro(JSOP_PICK, 133, "pick", NULL, 2, 0, 0, JOF_UINT8|JOF_TMPSLOT2) \ |
michael@0 | 1001 | \ |
michael@0 | 1002 | /* |
michael@0 | 1003 | * Exception handling no-op, for more economical byte-coding than SRC_TRYFIN |
michael@0 | 1004 | * srcnote-annotated JSOP_NOPs and to simply stack balance handling. |
michael@0 | 1005 | */ \ |
michael@0 | 1006 | macro(JSOP_TRY, 134,"try", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1007 | macro(JSOP_FINALLY, 135,"finally", NULL, 1, 0, 2, JOF_BYTE) \ |
michael@0 | 1008 | \ |
michael@0 | 1009 | /* |
michael@0 | 1010 | * Pushes aliased variable onto the stack. |
michael@0 | 1011 | * |
michael@0 | 1012 | * An "aliased variable" is a var, let, or formal arg that is aliased. |
michael@0 | 1013 | * Sources of aliasing include: nested functions accessing the vars of an |
michael@0 | 1014 | * enclosing function, function statements that are conditionally executed, |
michael@0 | 1015 | * 'eval', 'with', and 'arguments'. All of these cases require creating a |
michael@0 | 1016 | * CallObject to own the aliased variable. |
michael@0 | 1017 | * |
michael@0 | 1018 | * An ALIASEDVAR opcode contains the following immediates: |
michael@0 | 1019 | * uint8 hops: the number of scope objects to skip to find the ScopeObject |
michael@0 | 1020 | * containing the variable being accessed |
michael@0 | 1021 | * uint24 slot: the slot containing the variable in the ScopeObject (this |
michael@0 | 1022 | * 'slot' does not include RESERVED_SLOTS). |
michael@0 | 1023 | * Category: Variables and Scopes |
michael@0 | 1024 | * Type: Aliased Variables |
michael@0 | 1025 | * Operands: uint8_t hops, uint24_t slot |
michael@0 | 1026 | * Stack: => aliasedVar |
michael@0 | 1027 | */ \ |
michael@0 | 1028 | macro(JSOP_GETALIASEDVAR, 136,"getaliasedvar",NULL, 5, 0, 1, JOF_SCOPECOORD|JOF_NAME|JOF_TYPESET) \ |
michael@0 | 1029 | /* |
michael@0 | 1030 | * Sets aliased variable as the top of stack value. |
michael@0 | 1031 | * Category: Variables and Scopes |
michael@0 | 1032 | * Type: Aliased Variables |
michael@0 | 1033 | * Operands: uint8_t hops, uint24_t slot |
michael@0 | 1034 | * Stack: v => v |
michael@0 | 1035 | */ \ |
michael@0 | 1036 | macro(JSOP_SETALIASEDVAR, 137,"setaliasedvar",NULL, 5, 1, 1, JOF_SCOPECOORD|JOF_NAME|JOF_SET|JOF_DETECTING) \ |
michael@0 | 1037 | \ |
michael@0 | 1038 | macro(JSOP_UNUSED138, 138, "unused138", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1039 | macro(JSOP_UNUSED139, 139, "unused139", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1040 | macro(JSOP_UNUSED140, 140, "unused140", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1041 | macro(JSOP_UNUSED141, 141, "unused141", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1042 | macro(JSOP_UNUSED142, 142, "unused142", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1043 | \ |
michael@0 | 1044 | /* |
michael@0 | 1045 | * Pushes the value of the intrinsic onto the stack. |
michael@0 | 1046 | * |
michael@0 | 1047 | * Intrinsic names are emitted instead of JSOP_*NAME ops when the |
michael@0 | 1048 | * 'CompileOptions' flag 'selfHostingMode' is set. |
michael@0 | 1049 | * |
michael@0 | 1050 | * They are used in self-hosted code to access other self-hosted values and |
michael@0 | 1051 | * intrinsic functions the runtime doesn't give client JS code access to. |
michael@0 | 1052 | * Category: Variables and Scopes |
michael@0 | 1053 | * Type: Intrinsics |
michael@0 | 1054 | * Operands: uint32_t nameIndex |
michael@0 | 1055 | * Stack: => intrinsic[name] |
michael@0 | 1056 | */ \ |
michael@0 | 1057 | macro(JSOP_GETINTRINSIC, 143, "getintrinsic", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET) \ |
michael@0 | 1058 | /* |
michael@0 | 1059 | * Pops the top two values on the stack as 'val' and 'scope', sets intrinsic |
michael@0 | 1060 | * as 'val', and pushes 'val' onto the stack. |
michael@0 | 1061 | * |
michael@0 | 1062 | * 'scope' is not used. |
michael@0 | 1063 | * Category: Variables and Scopes |
michael@0 | 1064 | * Type: Intrinsics |
michael@0 | 1065 | * Operands: uint32_t nameIndex |
michael@0 | 1066 | * Stack: scope, val => val |
michael@0 | 1067 | */ \ |
michael@0 | 1068 | macro(JSOP_SETINTRINSIC, 144, "setintrinsic", NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING) \ |
michael@0 | 1069 | /* |
michael@0 | 1070 | * Pushes 'intrinsicHolder' onto the stack. |
michael@0 | 1071 | * Category: Variables and Scopes |
michael@0 | 1072 | * Type: Intrinsics |
michael@0 | 1073 | * Operands: uint32_t nameIndex |
michael@0 | 1074 | * Stack: => intrinsicHolder |
michael@0 | 1075 | */ \ |
michael@0 | 1076 | macro(JSOP_BINDINTRINSIC, 145, "bindintrinsic", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_SET) \ |
michael@0 | 1077 | \ |
michael@0 | 1078 | /* Unused. */ \ |
michael@0 | 1079 | macro(JSOP_UNUSED146, 146,"unused146", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1080 | macro(JSOP_UNUSED147, 147,"unused147", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1081 | macro(JSOP_UNUSED148, 148,"unused148", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1082 | \ |
michael@0 | 1083 | /* Placeholders for a real jump opcode set during backpatch chain fixup. */ \ |
michael@0 | 1084 | macro(JSOP_BACKPATCH, 149,"backpatch", NULL, 5, 0, 0, JOF_JUMP) \ |
michael@0 | 1085 | macro(JSOP_UNUSED150, 150,"unused150", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1086 | \ |
michael@0 | 1087 | /* Set pending exception from the stack, to trigger rethrow. */ \ |
michael@0 | 1088 | macro(JSOP_THROWING, 151,"throwing", NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 1089 | \ |
michael@0 | 1090 | /* |
michael@0 | 1091 | * Pops the top of stack value as 'rval', sets the return value in stack |
michael@0 | 1092 | * frame as 'rval'. |
michael@0 | 1093 | * Category: Statements |
michael@0 | 1094 | * Type: Function |
michael@0 | 1095 | * Operands: |
michael@0 | 1096 | * Stack: rval => |
michael@0 | 1097 | */ \ |
michael@0 | 1098 | macro(JSOP_SETRVAL, 152,"setrval", NULL, 1, 1, 0, JOF_BYTE) \ |
michael@0 | 1099 | /* |
michael@0 | 1100 | * Stops interpretation and returns value set by JSOP_SETRVAL. When not set, |
michael@0 | 1101 | * returns 'undefined'. |
michael@0 | 1102 | * |
michael@0 | 1103 | * Also emitted at end of script so interpreter don't need to check if |
michael@0 | 1104 | * opcode is still in script range. |
michael@0 | 1105 | * Category: Statements |
michael@0 | 1106 | * Type: Function |
michael@0 | 1107 | * Operands: |
michael@0 | 1108 | * Stack: => |
michael@0 | 1109 | */ \ |
michael@0 | 1110 | macro(JSOP_RETRVAL, 153,"retrval", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1111 | \ |
michael@0 | 1112 | /* |
michael@0 | 1113 | * Looks up name on global scope and pushes its value onto the stack. |
michael@0 | 1114 | * |
michael@0 | 1115 | * Free variable references that must either be found on the global or a |
michael@0 | 1116 | * ReferenceError. |
michael@0 | 1117 | * Category: Variables and Scopes |
michael@0 | 1118 | * Type: Free Variables |
michael@0 | 1119 | * Operands: uint32_t nameIndex |
michael@0 | 1120 | * Stack: => val |
michael@0 | 1121 | */ \ |
michael@0 | 1122 | macro(JSOP_GETGNAME, 154,"getgname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_GNAME) \ |
michael@0 | 1123 | /* |
michael@0 | 1124 | * Pops the top two values on the stack as 'val' and 'scope', sets property |
michael@0 | 1125 | * of 'scope' as 'val' and pushes 'val' back on the stack. |
michael@0 | 1126 | * |
michael@0 | 1127 | * 'scope' should be the global scope. |
michael@0 | 1128 | * Category: Variables and Scopes |
michael@0 | 1129 | * Type: Free Variables |
michael@0 | 1130 | * Operands: uint32_t nameIndex |
michael@0 | 1131 | * Stack: scope, val => val |
michael@0 | 1132 | */ \ |
michael@0 | 1133 | macro(JSOP_SETGNAME, 155,"setgname", NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_DETECTING|JOF_GNAME) \ |
michael@0 | 1134 | \ |
michael@0 | 1135 | macro(JSOP_UNUSED156, 156, "unused156", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1136 | macro(JSOP_UNUSED157, 157, "unused157", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1137 | macro(JSOP_UNUSED158, 158, "unused158", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1138 | macro(JSOP_UNUSED159, 159, "unused159", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1139 | \ |
michael@0 | 1140 | /* |
michael@0 | 1141 | * Pushes a regular expression literal onto the stack. |
michael@0 | 1142 | * It requires special "clone on exec" handling. |
michael@0 | 1143 | * Category: Literals |
michael@0 | 1144 | * Type: RegExp |
michael@0 | 1145 | * Operands: uint32_t regexpIndex |
michael@0 | 1146 | * Stack: => regexp |
michael@0 | 1147 | */ \ |
michael@0 | 1148 | macro(JSOP_REGEXP, 160,"regexp", NULL, 5, 0, 1, JOF_REGEXP) \ |
michael@0 | 1149 | \ |
michael@0 | 1150 | macro(JSOP_UNUSED161, 161,"unused161", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1151 | macro(JSOP_UNUSED162, 162,"unused162", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1152 | macro(JSOP_UNUSED163, 163,"unused163", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1153 | macro(JSOP_UNUSED164, 164,"unused164", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1154 | macro(JSOP_UNUSED165, 165,"unused165", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1155 | macro(JSOP_UNUSED166, 166,"unused166", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1156 | macro(JSOP_UNUSED167, 167,"unused167", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1157 | macro(JSOP_UNUSED168, 168,"unused168", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1158 | macro(JSOP_UNUSED169, 169,"unused169", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1159 | macro(JSOP_UNUSED170, 170,"unused170", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1160 | macro(JSOP_UNUSED171, 171,"unused171", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1161 | macro(JSOP_UNUSED172, 172,"unused172", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1162 | macro(JSOP_UNUSED173, 173,"unused173", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1163 | macro(JSOP_UNUSED174, 174,"unused174", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1164 | macro(JSOP_UNUSED175, 175,"unused175", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1165 | macro(JSOP_UNUSED176, 176,"unused176", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1166 | macro(JSOP_UNUSED177, 177,"unused177", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1167 | macro(JSOP_UNUSED178, 178,"unused178", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1168 | macro(JSOP_UNUSED179, 179,"unused179", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1169 | macro(JSOP_UNUSED180, 180,"unused180", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1170 | macro(JSOP_UNUSED181, 181,"unused181", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1171 | macro(JSOP_UNUSED182, 182,"unused182", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1172 | macro(JSOP_UNUSED183, 183,"unused183", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1173 | \ |
michael@0 | 1174 | /* |
michael@0 | 1175 | * Pops the top of stack value, pushes property of it onto the stack. |
michael@0 | 1176 | * |
michael@0 | 1177 | * Like JSOP_GETPROP but for call context. |
michael@0 | 1178 | * Category: Literals |
michael@0 | 1179 | * Type: Object |
michael@0 | 1180 | * Operands: uint32_t nameIndex |
michael@0 | 1181 | * Stack: obj => obj[name] |
michael@0 | 1182 | */ \ |
michael@0 | 1183 | macro(JSOP_CALLPROP, 184,"callprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \ |
michael@0 | 1184 | \ |
michael@0 | 1185 | macro(JSOP_UNUSED185, 185,"unused185", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1186 | macro(JSOP_UNUSED186, 186,"unused186", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1187 | macro(JSOP_UNUSED187, 187,"unused187", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1188 | \ |
michael@0 | 1189 | /* |
michael@0 | 1190 | * Pushes unsigned 24-bit int immediate integer operand onto the stack. |
michael@0 | 1191 | * Category: Literals |
michael@0 | 1192 | * Type: Constants |
michael@0 | 1193 | * Operands: uint24_t val |
michael@0 | 1194 | * Stack: => val |
michael@0 | 1195 | */ \ |
michael@0 | 1196 | macro(JSOP_UINT24, 188,"uint24", NULL, 4, 0, 1, JOF_UINT24) \ |
michael@0 | 1197 | \ |
michael@0 | 1198 | macro(JSOP_UNUSED189, 189,"unused189", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1199 | macro(JSOP_UNUSED190, 190,"unused190", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1200 | macro(JSOP_UNUSED191, 191,"unused191", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1201 | macro(JSOP_UNUSED192, 192,"unused192", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1202 | \ |
michael@0 | 1203 | /* |
michael@0 | 1204 | * Pops the top two values on the stack as 'propval' and 'obj', pushes |
michael@0 | 1205 | * 'propval' property of 'obj' onto the stack. |
michael@0 | 1206 | * |
michael@0 | 1207 | * Like JSOP_GETELEM but for call context. |
michael@0 | 1208 | * Category: Literals |
michael@0 | 1209 | * Type: Object |
michael@0 | 1210 | * Operands: |
michael@0 | 1211 | * Stack: obj, propval => obj[propval] |
michael@0 | 1212 | */ \ |
michael@0 | 1213 | macro(JSOP_CALLELEM, 193, "callelem", NULL, 1, 2, 1, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC) \ |
michael@0 | 1214 | \ |
michael@0 | 1215 | /* |
michael@0 | 1216 | * '__proto__: v' inside an object initializer. |
michael@0 | 1217 | * |
michael@0 | 1218 | * Pops the top two values on the stack as 'newProto' and 'obj', sets |
michael@0 | 1219 | * prototype of 'obj' as 'newProto', pushes 'true' onto the stack if |
michael@0 | 1220 | * succeeded, 'false' if not. |
michael@0 | 1221 | * Category: Literals |
michael@0 | 1222 | * Type: Object |
michael@0 | 1223 | * Operands: |
michael@0 | 1224 | * Stack: obj, newProto => succeeded |
michael@0 | 1225 | */ \ |
michael@0 | 1226 | macro(JSOP_MUTATEPROTO, 194, "mutateproto",NULL, 1, 2, 1, JOF_BYTE) \ |
michael@0 | 1227 | \ |
michael@0 | 1228 | /* |
michael@0 | 1229 | * Pops the top of stack value, gets an extant property value of it, |
michael@0 | 1230 | * throwing ReferenceError if the identified property does not exist. |
michael@0 | 1231 | * Category: Literals |
michael@0 | 1232 | * Type: Object |
michael@0 | 1233 | * Operands: uint32_t nameIndex |
michael@0 | 1234 | * Stack: obj => obj[name] |
michael@0 | 1235 | */ \ |
michael@0 | 1236 | macro(JSOP_GETXPROP, 195,"getxprop", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET) \ |
michael@0 | 1237 | \ |
michael@0 | 1238 | macro(JSOP_UNUSED196, 196,"unused196", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1239 | \ |
michael@0 | 1240 | /* |
michael@0 | 1241 | * Pops the top stack value as 'val' and pushes 'typeof val'. Note that |
michael@0 | 1242 | * this opcode isn't used when, in the original source code, 'val' is a |
michael@0 | 1243 | * name -- see 'JSOP_TYPEOF' for that. |
michael@0 | 1244 | * (This is because 'typeof undefinedName === "undefined"'.) |
michael@0 | 1245 | * Category: Operator |
michael@0 | 1246 | * Type: Special Operators |
michael@0 | 1247 | * Operands: |
michael@0 | 1248 | * Stack: val => (typeof val) |
michael@0 | 1249 | */ \ |
michael@0 | 1250 | macro(JSOP_TYPEOFEXPR, 197,"typeofexpr", NULL, 1, 1, 1, JOF_BYTE|JOF_DETECTING) \ |
michael@0 | 1251 | \ |
michael@0 | 1252 | /* Block-local scope support. */ \ |
michael@0 | 1253 | /* |
michael@0 | 1254 | * Pushes block onto the scope chain. |
michael@0 | 1255 | * Category: Variables and Scopes |
michael@0 | 1256 | * Type: Block-local Scope |
michael@0 | 1257 | * Operands: uint32_t staticBlockObjectIndex |
michael@0 | 1258 | * Stack: => |
michael@0 | 1259 | */ \ |
michael@0 | 1260 | macro(JSOP_PUSHBLOCKSCOPE,198,"pushblockscope", NULL, 5, 0, 0, JOF_OBJECT) \ |
michael@0 | 1261 | /* |
michael@0 | 1262 | * Pops block from the scope chain. |
michael@0 | 1263 | * Category: Variables and Scopes |
michael@0 | 1264 | * Type: Block-local Scope |
michael@0 | 1265 | * Operands: |
michael@0 | 1266 | * Stack: => |
michael@0 | 1267 | */ \ |
michael@0 | 1268 | macro(JSOP_POPBLOCKSCOPE, 199,"popblockscope", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1269 | /* |
michael@0 | 1270 | * The opcode to assist the debugger. |
michael@0 | 1271 | * Category: Statements |
michael@0 | 1272 | * Type: Debugger |
michael@0 | 1273 | * Operands: |
michael@0 | 1274 | * Stack: => |
michael@0 | 1275 | */ \ |
michael@0 | 1276 | macro(JSOP_DEBUGLEAVEBLOCK, 200,"debugleaveblock", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1277 | \ |
michael@0 | 1278 | macro(JSOP_UNUSED201, 201,"unused201", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1279 | \ |
michael@0 | 1280 | /* |
michael@0 | 1281 | * Initializes generator frame, creates a generator, sets 'YIELDING' flag, |
michael@0 | 1282 | * stops interpretation and returns the generator. |
michael@0 | 1283 | * Category: Statements |
michael@0 | 1284 | * Type: Generator |
michael@0 | 1285 | * Operands: |
michael@0 | 1286 | * Stack: => |
michael@0 | 1287 | */ \ |
michael@0 | 1288 | macro(JSOP_GENERATOR, 202,"generator", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1289 | /* |
michael@0 | 1290 | * Pops the top of stack value as 'rval1', sets 'YIELDING' flag, |
michael@0 | 1291 | * stops interpretation and returns 'rval1', pushes sent value from |
michael@0 | 1292 | * 'send()' onto the stack. |
michael@0 | 1293 | * Category: Statements |
michael@0 | 1294 | * Type: Generator |
michael@0 | 1295 | * Operands: |
michael@0 | 1296 | * Stack: rval1 => rval2 |
michael@0 | 1297 | */ \ |
michael@0 | 1298 | macro(JSOP_YIELD, 203,"yield", NULL, 1, 1, 1, JOF_BYTE) \ |
michael@0 | 1299 | /* |
michael@0 | 1300 | * Pops the top two values on the stack as 'obj' and 'v', pushes 'v' to |
michael@0 | 1301 | * 'obj'. |
michael@0 | 1302 | * |
michael@0 | 1303 | * This opcode is used for Array Comprehension. |
michael@0 | 1304 | * Category: Literals |
michael@0 | 1305 | * Type: Array |
michael@0 | 1306 | * Operands: |
michael@0 | 1307 | * Stack: v, obj => |
michael@0 | 1308 | */ \ |
michael@0 | 1309 | macro(JSOP_ARRAYPUSH, 204,"arraypush", NULL, 1, 2, 0, JOF_BYTE) \ |
michael@0 | 1310 | \ |
michael@0 | 1311 | macro(JSOP_UNUSED205, 205, "unused205", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1312 | macro(JSOP_UNUSED206, 206, "unused206", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1313 | \ |
michael@0 | 1314 | macro(JSOP_UNUSED207, 207, "unused207", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1315 | macro(JSOP_UNUSED208, 208, "unused208", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1316 | macro(JSOP_UNUSED209, 209, "unused209", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1317 | macro(JSOP_UNUSED210, 210, "unused210", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1318 | macro(JSOP_UNUSED211, 211, "unused211", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1319 | macro(JSOP_UNUSED212, 212, "unused212", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1320 | macro(JSOP_UNUSED213, 213, "unused213", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1321 | /* |
michael@0 | 1322 | * Pushes the global scope onto the stack. |
michael@0 | 1323 | * |
michael@0 | 1324 | * 'nameIndex' is not used. |
michael@0 | 1325 | * Category: Variables and Scopes |
michael@0 | 1326 | * Type: Free Variables |
michael@0 | 1327 | * Operands: uint32_t nameIndex |
michael@0 | 1328 | * Stack: => global |
michael@0 | 1329 | */ \ |
michael@0 | 1330 | macro(JSOP_BINDGNAME, 214, "bindgname", NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_SET|JOF_GNAME) \ |
michael@0 | 1331 | \ |
michael@0 | 1332 | /* |
michael@0 | 1333 | * Pushes 8-bit int immediate integer operand onto the stack. |
michael@0 | 1334 | * Category: Literals |
michael@0 | 1335 | * Type: Constants |
michael@0 | 1336 | * Operands: int8_t val |
michael@0 | 1337 | * Stack: => val |
michael@0 | 1338 | */ \ |
michael@0 | 1339 | macro(JSOP_INT8, 215, "int8", NULL, 2, 0, 1, JOF_INT8) \ |
michael@0 | 1340 | /* |
michael@0 | 1341 | * Pushes 32-bit int immediate integer operand onto the stack. |
michael@0 | 1342 | * Category: Literals |
michael@0 | 1343 | * Type: Constants |
michael@0 | 1344 | * Operands: int32_t val |
michael@0 | 1345 | * Stack: => val |
michael@0 | 1346 | */ \ |
michael@0 | 1347 | macro(JSOP_INT32, 216, "int32", NULL, 5, 0, 1, JOF_INT32) \ |
michael@0 | 1348 | \ |
michael@0 | 1349 | /* |
michael@0 | 1350 | * Pops the top of stack value, pushes the 'length' property of it onto the |
michael@0 | 1351 | * stack. |
michael@0 | 1352 | * Category: Literals |
michael@0 | 1353 | * Type: Array |
michael@0 | 1354 | * Operands: uint32_t nameIndex |
michael@0 | 1355 | * Stack: obj => obj['length'] |
michael@0 | 1356 | */ \ |
michael@0 | 1357 | macro(JSOP_LENGTH, 217, "length", NULL, 5, 1, 1, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3) \ |
michael@0 | 1358 | \ |
michael@0 | 1359 | /* |
michael@0 | 1360 | * Pushes a JS_ELEMENTS_HOLE value onto the stack, representing an omitted |
michael@0 | 1361 | * property in an array literal (e.g. property 0 in the array '[, 1]'). |
michael@0 | 1362 | * |
michael@0 | 1363 | * This opcode is used with the JSOP_NEWARRAY opcode. |
michael@0 | 1364 | * Category: Literals |
michael@0 | 1365 | * Type: Array |
michael@0 | 1366 | * Operands: |
michael@0 | 1367 | * Stack: => hole |
michael@0 | 1368 | */ \ |
michael@0 | 1369 | macro(JSOP_HOLE, 218, "hole", NULL, 1, 0, 1, JOF_BYTE) \ |
michael@0 | 1370 | \ |
michael@0 | 1371 | macro(JSOP_UNUSED219, 219,"unused219", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1372 | macro(JSOP_UNUSED220, 220,"unused220", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1373 | macro(JSOP_UNUSED221, 221,"unused221", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1374 | macro(JSOP_UNUSED222, 222,"unused222", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1375 | macro(JSOP_UNUSED223, 223,"unused223", NULL, 1, 0, 0, JOF_BYTE) \ |
michael@0 | 1376 | \ |
michael@0 | 1377 | /* |
michael@0 | 1378 | * Creates rest parameter array for current function call, and pushes it |
michael@0 | 1379 | * onto the stack. |
michael@0 | 1380 | * Category: Variables and Scopes |
michael@0 | 1381 | * Type: Arguments |
michael@0 | 1382 | * Operands: |
michael@0 | 1383 | * Stack: => rest |
michael@0 | 1384 | */ \ |
michael@0 | 1385 | macro(JSOP_REST, 224, "rest", NULL, 1, 0, 1, JOF_BYTE|JOF_TYPESET) \ |
michael@0 | 1386 | \ |
michael@0 | 1387 | /* |
michael@0 | 1388 | * Pops the top of stack value, converts it into a jsid (int or string), and |
michael@0 | 1389 | * pushes it onto the stack. |
michael@0 | 1390 | * Category: Literals |
michael@0 | 1391 | * Type: Object |
michael@0 | 1392 | * Operands: |
michael@0 | 1393 | * Stack: obj, id => obj, (jsid of id) |
michael@0 | 1394 | */ \ |
michael@0 | 1395 | macro(JSOP_TOID, 225, "toid", NULL, 1, 1, 1, JOF_BYTE) \ |
michael@0 | 1396 | \ |
michael@0 | 1397 | /* |
michael@0 | 1398 | * Pushes the implicit 'this' value for calls to the associated name onto |
michael@0 | 1399 | * the stack. |
michael@0 | 1400 | * Category: Variables and Scopes |
michael@0 | 1401 | * Type: This |
michael@0 | 1402 | * Operands: uint32_t nameIndex |
michael@0 | 1403 | * Stack: => this |
michael@0 | 1404 | */ \ |
michael@0 | 1405 | macro(JSOP_IMPLICITTHIS, 226, "implicitthis", "", 5, 0, 1, JOF_ATOM) \ |
michael@0 | 1406 | \ |
michael@0 | 1407 | /* |
michael@0 | 1408 | * This opcode is the target of the entry jump for some loop. The uint8 |
michael@0 | 1409 | * argument is a bitfield. The lower 7 bits of the argument indicate the |
michael@0 | 1410 | * loop depth. This value starts at 1 and is just a hint: deeply nested |
michael@0 | 1411 | * loops all have the same value. The upper bit is set if Ion should be |
michael@0 | 1412 | * able to OSR at this point, which is true unless there is non-loop state |
michael@0 | 1413 | * on the stack. |
michael@0 | 1414 | */ \ |
michael@0 | 1415 | macro(JSOP_LOOPENTRY, 227, "loopentry", NULL, 2, 0, 0, JOF_UINT8) |
michael@0 | 1416 | |
michael@0 | 1417 | /* |
michael@0 | 1418 | * In certain circumstances it may be useful to "pad out" the opcode space to |
michael@0 | 1419 | * a power of two. Use this macro to do so. |
michael@0 | 1420 | */ |
michael@0 | 1421 | #define FOR_EACH_TRAILING_UNUSED_OPCODE(macro) \ |
michael@0 | 1422 | macro(228) \ |
michael@0 | 1423 | macro(229) \ |
michael@0 | 1424 | macro(230) \ |
michael@0 | 1425 | macro(231) \ |
michael@0 | 1426 | macro(232) \ |
michael@0 | 1427 | macro(233) \ |
michael@0 | 1428 | macro(234) \ |
michael@0 | 1429 | macro(235) \ |
michael@0 | 1430 | macro(236) \ |
michael@0 | 1431 | macro(237) \ |
michael@0 | 1432 | macro(238) \ |
michael@0 | 1433 | macro(239) \ |
michael@0 | 1434 | macro(240) \ |
michael@0 | 1435 | macro(241) \ |
michael@0 | 1436 | macro(242) \ |
michael@0 | 1437 | macro(243) \ |
michael@0 | 1438 | macro(244) \ |
michael@0 | 1439 | macro(245) \ |
michael@0 | 1440 | macro(246) \ |
michael@0 | 1441 | macro(247) \ |
michael@0 | 1442 | macro(248) \ |
michael@0 | 1443 | macro(249) \ |
michael@0 | 1444 | macro(250) \ |
michael@0 | 1445 | macro(251) \ |
michael@0 | 1446 | macro(252) \ |
michael@0 | 1447 | macro(253) \ |
michael@0 | 1448 | macro(254) \ |
michael@0 | 1449 | macro(255) |
michael@0 | 1450 | |
michael@0 | 1451 | namespace js { |
michael@0 | 1452 | |
michael@0 | 1453 | // Sanity check that opcode values and trailing unused opcodes completely cover |
michael@0 | 1454 | // the [0, 256) range. Avert your eyes! You don't want to know how the |
michael@0 | 1455 | // sausage gets made. |
michael@0 | 1456 | |
michael@0 | 1457 | #define VALUE_AND_VALUE_PLUS_ONE(op, val, ...) \ |
michael@0 | 1458 | val) && (val + 1 == |
michael@0 | 1459 | #define TRAILING_VALUE_AND_VALUE_PLUS_ONE(val) \ |
michael@0 | 1460 | val) && (val + 1 == |
michael@0 | 1461 | static_assert((0 == |
michael@0 | 1462 | FOR_EACH_OPCODE(VALUE_AND_VALUE_PLUS_ONE) |
michael@0 | 1463 | FOR_EACH_TRAILING_UNUSED_OPCODE(TRAILING_VALUE_AND_VALUE_PLUS_ONE) |
michael@0 | 1464 | 256), |
michael@0 | 1465 | "opcode values and trailing unused opcode values monotonically " |
michael@0 | 1466 | "increase from zero to 255"); |
michael@0 | 1467 | #undef TRAILING_VALUE_AND_VALUE_PLUS_ONE |
michael@0 | 1468 | #undef VALUE_AND_VALUE_PLUS_ONE |
michael@0 | 1469 | |
michael@0 | 1470 | // Define JSOP_*_LENGTH constants for all ops. |
michael@0 | 1471 | #define DEFINE_LENGTH_CONSTANT(op, val, name, image, len, ...) \ |
michael@0 | 1472 | MOZ_CONSTEXPR_VAR size_t op##_LENGTH = len; |
michael@0 | 1473 | FOR_EACH_OPCODE(DEFINE_LENGTH_CONSTANT) |
michael@0 | 1474 | #undef DEFINE_LENGTH_CONSTANT |
michael@0 | 1475 | |
michael@0 | 1476 | } // namespace js |
michael@0 | 1477 | |
michael@0 | 1478 | #endif // vm_Opcodes_h |