1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  * vim: set ts=8 sts=2 et sw=2 tw=80:
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef vm_BytecodeFormatFlags_h
8 #define vm_BytecodeFormatFlags_h
9 
10 /*
11  * [SMDOC] Bytecode Format flags (JOF_*)
12  */
13 enum {
14   JOF_BYTE = 0,         /* single bytecode, no immediates */
15   JOF_UINT8 = 1,        /* unspecified uint8_t argument */
16   JOF_UINT16 = 2,       /* unspecified uint16_t argument */
17   JOF_UINT24 = 3,       /* unspecified uint24_t argument */
18   JOF_UINT32 = 4,       /* unspecified uint32_t argument */
19   JOF_INT8 = 5,         /* int8_t literal */
20   JOF_INT32 = 6,        /* int32_t literal */
21   JOF_JUMP = 7,         /* int32_t jump offset */
22   JOF_TABLESWITCH = 8,  /* table switch */
23   JOF_ENVCOORD = 9,     /* embedded ScopeCoordinate immediate */
24   JOF_ARGC = 10,        /* uint16_t argument count */
25   JOF_QARG = 11,        /* function argument index */
26   JOF_LOCAL = 12,       /* var or block-local variable */
27   JOF_RESUMEINDEX = 13, /* yield, await, or gosub resume index */
28   JOF_DOUBLE = 14,      /* inline DoubleValue */
29   JOF_GCTHING = 15,     /* uint32_t generic gc-thing index */
30   JOF_ATOM = 16,        /* uint32_t constant index */
31   JOF_OBJECT = 17,      /* uint32_t object index */
32   JOF_REGEXP = 18,      /* uint32_t regexp index */
33   JOF_SCOPE = 19,       /* uint32_t scope index */
34   JOF_BIGINT = 20,      /* uint32_t index for BigInt value */
35   JOF_ICINDEX = 21,     /* uint32_t IC index */
36   JOF_LOOPHEAD = 22,    /* JSOp::LoopHead, combines JOF_ICINDEX and JOF_UINT8 */
37   JOF_TWO_UINT8 = 23,   /* A pair of unspecified uint8_t arguments */
38   JOF_DEBUGCOORD = 24,  /* An embedded ScopeCoordinate immediate that may
39                            traverse DebugEnvironmentProxies*/
40   JOF_TYPEMASK = 0xFF,  /* mask for above immediate types */
41 
42   JOF_NAME = 1 << 8,        /* name operation */
43   JOF_PROP = 2 << 8,        /* obj.prop operation */
44   JOF_ELEM = 3 << 8,        /* obj[index] operation */
45   JOF_MODEMASK = 0xFF << 8, /* mask for above addressing modes */
46 
47   JOF_PROPSET = 1 << 16,     /* property/element/name set operation */
48   JOF_PROPINIT = 1 << 17,    /* property/element/name init operation */
49   JOF_CHECKSLOPPY = 1 << 18, /* op can only be generated in sloppy mode */
50   JOF_CHECKSTRICT = 1 << 19, /* op can only be generated in strict mode */
51   JOF_INVOKE = 1 << 20,      /* any call, construct, or eval instruction */
52   JOF_CONSTRUCT = 1 << 21,   /* invoke instruction using [[Construct]] entry */
53   JOF_SPREAD = 1 << 22,      /* invoke instruction using spread argument */
54   JOF_GNAME = 1 << 23,       /* predicted global name */
55   JOF_IC = 1 << 24,          /* baseline may use an IC for this op */
56 };
57 
58 #endif /* vm_BytecodeFormatFlags_h */
59