1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
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 /* JSClass definition and its component types, plus related interfaces. */
12 #include "mozilla/DebugOnly.h"
16 #include "js/CallArgs.h"
18 #include "js/TypeDecls.h"
21 * A JSClass acts as a vtable for JS objects that allows JSAPI clients to
22 * control various aspects of the behavior of an object like property lookup.
23 * js::Class is an engine-private extension that allows more control over
24 * object behavior and, e.g., allows custom slow layout.
28 struct JSFunctionSpec
;
37 // This is equal to JSFunction::class_. Use it in places where you don't want
38 // to #include jsfun.h.
39 extern JS_FRIEND_DATA(const js::Class
* const) FunctionClassPtr
;
49 // JSClass operation signatures.
51 // Add or get a property named by id in obj. Note the jsid id type -- id may
52 // be a string (Unicode property identifier) or an int (element index). The
53 // *vp out parameter, on success, is the new property value after the action.
55 (* JSPropertyOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
56 JS::MutableHandleValue vp
);
58 // Set a property named by id in obj, treating the assignment as strict
59 // mode code if strict is true. Note the jsid id type -- id may be a string
60 // (Unicode property identifier) or an int (element index). The *vp out
61 // parameter, on success, is the new property value after the
64 (* JSStrictPropertyOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
65 bool strict
, JS::MutableHandleValue vp
);
67 // Delete a property named by id in obj.
69 // If an error occurred, return false as per normal JSAPI error practice.
71 // If no error occurred, but the deletion attempt wasn't allowed (perhaps
72 // because the property was non-configurable), set *succeeded to false and
73 // return true. This will cause |delete obj[id]| to evaluate to false in
74 // non-strict mode code, and to throw a TypeError in strict mode code.
76 // If no error occurred and the deletion wasn't disallowed (this is *not* the
77 // same as saying that a deletion actually occurred -- deleting a non-existent
78 // property, or an inherited property, is allowed -- it's just pointless),
79 // set *succeeded to true and return true.
81 (* JSDeletePropertyOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
84 // The type of ObjectOps::enumerate. This callback overrides a portion of SpiderMonkey's default
85 // [[Enumerate]] internal method. When an ordinary object is enumerated, that object and each object
86 // on its prototype chain is tested for an enumerate op, and those ops are called in order.
87 // The properties each op adds to the 'properties' vector are added to the set of values the
88 // for-in loop will iterate over. All of this is nonstandard.
90 // An object is "enumerated" when it's the target of a for-in loop or JS_Enumerate().
91 // All other property inspection, including Object.keys(obj), goes through [[OwnKeys]].
93 // The callback's job is to populate 'properties' with all property keys that the for-in loop
96 (* JSNewEnumerateOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::AutoIdVector
& properties
);
98 // The old-style JSClass.enumerate op should define all lazy properties not
99 // yet reflected in obj.
101 (* JSEnumerateOp
)(JSContext
* cx
, JS::HandleObject obj
);
103 // Resolve a lazy property named by id in obj by defining it directly in obj.
104 // Lazy properties are those reflected from some peer native property space
105 // (e.g., the DOM attributes for a given node reflected as obj) on demand.
107 // JS looks for a property in an object, and if not found, tries to resolve
108 // the given id. *resolvedp should be set to true iff the property was
109 // was defined on |obj|.
112 (* JSResolveOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
115 // Convert obj to the given type, returning true with the resulting value in
116 // *vp on success, and returning false on error or exception.
118 (* JSConvertOp
)(JSContext
* cx
, JS::HandleObject obj
, JSType type
,
119 JS::MutableHandleValue vp
);
121 // Finalize obj, which the garbage collector has determined to be unreachable
122 // from other live objects or from GC roots. Obviously, finalizers must never
123 // store a reference to obj.
125 (* JSFinalizeOp
)(JSFreeOp
* fop
, JSObject
* obj
);
127 // Finalizes external strings created by JS_NewExternalString.
128 struct JSStringFinalizer
{
129 void (*finalize
)(const JSStringFinalizer
* fin
, char16_t
* chars
);
132 // Check whether v is an instance of obj. Return false on error or exception,
133 // true on success with true in *bp if v is an instance of obj, false in
136 (* JSHasInstanceOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::MutableHandleValue vp
,
139 // Function type for trace operation of the class called to enumerate all
140 // traceable things reachable from obj's private data structure. For each such
141 // thing, a trace implementation must call one of the JS_Call*Tracer variants
144 // JSTraceOp implementation can assume that no other threads mutates object
145 // state. It must not change state of the object or corresponding native
146 // structures. The only exception for this rule is the case when the embedding
147 // needs a tight integration with GC. In that case the embedding can check if
148 // the traversal is a part of the marking phase through calling
149 // JS_IsGCMarkingTracer and apply a special code like emptying caches or
150 // marking its native structures.
152 (* JSTraceOp
)(JSTracer
* trc
, JSObject
* obj
);
155 (* JSWeakmapKeyDelegateOp
)(JSObject
* obj
);
158 (* JSObjectMovedOp
)(JSObject
* obj
, const JSObject
* old
);
160 /* js::Class operation signatures. */
165 (* LookupGenericOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
166 JS::MutableHandleObject objp
, JS::MutableHandle
<Shape
*> propp
);
168 (* LookupPropOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::Handle
<PropertyName
*> name
,
169 JS::MutableHandleObject objp
, JS::MutableHandle
<Shape
*> propp
);
171 (* LookupElementOp
)(JSContext
* cx
, JS::HandleObject obj
, uint32_t index
,
172 JS::MutableHandleObject objp
, JS::MutableHandle
<Shape
*> propp
);
174 (* DefineGenericOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
, JS::HandleValue value
,
175 JSPropertyOp getter
, JSStrictPropertyOp setter
, unsigned attrs
);
177 (* DefinePropOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::Handle
<PropertyName
*> name
,
178 JS::HandleValue value
, JSPropertyOp getter
, JSStrictPropertyOp setter
,
181 (* DefineElementOp
)(JSContext
* cx
, JS::HandleObject obj
, uint32_t index
, JS::HandleValue value
,
182 JSPropertyOp getter
, JSStrictPropertyOp setter
, unsigned attrs
);
184 (* GenericIdOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleObject receiver
, JS::HandleId id
,
185 JS::MutableHandleValue vp
);
187 (* PropertyIdOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleObject receiver
,
188 JS::Handle
<PropertyName
*> name
, JS::MutableHandleValue vp
);
190 (* ElementIdOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleObject receiver
, uint32_t index
,
191 JS::MutableHandleValue vp
);
193 (* StrictGenericIdOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
,
194 JS::MutableHandleValue vp
, bool strict
);
196 (* StrictPropertyIdOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::Handle
<PropertyName
*> name
,
197 JS::MutableHandleValue vp
, bool strict
);
199 (* StrictElementIdOp
)(JSContext
* cx
, JS::HandleObject obj
, uint32_t index
,
200 JS::MutableHandleValue vp
, bool strict
);
202 (* GenericAttributesOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
, unsigned* attrsp
);
204 (* PropertyAttributesOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::Handle
<PropertyName
*> name
,
207 (* DeleteGenericOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
, bool* succeeded
);
210 (* WatchOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
, JS::HandleObject callable
);
213 (* UnwatchOp
)(JSContext
* cx
, JS::HandleObject obj
, JS::HandleId id
);
215 class JS_FRIEND_API(ElementAdder
)
219 // Check if the element exists before performing the Get and preserve
221 CheckHasElemPreserveHoles
,
223 // Perform a Get operation, like obj[index] in JS.
228 // Only one of these is used.
229 JS::RootedObject resObj_
;
233 mozilla::DebugOnly
<uint32_t> length_
;
234 GetBehavior getBehavior_
;
237 ElementAdder(JSContext
* cx
, JSObject
* obj
, uint32_t length
, GetBehavior behavior
)
238 : resObj_(cx
, obj
), vp_(nullptr), index_(0), length_(length
), getBehavior_(behavior
)
240 ElementAdder(JSContext
* cx
, JS::Value
* vp
, uint32_t length
, GetBehavior behavior
)
241 : resObj_(cx
), vp_(vp
), index_(0), length_(length
), getBehavior_(behavior
)
244 GetBehavior
getBehavior() const { return getBehavior_
; }
246 void append(JSContext
* cx
, JS::HandleValue v
);
251 (* GetElementsOp
)(JSContext
* cx
, JS::HandleObject obj
, uint32_t begin
, uint32_t end
,
252 ElementAdder
* adder
);
254 // A generic type for functions mapping an object to another object, or null
255 // if an error or exception was thrown on cx.
257 (* ObjectOp
)(JSContext
* cx
, JS::HandleObject obj
);
259 // Hook to map an object to its inner object. Infallible.
261 (* InnerObjectOp
)(JSObject
* obj
);
264 (* FinalizeOp
)(FreeOp
* fop
, JSObject
* obj
);
266 #define JS_CLASS_MEMBERS(FinalizeOpType) \
270 /* Function pointer members (may be null). */ \
271 JSPropertyOp addProperty; \
272 JSDeletePropertyOp delProperty; \
273 JSPropertyOp getProperty; \
274 JSStrictPropertyOp setProperty; \
275 JSEnumerateOp enumerate; \
276 JSResolveOp resolve; \
277 JSConvertOp convert; \
278 FinalizeOpType finalize; \
280 JSHasInstanceOp hasInstance; \
281 JSNative construct; \
284 // Callback for the creation of constructor and prototype objects.
285 typedef JSObject
* (*ClassObjectCreationOp
)(JSContext
* cx
, JSProtoKey key
);
287 // Callback for custom post-processing after class initialization via ClassSpec.
288 typedef bool (*FinishClassInitOp
)(JSContext
* cx
, JS::HandleObject ctor
,
289 JS::HandleObject proto
);
291 const size_t JSCLASS_CACHED_PROTO_WIDTH
= 6;
295 ClassObjectCreationOp createConstructor
;
296 ClassObjectCreationOp createPrototype
;
297 const JSFunctionSpec
* constructorFunctions
;
298 const JSFunctionSpec
* prototypeFunctions
;
299 const JSPropertySpec
* prototypeProperties
;
300 FinishClassInitOp finishInit
;
303 static const size_t ParentKeyWidth
= JSCLASS_CACHED_PROTO_WIDTH
;
305 static const uintptr_t ParentKeyMask
= (1 << ParentKeyWidth
) - 1;
306 static const uintptr_t DontDefineConstructor
= 1 << ParentKeyWidth
;
308 bool defined() const { return !!createConstructor
; }
310 bool dependent() const {
311 MOZ_ASSERT(defined());
312 return (flags
& ParentKeyMask
);
315 JSProtoKey
parentKey() const {
316 static_assert(JSProto_Null
== 0, "zeroed key must be null");
317 return JSProtoKey(flags
& ParentKeyMask
);
320 bool shouldDefineConstructor() const {
321 MOZ_ASSERT(defined());
322 return !(flags
& DontDefineConstructor
);
326 struct ClassExtension
328 ObjectOp outerObject
;
329 InnerObjectOp innerObject
;
332 * isWrappedNative is true only if the class is an XPCWrappedNative.
333 * WeakMaps use this to override the wrapper disposal optimization.
335 bool isWrappedNative
;
338 * If an object is used as a key in a weakmap, it may be desirable for the
339 * garbage collector to keep that object around longer than it otherwise
340 * would. A common case is when the key is a wrapper around an object in
341 * another compartment, and we want to avoid collecting the wrapper (and
342 * removing the weakmap entry) as long as the wrapped object is alive. In
343 * that case, the wrapped object is returned by the wrapper's
344 * weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakmap
345 * key, it will not be collected (and remain in the weakmap) until the
346 * wrapped object is collected.
348 JSWeakmapKeyDelegateOp weakmapKeyDelegateOp
;
351 * Optional hook called when an object is moved by a compacting GC.
353 * There may exist weak pointers to an object that are not traced through
354 * when the normal trace APIs are used, for example objects in the wrapper
355 * cache. This hook allows these pointers to be updated.
357 * Note that this hook can be called before JS_NewObject() returns if a GC
358 * is triggered during construction of the object. This can happen for
359 * global objects for example.
361 JSObjectMovedOp objectMovedOp
;
364 #define JS_NULL_CLASS_SPEC {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr}
365 #define JS_NULL_CLASS_EXT {nullptr,nullptr,false,nullptr,nullptr}
369 LookupGenericOp lookupGeneric
;
370 LookupPropOp lookupProperty
;
371 LookupElementOp lookupElement
;
372 DefineGenericOp defineGeneric
;
373 DefinePropOp defineProperty
;
374 DefineElementOp defineElement
;
375 GenericIdOp getGeneric
;
376 PropertyIdOp getProperty
;
377 ElementIdOp getElement
;
378 StrictGenericIdOp setGeneric
;
379 StrictPropertyIdOp setProperty
;
380 StrictElementIdOp setElement
;
381 GenericAttributesOp getGenericAttributes
;
382 GenericAttributesOp setGenericAttributes
;
383 DeleteGenericOp deleteGeneric
;
386 GetElementsOp getElements
;
387 JSNewEnumerateOp enumerate
;
391 #define JS_NULL_OBJECT_OPS \
392 {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, \
393 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, \
394 nullptr, nullptr, nullptr}
398 // Classes, objects, and properties.
400 typedef void (*JSClassInternal
)();
403 JS_CLASS_MEMBERS(JSFinalizeOp
);
408 #define JSCLASS_HAS_PRIVATE (1<<0) // objects have private slot
409 #define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) // private is (nsISupports*)
410 #define JSCLASS_IS_DOMJSCLASS (1<<4) // objects are DOM
411 #define JSCLASS_IMPLEMENTS_BARRIERS (1<<5) // Correctly implements GC read
412 // and write barriers
413 #define JSCLASS_EMULATES_UNDEFINED (1<<6) // objects of this class act
414 // like the value undefined,
416 #define JSCLASS_USERBIT1 (1<<7) // Reserved for embeddings.
418 // To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or
419 // JSCLASS_HAS_RESERVED_SLOTS(n) into the initializer for JSClass.flags, where
420 // n is a constant in [1, 255]. Reserved slots are indexed from 0 to n-1.
421 #define JSCLASS_RESERVED_SLOTS_SHIFT 8 // room for 8 flags below */
422 #define JSCLASS_RESERVED_SLOTS_WIDTH 8 // and 16 above this field */
423 #define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH)
424 #define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \
425 << JSCLASS_RESERVED_SLOTS_SHIFT)
426 #define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \
427 >> JSCLASS_RESERVED_SLOTS_SHIFT) \
428 & JSCLASS_RESERVED_SLOTS_MASK)
430 #define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \
431 JSCLASS_RESERVED_SLOTS_WIDTH)
433 #define JSCLASS_IS_ANONYMOUS (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0))
434 #define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+1))
435 #define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2))
436 #define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3))
438 #define JSCLASS_IS_PROXY (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4))
440 #define JSCLASS_FINALIZE_FROM_NURSERY (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5))
442 // Reserved for embeddings.
443 #define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6))
444 #define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7))
446 #define JSCLASS_BACKGROUND_FINALIZE (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8))
448 // Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see
451 // ECMA-262 requires that most constructors used internally create objects
452 // with "the original Foo.prototype value" as their [[Prototype]] (__proto__)
453 // member initial value. The "original ... value" verbiage is there because
454 // in ECMA-262, global properties naming class objects are read/write and
455 // deleteable, for the most part.
457 // Implementing this efficiently requires that global objects have classes
458 // with the following flags. Failure to use JSCLASS_GLOBAL_FLAGS was
459 // previously allowed, but is now an ES5 violation and thus unsupported.
461 // JSCLASS_GLOBAL_APPLICATION_SLOTS is the number of slots reserved at
462 // the beginning of every global object's slots for use by the
464 #define JSCLASS_GLOBAL_APPLICATION_SLOTS 4
465 #define JSCLASS_GLOBAL_SLOT_COUNT (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 3 + 30)
466 #define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \
467 (JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n)))
468 #define JSCLASS_GLOBAL_FLAGS \
469 JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0)
470 #define JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(clasp) \
471 (((clasp)->flags & JSCLASS_IS_GLOBAL) \
472 && JSCLASS_RESERVED_SLOTS(clasp) >= JSCLASS_GLOBAL_SLOT_COUNT)
474 // Fast access to the original value of each standard class's prototype.
475 #define JSCLASS_CACHED_PROTO_SHIFT (JSCLASS_HIGH_FLAGS_SHIFT + 10)
476 #define JSCLASS_CACHED_PROTO_MASK JS_BITMASK(JSCLASS_CACHED_PROTO_WIDTH)
477 #define JSCLASS_HAS_CACHED_PROTO(key) (uint32_t(key) << JSCLASS_CACHED_PROTO_SHIFT)
478 #define JSCLASS_CACHED_PROTO_KEY(clasp) ((JSProtoKey) \
480 >> JSCLASS_CACHED_PROTO_SHIFT) \
481 & JSCLASS_CACHED_PROTO_MASK))
483 // Initializer for unused members of statically initialized JSClass structs.
484 #define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
485 #define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
491 JS_CLASS_MEMBERS(FinalizeOp
);
496 /* Class is not native and its map is not a scope. */
497 static const uint32_t NON_NATIVE
= JSCLASS_INTERNAL_FLAG2
;
499 bool isNative() const {
500 return !(flags
& NON_NATIVE
);
503 bool hasPrivate() const {
504 return !!(flags
& JSCLASS_HAS_PRIVATE
);
507 bool emulatesUndefined() const {
508 return flags
& JSCLASS_EMULATES_UNDEFINED
;
511 bool isJSFunction() const {
512 return this == js::FunctionClassPtr
;
515 bool nonProxyCallable() const {
516 MOZ_ASSERT(!isProxy());
517 return isJSFunction() || call
;
520 bool isProxy() const {
521 return flags
& JSCLASS_IS_PROXY
;
524 bool isDOMClass() const {
525 return flags
& JSCLASS_IS_DOMJSCLASS
;
528 static size_t offsetOfFlags() { return offsetof(Class
, flags
); }
531 static_assert(offsetof(JSClass
, name
) == offsetof(Class
, name
),
532 "Class and JSClass must be consistent");
533 static_assert(offsetof(JSClass
, flags
) == offsetof(Class
, flags
),
534 "Class and JSClass must be consistent");
535 static_assert(offsetof(JSClass
, addProperty
) == offsetof(Class
, addProperty
),
536 "Class and JSClass must be consistent");
537 static_assert(offsetof(JSClass
, delProperty
) == offsetof(Class
, delProperty
),
538 "Class and JSClass must be consistent");
539 static_assert(offsetof(JSClass
, getProperty
) == offsetof(Class
, getProperty
),
540 "Class and JSClass must be consistent");
541 static_assert(offsetof(JSClass
, setProperty
) == offsetof(Class
, setProperty
),
542 "Class and JSClass must be consistent");
543 static_assert(offsetof(JSClass
, enumerate
) == offsetof(Class
, enumerate
),
544 "Class and JSClass must be consistent");
545 static_assert(offsetof(JSClass
, resolve
) == offsetof(Class
, resolve
),
546 "Class and JSClass must be consistent");
547 static_assert(offsetof(JSClass
, convert
) == offsetof(Class
, convert
),
548 "Class and JSClass must be consistent");
549 static_assert(offsetof(JSClass
, finalize
) == offsetof(Class
, finalize
),
550 "Class and JSClass must be consistent");
551 static_assert(offsetof(JSClass
, call
) == offsetof(Class
, call
),
552 "Class and JSClass must be consistent");
553 static_assert(offsetof(JSClass
, construct
) == offsetof(Class
, construct
),
554 "Class and JSClass must be consistent");
555 static_assert(offsetof(JSClass
, hasInstance
) == offsetof(Class
, hasInstance
),
556 "Class and JSClass must be consistent");
557 static_assert(offsetof(JSClass
, trace
) == offsetof(Class
, trace
),
558 "Class and JSClass must be consistent");
559 static_assert(sizeof(JSClass
) == sizeof(Class
),
560 "Class and JSClass must be consistent");
562 static MOZ_ALWAYS_INLINE
const JSClass
*
563 Jsvalify(const Class
* c
)
565 return (const JSClass
*)c
;
568 static MOZ_ALWAYS_INLINE
const Class
*
569 Valueify(const JSClass
* c
)
571 return (const Class
*)c
;
575 * Enumeration describing possible values of the [[Class]] internal property
579 ESClass_Object
, ESClass_Array
, ESClass_Number
, ESClass_String
,
580 ESClass_Boolean
, ESClass_RegExp
, ESClass_ArrayBuffer
, ESClass_SharedArrayBuffer
,
581 ESClass_Date
, ESClass_Set
, ESClass_Map
,
583 // Special snowflake for the ES6 IsArray method.
584 // Please don't use it without calling that function.
589 * Return whether the given object has the given [[Class]] internal property
590 * value. Beware, this query says nothing about the js::Class of the JSObject
591 * so the caller must not assume anything about obj's representation (e.g., obj
595 ObjectClassIs(JSObject
& obj
, ESClassValue classValue
, JSContext
* cx
);
597 /* Just a helper that checks v.isObject before calling ObjectClassIs. */
599 IsObjectWithClass(const JS::Value
& v
, ESClassValue classValue
, JSContext
* cx
);
601 /* Fills |vp| with the unboxed value for boxed types, or undefined otherwise. */
603 Unbox(JSContext
* cx
, JS::HandleObject obj
, JS::MutableHandleValue vp
);
607 HasObjectMovedOp(JSObject
* obj
);
612 #endif /* js_Class_h */