js/src/builtin/TypedObjectConstants.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * vim: set ts=8 sts=4 et sw=4 tw=99:
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 // Specialized .h file to be used by both JS and C++ code.
michael@0 8
michael@0 9 #ifndef builtin_TypedObjectConstants_h
michael@0 10 #define builtin_TypedObjectConstants_h
michael@0 11
michael@0 12 ///////////////////////////////////////////////////////////////////////////
michael@0 13 // Slots for typed prototypes
michael@0 14
michael@0 15 #define JS_TYPROTO_SLOT_DESCR 0
michael@0 16 #define JS_TYPROTO_SLOTS 1
michael@0 17
michael@0 18 ///////////////////////////////////////////////////////////////////////////
michael@0 19 // Slots for type objects
michael@0 20 //
michael@0 21 // Some slots apply to all type objects and some are specific to
michael@0 22 // particular kinds of type objects. For simplicity we use the same
michael@0 23 // number of slots no matter what kind of type descriptor we are
michael@0 24 // working with, even though this is mildly wasteful.
michael@0 25
michael@0 26 // Slots on all type objects
michael@0 27 #define JS_DESCR_SLOT_KIND 0 // Atomized string representation
michael@0 28 #define JS_DESCR_SLOT_STRING_REPR 1 // Atomized string representation
michael@0 29 #define JS_DESCR_SLOT_ALIGNMENT 2 // Alignment in bytes
michael@0 30 #define JS_DESCR_SLOT_SIZE 3 // Size in bytes, if sized, else 0
michael@0 31 #define JS_DESCR_SLOT_OPAQUE 4 // Atomized string representation
michael@0 32 #define JS_DESCR_SLOT_TYPROTO 5 // Prototype for instances, if any
michael@0 33
michael@0 34 // Slots on scalars, references, and x4s
michael@0 35 #define JS_DESCR_SLOT_TYPE 6 // Type code
michael@0 36
michael@0 37 // Slots on all array descriptors
michael@0 38 #define JS_DESCR_SLOT_ARRAY_ELEM_TYPE 6
michael@0 39
michael@0 40 // Slots on sized array descriptors
michael@0 41 #define JS_DESCR_SLOT_SIZED_ARRAY_LENGTH 7
michael@0 42
michael@0 43 // Slots on struct type objects
michael@0 44 #define JS_DESCR_SLOT_STRUCT_FIELD_NAMES 6
michael@0 45 #define JS_DESCR_SLOT_STRUCT_FIELD_TYPES 7
michael@0 46 #define JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS 8
michael@0 47
michael@0 48 // Maximum number of slots for any descriptor
michael@0 49 #define JS_DESCR_SLOTS 9
michael@0 50
michael@0 51 // These constants are for use exclusively in JS code. In C++ code,
michael@0 52 // prefer TypeRepresentation::Scalar etc, which allows you to
michael@0 53 // write a switch which will receive a warning if you omit a case.
michael@0 54 #define JS_TYPEREPR_UNSIZED_ARRAY_KIND 0
michael@0 55 #define JS_TYPEREPR_MAX_UNSIZED_KIND 0 // Unsized kinds go above here
michael@0 56 #define JS_TYPEREPR_SCALAR_KIND 1
michael@0 57 #define JS_TYPEREPR_REFERENCE_KIND 2
michael@0 58 #define JS_TYPEREPR_STRUCT_KIND 3
michael@0 59 #define JS_TYPEREPR_SIZED_ARRAY_KIND 4
michael@0 60 #define JS_TYPEREPR_X4_KIND 5
michael@0 61
michael@0 62 // These constants are for use exclusively in JS code. In C++ code,
michael@0 63 // prefer ScalarTypeRepresentation::TYPE_INT8 etc, which allows
michael@0 64 // you to write a switch which will receive a warning if you omit a
michael@0 65 // case.
michael@0 66 #define JS_SCALARTYPEREPR_INT8 0
michael@0 67 #define JS_SCALARTYPEREPR_UINT8 1
michael@0 68 #define JS_SCALARTYPEREPR_INT16 2
michael@0 69 #define JS_SCALARTYPEREPR_UINT16 3
michael@0 70 #define JS_SCALARTYPEREPR_INT32 4
michael@0 71 #define JS_SCALARTYPEREPR_UINT32 5
michael@0 72 #define JS_SCALARTYPEREPR_FLOAT32 6
michael@0 73 #define JS_SCALARTYPEREPR_FLOAT64 7
michael@0 74 #define JS_SCALARTYPEREPR_UINT8_CLAMPED 8
michael@0 75
michael@0 76 // These constants are for use exclusively in JS code. In C++ code,
michael@0 77 // prefer ReferenceTypeRepresentation::TYPE_ANY etc, which allows
michael@0 78 // you to write a switch which will receive a warning if you omit a
michael@0 79 // case.
michael@0 80 #define JS_REFERENCETYPEREPR_ANY 0
michael@0 81 #define JS_REFERENCETYPEREPR_OBJECT 1
michael@0 82 #define JS_REFERENCETYPEREPR_STRING 2
michael@0 83
michael@0 84 // These constants are for use exclusively in JS code. In C++ code,
michael@0 85 // prefer X4TypeRepresentation::TYPE_INT32 etc, since that allows
michael@0 86 // you to write a switch which will receive a warning if you omit a
michael@0 87 // case.
michael@0 88 #define JS_X4TYPEREPR_INT32 0
michael@0 89 #define JS_X4TYPEREPR_FLOAT32 1
michael@0 90
michael@0 91 ///////////////////////////////////////////////////////////////////////////
michael@0 92 // Slots for typed objects
michael@0 93
michael@0 94 #define JS_TYPEDOBJ_SLOT_BYTEOFFSET 0
michael@0 95 #define JS_TYPEDOBJ_SLOT_BYTELENGTH 1
michael@0 96 #define JS_TYPEDOBJ_SLOT_OWNER 2
michael@0 97 #define JS_TYPEDOBJ_SLOT_NEXT_VIEW 3
michael@0 98
michael@0 99 #define JS_DATAVIEW_SLOTS 4 // Number of slots for data views
michael@0 100
michael@0 101 #define JS_TYPEDOBJ_SLOT_LENGTH 4 // Length of array (see (*) below)
michael@0 102 #define JS_TYPEDOBJ_SLOT_TYPE_DESCR 5 // For typed objects, type descr
michael@0 103
michael@0 104 #define JS_TYPEDOBJ_SLOT_DATA 7 // private slot, based on alloc kind
michael@0 105 #define JS_TYPEDOBJ_SLOTS 6 // Number of slots for typed objs
michael@0 106
michael@0 107 // (*) The JS_TYPEDOBJ_SLOT_LENGTH slot stores the length for typed objects of
michael@0 108 // sized and unsized array type. The slot contains 0 for non-arrays.
michael@0 109 // The slot also contains 0 for *unattached* typed objects, no matter what
michael@0 110 // type they have.
michael@0 111
michael@0 112 #endif

mercurial