Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / js / src / vm / BuiltinObjectKind.h
blob5dba6ce3f55cef702629afd3b47a7ee9bd1e7c11
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
10 #include <stdint.h>
12 #include "jstypes.h"
14 struct JS_PUBLIC_API JSContext;
15 class JS_PUBLIC_API JSObject;
17 namespace js {
19 namespace frontend {
20 class TaggedParserAtomIndex;
23 class GlobalObject;
25 /**
26 * Built-in objects used by the GetBuiltinConstructor and GetBuiltinPrototype
27 * self-hosted intrinsics.
29 enum class BuiltinObjectKind : uint8_t {
30 // Built-in constructors.
31 Array,
32 ArrayBuffer,
33 Int32Array,
34 Map,
35 Promise,
36 RegExp,
37 Set,
38 SharedArrayBuffer,
39 Symbol,
41 // Built-in prototypes.
42 FunctionPrototype,
43 IteratorPrototype,
44 ObjectPrototype,
45 RegExpPrototype,
46 StringPrototype,
48 // Built-in Intl prototypes.
49 DateTimeFormatPrototype,
50 NumberFormatPrototype,
52 // Invalid placeholder.
53 None,
56 /**
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);
63 /**
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);
69 /**
70 * Return the built-in object if already created for the given global. Otherwise
71 * return nullptr.
73 JSObject* MaybeGetBuiltinObject(GlobalObject* global, BuiltinObjectKind kind);
75 /**
76 * Return the built-in object for the given global.
78 JSObject* GetOrCreateBuiltinObject(JSContext* cx, BuiltinObjectKind kind);
80 /**
81 * Return the display name for a built-in object.
83 const char* BuiltinObjectName(BuiltinObjectKind kind);
85 } // namespace js
87 #endif /* vm_BuiltinObjectKind_h */