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/. */
7 #ifndef vm_JSAtomState_h
8 #define vm_JSAtomState_h
10 #include "gc/Barrier.h"
11 #include "js/ProtoKey.h"
12 #include "js/Symbol.h"
13 #include "vm/CommonPropertyNames.h"
19 /* Various built-in or commonly-used names pinned on first context. */
21 #define PROPERTYNAME_FIELD(id, text) \
22 js::ImmutableTenuredPtr<js::PropertyName*> id;
23 FOR_EACH_COMMON_PROPERTYNAME(PROPERTYNAME_FIELD
)
24 #undef PROPERTYNAME_FIELD
25 #define PROPERTYNAME_FIELD(name, clasp) \
26 js::ImmutableTenuredPtr<js::PropertyName*> name;
27 JS_FOR_EACH_PROTOTYPE(PROPERTYNAME_FIELD
)
28 #undef PROPERTYNAME_FIELD
29 #define PROPERTYNAME_FIELD(name) \
30 js::ImmutableTenuredPtr<js::PropertyName*> name;
31 JS_FOR_EACH_WELL_KNOWN_SYMBOL(PROPERTYNAME_FIELD
)
32 #undef PROPERTYNAME_FIELD
33 #define PROPERTYNAME_FIELD(name) \
34 js::ImmutableTenuredPtr<js::PropertyName*> Symbol_##name;
35 JS_FOR_EACH_WELL_KNOWN_SYMBOL(PROPERTYNAME_FIELD
)
36 #undef PROPERTYNAME_FIELD
38 js::ImmutableTenuredPtr
<js::PropertyName
*>* wellKnownSymbolNames() {
39 #define FIRST_PROPERTYNAME_FIELD(name) return &name;
40 JS_FOR_EACH_WELL_KNOWN_SYMBOL(FIRST_PROPERTYNAME_FIELD
)
41 #undef FIRST_PROPERTYNAME_FIELD
44 js::ImmutableTenuredPtr
<js::PropertyName
*>* wellKnownSymbolDescriptions() {
45 #define FIRST_PROPERTYNAME_FIELD(name) return &Symbol_##name;
46 JS_FOR_EACH_WELL_KNOWN_SYMBOL(FIRST_PROPERTYNAME_FIELD
)
47 #undef FIRST_PROPERTYNAME_FIELD
53 #define NAME_OFFSET(name) offsetof(JSAtomState, name)
55 inline Handle
<PropertyName
*> AtomStateOffsetToName(const JSAtomState
& atomState
,
57 return *reinterpret_cast<js::ImmutableTenuredPtr
<js::PropertyName
*>*>(
58 (char*)&atomState
+ offset
);
63 #endif /* vm_JSAtomState_h */