no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / dom / bindings / JSSlots.h
blob54aed1289d80c6edc0508e6bbb96ea6e5c4bb9df
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /**
8 * This file defines various reserved slot indices used by JavaScript
9 * reflections of DOM objects.
11 #ifndef mozilla_dom_DOMSlots_h
12 #define mozilla_dom_DOMSlots_h
14 // We use slot 0 for holding the raw object. This is safe for both
15 // globals and non-globals.
16 // NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
17 // LSetDOMProperty. Those constants need to be changed accordingly if this value
18 // changes.
19 #define DOM_OBJECT_SLOT 0
21 // The total number of slots non-proxy DOM objects use by default.
22 // Specific objects may have more for storing cached values.
23 #define DOM_INSTANCE_RESERVED_SLOTS 1
25 // Interface objects store a number of reserved slots equal to
26 // INTERFACE_OBJECT_INFO_RESERVED_SLOT + number of legacy factory functions,
27 // with a maximum of js::FunctionExtended::NUM_EXTENDED_SLOTS.
28 // INTERFACE_OBJECT_INFO_RESERVED_SLOT contains the DOMInterfaceInfo.
29 // INTERFACE_OBJECT_FIRST_LEGACY_FACTORY_FUNCTION and higher contain the
30 // JSObjects for the legacy factory functions.
31 enum {
32 INTERFACE_OBJECT_INFO_RESERVED_SLOT = 0,
33 INTERFACE_OBJECT_FIRST_LEGACY_FACTORY_FUNCTION,
35 // See js::FunctionExtended::NUM_EXTENDED_SLOTS.
36 #define INTERFACE_OBJECT_MAX_SLOTS 3
38 // Legacy factory functions store a JSNativeHolder in the
39 // LEGACY_FACTORY_FUNCTION_NATIVE_HOLDER_RESERVED_SLOT slot.
40 enum { LEGACY_FACTORY_FUNCTION_NATIVE_HOLDER_RESERVED_SLOT = 0 };
42 // Interface prototype objects store a number of reserved slots equal to
43 // DOM_INTERFACE_PROTO_SLOTS_BASE or DOM_INTERFACE_PROTO_SLOTS_BASE + 1 if a
44 // slot for the unforgeable holder is needed.
45 #define DOM_INTERFACE_PROTO_SLOTS_BASE 0
47 // The slot index of raw pointer of dom object stored in observable array exotic
48 // object. We need this in order to call the OnSet* and OnDelete* callbacks.
49 #define OBSERVABLE_ARRAY_DOM_INTERFACE_SLOT 0
51 // The slot index of backing list stored in observable array exotic object.
52 #define OBSERVABLE_ARRAY_BACKING_LIST_OBJECT_SLOT 1
54 #endif /* mozilla_dom_DOMSlots_h */