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_BuiltinObjectKind_h
8 #define vm_BuiltinObjectKind_h
14 struct JS_PUBLIC_API JSContext
;
15 class JS_PUBLIC_API JSObject
;
20 class TaggedParserAtomIndex
;
26 * Built-in objects used by the GetBuiltinConstructor and GetBuiltinPrototype
27 * self-hosted intrinsics.
29 enum class BuiltinObjectKind
: uint8_t {
30 // Built-in constructors.
41 // Built-in prototypes.
48 // Built-in Intl prototypes.
49 DateTimeFormatPrototype
,
50 NumberFormatPrototype
,
52 // Invalid placeholder.
57 * Return the BuiltinObjectKind for the given constructor name. Return
58 * BuiltinObjectKind::None if no matching constructor was found.
60 BuiltinObjectKind
BuiltinConstructorForName(
61 frontend::TaggedParserAtomIndex name
);
64 * Return the BuiltinObjectKind for the given prototype name. Return
65 * BuiltinObjectKind::None if no matching prototype was found.
67 BuiltinObjectKind
BuiltinPrototypeForName(frontend::TaggedParserAtomIndex name
);
70 * Return the built-in object if already created for the given global. Otherwise
73 JSObject
* MaybeGetBuiltinObject(GlobalObject
* global
, BuiltinObjectKind kind
);
76 * Return the built-in object for the given global.
78 JSObject
* GetOrCreateBuiltinObject(JSContext
* cx
, BuiltinObjectKind kind
);
81 * Return the display name for a built-in object.
83 const char* BuiltinObjectName(BuiltinObjectKind kind
);
87 #endif /* vm_BuiltinObjectKind_h */