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_ATOM = 14,        /* uint32_t constant index */
29   JOF_OBJECT = 15,      /* uint32_t object index */
30   JOF_REGEXP = 16,      /* uint32_t regexp index */
31   JOF_DOUBLE = 17,      /* inline DoubleValue */
32   JOF_SCOPE = 18,       /* uint32_t scope index */
33   JOF_ICINDEX = 19,     /* uint32_t IC index */
34   JOF_LOOPHEAD = 20,    /* JSOp::LoopHead, combines JOF_ICINDEX and JOF_UINT8 */
35   JOF_BIGINT = 21,      /* uint32_t index for BigInt value */
36   JOF_CLASS_CTOR = 22,  /* uint32_t atom index, sourceStart, sourceEnd */
37   JOF_CODE_OFFSET = 23, /* int32_t bytecode offset */
38   JOF_TYPEMASK = 0x001f, /* mask for above immediate types */
39 
40   JOF_NAME = 1 << 5,     /* name operation */
41   JOF_PROP = 2 << 5,     /* obj.prop operation */
42   JOF_ELEM = 3 << 5,     /* obj[index] operation */
43   JOF_MODEMASK = 3 << 5, /* mask for above addressing modes */
44 
45   JOF_PROPSET = 1 << 7,  /* property/element/name set operation */
46   JOF_PROPINIT = 1 << 8, /* property/element/name init operation */
47   // (1 << 9) is unused.
48   JOF_CHECKSLOPPY = 1 << 10, /* op can only be generated in sloppy mode */
49   JOF_CHECKSTRICT = 1 << 11, /* op can only be generated in strict mode */
50   JOF_INVOKE = 1 << 12,      /* any call, construct, or eval instruction */
51   JOF_CONSTRUCT = 1 << 13,   /* invoke instruction using [[Construct]] entry */
52   JOF_SPREAD = 1 << 14,      /* invoke instruction using spread argument */
53   JOF_GNAME = 1 << 15,       /* predicted global name */
54   JOF_TYPESET = 1 << 16,     /* has an entry in a script's type sets */
55   JOF_IC = 1 << 17,          /* baseline may use an IC for this op */
56 };
57 
58 #endif /* vm_BytecodeFormatFlags_h */
59