Coverage Report

Created: 2025-12-12 07:27

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hermes/include/hermes/VM/JSObject.h
Line
Count
Source
1
/*
2
 * Copyright (c) Meta Platforms, Inc. and affiliates.
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
8
#ifndef HERMES_VM_JSOBJECT_H
9
#define HERMES_VM_JSOBJECT_H
10
11
#include "hermes/VM/CallResult.h"
12
#include "hermes/VM/Handle.h"
13
#include "hermes/VM/HermesValue-inline.h"
14
#include "hermes/VM/HiddenClass.h"
15
#include "hermes/VM/Operations.h"
16
#include "hermes/VM/PropertyDescriptor.h"
17
#include "hermes/VM/SmallHermesValue-inline.h"
18
#include "hermes/VM/StringView.h"
19
#include "hermes/VM/TypesafeFlags.h"
20
#include "hermes/VM/VTable.h"
21
22
#pragma GCC diagnostic push
23
24
#ifdef HERMES_COMPILER_SUPPORTS_WSHORTEN_64_TO_32
25
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
26
#endif
27
namespace hermes {
28
namespace vm {
29
30
union DefinePropertyFlags {
31
  struct {
32
    uint32_t enumerable : 1;
33
    uint32_t writable : 1;
34
    uint32_t configurable : 1;
35
36
    uint32_t setEnumerable : 1;
37
    uint32_t setWritable : 1;
38
    uint32_t setConfigurable : 1;
39
    uint32_t setGetter : 1;
40
    uint32_t setSetter : 1;
41
    uint32_t setValue : 1;
42
    /// If set, indicates that the \c internalSetter flag must be set to true.
43
    /// This is strictly for internal use only, inside the object model.
44
    uint32_t enableInternalSetter : 1;
45
  };
46
47
  uint32_t _flags;
48
49
  /// Clear all flags on construction.
50
975k
  DefinePropertyFlags() {
51
975k
    _flags = 0;
52
975k
  }
53
54
  /// \return true if all flags are clear.
55
931
  bool isEmpty() const {
56
931
    return _flags == 0;
57
931
  }
58
59
  /// Clear all bits.
60
0
  void clear() {
61
0
    _flags = 0;
62
0
  }
63
64
  /// \return true if this is an accessor.
65
3.10M
  bool isAccessor() const {
66
3.10M
    return setGetter || setSetter;
67
3.10M
  }
68
69
  /// Return an instance of DefinePropertyFlags initialized for defining a
70
  /// "normal" property: writable, enumerable, configurable and setting its
71
  /// non-accessor value.
72
923k
  static DefinePropertyFlags getDefaultNewPropertyFlags() {
73
923k
    DefinePropertyFlags dpf{};
74
923k
    dpf.setEnumerable = 1;
75
923k
    dpf.enumerable = 1;
76
923k
    dpf.setWritable = 1;
77
923k
    dpf.writable = 1;
78
923k
    dpf.setConfigurable = 1;
79
923k
    dpf.configurable = 1;
80
923k
    dpf.setValue = 1;
81
923k
    return dpf;
82
923k
  }
83
84
  /// Return an instance of DefinePropertyFlags initialized for defining a
85
  /// property which is writable, configurable and non-enumerable, and setting
86
  /// its non-accessor value.
87
46.6k
  static DefinePropertyFlags getNewNonEnumerableFlags() {
88
46.6k
    DefinePropertyFlags dpf{};
89
46.6k
    dpf.setEnumerable = 1;
90
46.6k
    dpf.enumerable = 0;
91
46.6k
    dpf.setWritable = 1;
92
46.6k
    dpf.writable = 1;
93
46.6k
    dpf.setConfigurable = 1;
94
46.6k
    dpf.configurable = 1;
95
46.6k
    dpf.setValue = 1;
96
46.6k
    return dpf;
97
46.6k
  }
98
};
99
100
/// Flags associated with an object.
101
struct ObjectFlags {
102
  /// New properties cannot be added.
103
  uint32_t noExtend : 1;
104
105
  /// \c Object.seal() has been invoked on this object, marking all properties
106
  /// as non-configurable. When \c Sealed is set, \c NoExtend is always set too.
107
  uint32_t sealed : 1;
108
109
  /// \c Object.freeze() has been invoked on this object, marking all properties
110
  /// as non-configurable and non-writable. When \c Frozen is set, \c Sealed and
111
  /// must \c NoExtend are always set too.
112
  uint32_t frozen : 1;
113
114
  /// This object has indexed storage. This flag will not change at runtime, it
115
  /// is set at construction and its value never changes. It is not a state.
116
  uint32_t indexedStorage : 1;
117
118
  /// This flag is set to true when \c IndexedStorage is true and
119
  /// \c class->hasIndexLikeProperties are false. It allows our fast paths to do
120
  /// a simple bit check.
121
  uint32_t fastIndexProperties : 1;
122
123
  /// This flag indicates this is a special object whose properties are
124
  /// managed by C++ code, and not via the standard property storage
125
  /// mechanisms.
126
  uint32_t hostObject : 1;
127
128
  /// this is lazily created object that must be initialized before it can be
129
  /// used. Note that lazy objects must have no properties defined on them,
130
  uint32_t lazyObject : 1;
131
132
  /// This flag indicates this is a proxy exotic Object
133
  uint32_t proxyObject : 1;
134
135
  static constexpr unsigned kHashWidth = 24;
136
  /// A non-zero object id value, assigned lazily. It is 0 before it is
137
  /// assigned. If an object started out as lazy, the objectID is the lazy
138
  /// object index used to identify when it gets initialized.
139
  uint32_t objectID : kHashWidth;
140
141
664k
  ObjectFlags() {
142
664k
    ::memset(this, 0, sizeof(*this));
143
664k
  }
144
};
145
146
static_assert(
147
    sizeof(ObjectFlags) == sizeof(uint32_t),
148
    "ObjectFlags must be a single word");
149
150
/// \name PropOpFlags
151
/// @{
152
/// Flags used when performing property access operations.
153
///
154
/// \name ThrowOnError
155
/// Throw a TypeError exception when one of the following conditions is
156
/// encountered:
157
///   - changing a read-only property
158
///   - reconfigure a non-configurable property
159
///   - adding a new property to non-extensible object
160
///   - deleting a non-configurable property
161
///
162
/// \name MustExist
163
/// Throw a type error if the property doesn't exist.
164
///
165
/// \name InternalForce
166
/// Used to insert an internal property, forcing the insertion no matter what.
167
/// @}
168
#define HERMES_VM__LIST_PropOpFlags(FLAG) \
169
  FLAG(ThrowOnError)                      \
170
  FLAG(MustExist)                         \
171
  FLAG(InternalForce)
172
173
HERMES_VM__DECLARE_FLAGS_CLASS(PropOpFlags, HERMES_VM__LIST_PropOpFlags);
174
175
/// \name OwnKeysFlags
176
/// @{
177
/// Flags used when performing getOwnPropertyKeys operations.
178
///
179
/// \name IncludeSymbols
180
/// Include in the result keys which are formally (and in the implementation)
181
/// Symbols.
182
///
183
/// \name IncludeNonSymbols
184
/// Include in the result keys which are formally Strings.  In the
185
/// implementation, these may actually be numbers or other non-String primitive
186
/// types.
187
///
188
/// \name IncludeNonEnumerable
189
/// Normally only enumerable keys are included in the result.  If this is set,
190
/// include non-enumerable keys, too.  The keys included will only be of the
191
/// types specified by the above flags.
192
///
193
/// Either or both of IncludeSymbols and IncludeNonSymbols may be
194
/// specified.  If neither is specified, this may cause an assertion
195
/// failure if assertions are enabled.
196
/// @}
197
#define HERMES_VM__LIST_OwnKeysFlags(FLAG) \
198
  FLAG(IncludeSymbols)                     \
199
  FLAG(IncludeNonSymbols)                  \
200
  FLAG(IncludeNonEnumerable)
201
202
HERMES_VM__DECLARE_FLAGS_CLASS(OwnKeysFlags, HERMES_VM__LIST_OwnKeysFlags);
203
204
// Any method that could potentially invoke the garbage collector, directly or
205
// in-directly, cannot use a direct 'self' pointer and must instead use
206
// Handle<JSObject>.
207
208
struct ObjectVTable : public VTable {
209
  /// \return the range of indexes (end-exclusive) stored in indexed storage.
210
  std::pair<uint32_t, uint32_t> (
211
      *getOwnIndexedRange)(JSObject *self, Runtime &runtime);
212
213
  /// Check whether property with index \p index exists in indexed storage and
214
  /// \return true if it does.
215
  bool (*haveOwnIndexed)(JSObject *self, Runtime &runtime, uint32_t index);
216
217
  /// Check whether property with index \p index exists in indexed storage and
218
  /// extract its \c PropertyFlags (if necessary checking whether the object is
219
  /// frozen or sealed). Only the \c enumerable, \c writable and
220
  /// \c configurable flags must be set in the result.
221
  /// \return PropertyFlags if the property exists.
222
  OptValue<PropertyFlags> (*getOwnIndexedPropertyFlags)(
223
      JSObject *self,
224
      Runtime &runtime,
225
      uint32_t index);
226
227
  /// Obtain an element from the "indexed storage" of this object. The storage
228
  /// itself is implementation dependent.
229
  /// \return the value of the element or "empty" if there is no such element.
230
  HermesValue (*getOwnIndexed)(
231
      PseudoHandle<JSObject> self,
232
      Runtime &runtime,
233
      uint32_t index);
234
235
  /// Set an element in the "indexed storage" of this object. Depending on the
236
  /// semantics of the "indexed storage" the storage capacity may need to be
237
  /// expanded (e.g. affecting Array.length), or the write may simply be ignored
238
  /// (in the case of typed arrays).
239
  /// It is the responsibility of the implementation of the method to check
240
  /// whether the object is "frozen" and fail. Note that some objects cannot be
241
  /// frozen, so they don't need to perform that check.
242
  /// \param value the value to be stored. In some cases (like type arrays), it
243
  ///     may need to be converted to a certain type. If the conversion fails,
244
  ///     a default value will be stored instead, but the write will succeed
245
  ///     (unless there was an exception when converting).
246
  /// \return true if the write succeeded, false if it was ignored because
247
  ///   the element is read-only, or exception status.
248
  CallResult<bool> (*setOwnIndexed)(
249
      Handle<JSObject> selfHandle,
250
      Runtime &runtime,
251
      uint32_t index,
252
      Handle<> value);
253
254
  /// Delete an element in the "indexed storage". It is the responsibility of
255
  /// the implementation of the method to check whether the object is "sealed"
256
  /// and fail appropriately. Some objects cannot be frozen and don't need to
257
  /// perform that check at all.
258
  /// \return 'true' if the element was successfully deleted, or if it was
259
  ///     outside of the storage range. 'false' if this storage doesn't support
260
  ///     "holes"/deletion (e.g. typed arrays) or if the element is read-only.
261
  bool (*deleteOwnIndexed)(
262
      Handle<JSObject> selfHandle,
263
      Runtime &runtime,
264
      uint32_t index);
265
266
  /// Mode paramater to pass to \c checkAllOwnIndexed().
267
  enum class CheckAllOwnIndexedMode {
268
    NonConfigurable,
269
    /// Both non-configurable and non-writable.
270
    ReadOnly,
271
  };
272
273
  /// Check whether all indexed properties satisfy the requirement specified by
274
  /// \p mode. Either whether they are all non-configurable, or whether they are
275
  /// all both non-configurable and non-writable.
276
  bool (*checkAllOwnIndexed)(
277
      JSObject *self,
278
      Runtime &runtime,
279
      CheckAllOwnIndexedMode mode);
280
};
281
282
/// This is the basic JavaScript Object class. All programmer-visible classes in
283
/// JavaScript (like Array, Function, Arguments, Number, String, etc) inherit
284
/// from it. At the highest level it is simply a collection of name/value
285
/// property pairs while subclasses provide additional functionality.
286
///
287
/// Subclasses can optionally implement "indexed storage". It is an efficient
288
/// mechanism for storing properties whose names are valid array indexes
289
/// according to ES5.1 sec 15.4. In other words, for storing arrays with an
290
/// uint32_t index. If "indexed storage" is available, Object will use it when
291
/// possible.
292
///
293
/// If indexed storage is available, but a numeric property with unusual flags
294
/// defined (e.g. non-enumerable, non-writable, etc), then the indexed storage
295
/// has to be "shadowed" by a named property. If at least one such property
296
/// exists, all indexed accesses must first check for a named property with the
297
/// same name. It comes with a significant cost, but fortunately such accesses
298
/// should be extremely rare.
299
///
300
/// All methods for accessing and manipulating properties are split into two
301
/// symmetrical groups: "named" and "computed".
302
///
303
/// Named accessors require a SymbolID as the property name and can *ONLY*
304
/// be used when either of these is true:
305
/// a) the string representation of the name is not a valid array index
306
///   according to ES5.1 sec 15.4.
307
/// b) the object does not have "indexed storage".
308
///
309
/// External users of the API cannot rely on b) so in practice "named" accessor
310
/// must be used only when the property name is known in advance (at compile
311
/// time) and is not an array index. Internally Object relies on b) to
312
/// delegate the work to the proper call.
313
///
314
/// Computed accessors allow any JavaScript value as the property name.
315
/// Conceptually the name is converted to a string (using ToString as defined
316
/// by the spec) and the string is used as a property key. In practice,
317
/// integer values are detected and used with the "indexed storage", if
318
/// available.
319
class JSObject : public GCCell {
320
  friend void JSObjectBuildMeta(const GCCell *cell, Metadata::Builder &mb);
321
322
 public:
323
  /// A light-weight constructor which performs no GC allocations. Its purpose
324
  /// to make sure all fields are initialized according to C++ without writing
325
  /// to them twice.
326
  template <typename NeedsBarriers>
327
  JSObject(
328
      Runtime &runtime,
329
      JSObject *parent,
330
      HiddenClass *clazz,
331
      NeedsBarriers needsBarriers)
332
435k
      : parent_(runtime, parent, runtime.getHeap(), needsBarriers),
333
435k
        clazz_(runtime, clazz, runtime.getHeap(), needsBarriers),
334
435k
        propStorage_(nullptr) {
335
    // Direct property slots are initialized by initDirectPropStorage.
336
435k
  }
hermes::vm::JSObject::JSObject<hermes::vm::GCPointerBase::NoBarriers>(hermes::vm::Runtime&, hermes::vm::JSObject*, hermes::vm::HiddenClass*, hermes::vm::GCPointerBase::NoBarriers)
Line
Count
Source
332
435k
      : parent_(runtime, parent, runtime.getHeap(), needsBarriers),
333
435k
        clazz_(runtime, clazz, runtime.getHeap(), needsBarriers),
334
435k
        propStorage_(nullptr) {
335
    // Direct property slots are initialized by initDirectPropStorage.
336
435k
  }
Unexecuted instantiation: hermes::vm::JSObject::JSObject<hermes::vm::GCPointerBase::YesBarriers>(hermes::vm::Runtime&, hermes::vm::JSObject*, hermes::vm::HiddenClass*, hermes::vm::GCPointerBase::YesBarriers)
337
338
  template <typename NeedsBarriers>
339
  JSObject(
340
      Runtime &runtime,
341
      Handle<JSObject> parent,
342
      Handle<HiddenClass> clazz,
343
      NeedsBarriers needsBarriers)
344
229k
      : parent_(runtime, *parent, runtime.getHeap(), needsBarriers),
345
229k
        clazz_(runtime, *clazz, runtime.getHeap(), needsBarriers),
346
229k
        propStorage_(nullptr) {
347
    // Direct property slots are initialized by initDirectPropStorage.
348
229k
  }
349
350
  /// Until we apply the NeedsBarriers pattern to all subtypes of JSObject, we
351
  /// will need versions that do not take the extra NeedsBarrier argument
352
  /// (defaulting to NoBarriers).
353
  JSObject(Runtime &runtime, JSObject *parent, HiddenClass *clazz)
354
185k
      : JSObject(runtime, parent, clazz, GCPointerBase::NoBarriers()) {
355
    // Direct property slots are initialized by initDirectPropStorage.
356
185k
  }
357
358
 public:
359
  // This exists so some inlined anonymous namespace methods in the
360
  // impl .cpp file can have private access to JSObject.  The natural
361
  // approach of making those methods private inline methods of
362
  // JSObject results in them not actually being inlined.  Measurement
363
  // has justified doing this.
364
  struct Helper;
365
366
  static const ObjectVTable vt;
367
368
  /// Default capacity of indirect property storage.
369
  static constexpr PropStorage::size_type DEFAULT_PROPERTY_CAPACITY = 4;
370
371
  /// Number of property slots used by the implementation that are named,
372
  /// meaning they are also visible to user code. Child classes should override
373
  /// this value by adding to it and defining a constant with the same name.
374
  static constexpr PropStorage::size_type NAMED_PROPERTY_SLOTS = 0;
375
376
  /// Number of property slots allocated directly inside the object.
377
  static constexpr PropStorage::size_type DIRECT_PROPERTY_SLOTS = 5;
378
379
458k
  static constexpr CellKind getCellKind() {
380
458k
    return CellKind::JSObjectKind;
381
458k
  }
382
6.19M
  static bool classof(const GCCell *cell) {
383
6.19M
    return kindInRange(
384
6.19M
        cell->getKind(), CellKind::ObjectKind_first, CellKind::ObjectKind_last);
385
6.19M
  }
386
387
  /// Attempts to allocate a JSObject with the given prototype.
388
  /// If allocation fails, the GC declares an OOM.
389
  static PseudoHandle<JSObject> create(
390
      Runtime &runtime,
391
      Handle<JSObject> parentHandle);
392
393
  /// Attempts to allocate a JSObject with the standard Object prototype.
394
  /// If allocation fails, the GC declares an OOM.
395
  static PseudoHandle<JSObject> create(Runtime &runtime);
396
397
  /// Attempts to allocate a JSObject with the standard Object prototype and
398
  /// property storage preallocated. If allocation fails, the GC declares an
399
  /// OOM.
400
  /// \param propertyCount number of property storage slots preallocated.
401
  static PseudoHandle<JSObject> create(
402
      Runtime &runtime,
403
      unsigned propertyCount);
404
405
  /// Allocates a JSObject with the given hidden class and property storage
406
  /// preallocated. If allocation fails, the GC declares an
407
  /// OOM.
408
  /// \param clazz the hidden class for the new object.
409
  static PseudoHandle<JSObject> create(
410
      Runtime &runtime,
411
      Handle<HiddenClass> clazz);
412
413
  /// Allocates a JSObject with the given hidden class and prototype.
414
  /// If allocation fails, the GC declares an OOM.
415
  static PseudoHandle<JSObject> create(
416
      Runtime &runtime,
417
      Handle<JSObject> parentHandle,
418
      Handle<HiddenClass> clazz);
419
420
  ~JSObject() = default;
421
422
  /// Must be called immediately after the construction of any JSObject.
423
  /// Asserts that the direct property storage is large enough to hold
424
  /// all internal properties, and initializes all non-overlapping
425
  /// direct property slots.
426
  /// \return a copy of self for convenience.
427
  template <typename T>
428
  static inline T *initDirectPropStorage(Runtime &runtime, T *self);
429
430
  /// ES9 9.1 O.[[Extensible]] internal slot
431
1.40M
  bool isExtensible() const {
432
1.40M
    return !flags_.noExtend;
433
1.40M
  }
434
435
  /// true if this a lazy object that must be initialized prior to use.
436
252k
  bool isLazy() const {
437
252k
    return flags_.lazyObject;
438
252k
  }
439
440
  /// \return true if this is a HostObject.
441
4.41k
  bool isHostObject() const {
442
4.41k
    return flags_.hostObject;
443
4.41k
  }
444
445
  /// \return true if this is a proxy exotic object.
446
259k
  bool isProxyObject() const {
447
259k
    return flags_.proxyObject;
448
259k
  }
449
450
  /// \return true if this object has fast indexed storage, meaning no property
451
  ///   checks need to be made when reading an indexed value.
452
0
  bool hasFastIndexProperties() const {
453
0
    return flags_.fastIndexProperties;
454
0
  }
455
456
  /// \return the `__proto__` internal property, which may be nullptr.
457
751k
  JSObject *getParent(Runtime &runtime) const {
458
751k
    return parent_.get(runtime);
459
751k
  }
460
461
  /// \return the hidden class of this object.
462
229k
  HiddenClass *getClass(PointerBase &base) const {
463
229k
    return clazz_.getNonNull(base);
464
229k
  }
465
466
  /// \return the hidden class of this object.
467
770k
  const GCPointer<HiddenClass> &getClassGCPtr() const {
468
770k
    return clazz_;
469
770k
  }
470
471
  /// \return the object ID. Assign one if not yet exist. This ID can be used
472
  /// in Set or Map where hashing is required. We don't assign object an ID
473
  /// until we actually need it. An exception is lazily created objects where
474
  /// the object id is the provided lazy object index which is used when the
475
  /// object gets initialized.
476
  static ObjectID getObjectID(JSObject *self, Runtime &runtime);
477
478
  static void initializeLazyObject(
479
      Runtime &runtime,
480
      Handle<JSObject> lazyObject);
481
482
  /// Get the objectID, which must already have been assigned using \c
483
  /// getObjectID().
484
0
  ObjectID getAlreadyAssignedObjectID() const {
485
0
    assert(flags_.objectID && "ObjectID hasn't been assigned yet");
486
0
    return flags_.objectID;
487
0
  }
488
489
  /// Whether the set of properties owned by this object is uniquely defined
490
  /// by the identity of its hidden class.
491
  inline bool shouldCacheForIn(Runtime &runtime) const;
492
493
  /// Sets the internal prototype property. This corresponds to ES9 9.1.2.1
494
  /// OrdinarySetPrototypeOf.
495
  /// - Does nothing if the value doesn't change.
496
  /// - Fails if the object isn't extensible
497
  /// - Fails if it detects a prototype cycle.
498
  /// If opFlags.getThrowOnError() is true, then this will throw an appropriate
499
  /// TypeError for the above failures.  If false, then it will just return
500
  /// false. If \c self is a Proxy with a trap, and the trap throws an
501
  /// exception, that exception will be propagated regardless.
502
  static CallResult<bool> setParent(
503
      JSObject *self,
504
      Runtime &runtime,
505
      JSObject *parent,
506
      PropOpFlags opFlags = PropOpFlags());
507
508
  /// Return the value of an internal property slot. Use getDirectSlotValue if
509
  /// \p index is known to be in a direct property slot at compile time.
510
  static SmallHermesValue
511
0
  getInternalProperty(JSObject *self, PointerBase &base, SlotIndex index) {
512
0
    assert(
513
0
        HiddenClass::debugIsPropertyDefined(
514
0
            self->clazz_.get(base),
515
0
            base,
516
0
            InternalProperty::getSymbolID(index)) &&
517
0
        "internal slot must be reserved");
518
0
    return getNamedSlotValueUnsafe<PropStorage::Inline::Yes>(self, base, index);
519
0
  }
520
521
  static void setInternalProperty(
522
      JSObject *self,
523
      Runtime &runtime,
524
      SlotIndex index,
525
0
      SmallHermesValue value) {
526
0
    assert(
527
0
        HiddenClass::debugIsPropertyDefined(
528
0
            self->clazz_.get(runtime),
529
0
            runtime,
530
0
            InternalProperty::getSymbolID(index)) &&
531
0
        "internal slot must be reserved");
532
0
    return setNamedSlotValueUnsafe<PropStorage::Inline::Yes>(
533
0
        self, runtime, index, value);
534
0
  }
535
536
  /// This is the proxy-aware version of getParent.  It has to
537
  /// allocate handles, so it's neither as simple or efficient as
538
  /// getParent, but it's needed.  If selfHandle has no parent, this
539
  /// will return a null JSObject (not a null value).
540
  static CallResult<PseudoHandle<JSObject>> getPrototypeOf(
541
      PseudoHandle<JSObject> selfHandle,
542
      Runtime &runtime);
543
544
  /// By default, returns a list of enumerable property names and symbols
545
  /// belonging to this object. Indexed property names will be represented as
546
  /// numbers for efficiency. The order of properties follows ES2015 - first
547
  /// properties whose string names look like indexes, in numeric order, then
548
  /// strings, in insertion order, then symbols, in insertion order.  \p
549
  /// okFlags can be used to exclude names and/or symbols, or include
550
  /// non-enumerable properties.
551
  /// \returns a JSArray containing the names.
552
  static CallResult<Handle<JSArray>> getOwnPropertyKeys(
553
      Handle<JSObject> selfHandle,
554
      Runtime &runtime,
555
      OwnKeysFlags okFlags);
556
557
  /// Return a list of property names belonging to this object. Indexed property
558
  /// names will be represented as numbers for efficiency. The order of
559
  /// properties follows ES2015 - first properties whose string names look like
560
  /// indexes, in numeric order, then the rest, in insertion order.
561
  /// \param onlyEnumerable if true, only enumerable properties will be
562
  ///   returned.
563
  /// \returns a JSArray containing the names.
564
  static CallResult<Handle<JSArray>> getOwnPropertyNames(
565
      Handle<JSObject> selfHandle,
566
      Runtime &runtime,
567
27
      bool onlyEnumerable) {
568
27
    return getOwnPropertyKeys(
569
27
        selfHandle,
570
27
        runtime,
571
27
        OwnKeysFlags().plusIncludeNonSymbols().setIncludeNonEnumerable(
572
27
            !onlyEnumerable));
573
27
  }
574
575
  /// Return a list of property symbols keys belonging to this object.
576
  /// The order of properties follows ES2015 - insertion order.
577
  /// \returns a JSArray containing the symbols.
578
  static CallResult<Handle<JSArray>> getOwnPropertySymbols(
579
      Handle<JSObject> selfHandle,
580
0
      Runtime &runtime) {
581
0
    return getOwnPropertyKeys(
582
0
        selfHandle,
583
0
        runtime,
584
0
        OwnKeysFlags().plusIncludeSymbols().plusIncludeNonEnumerable());
585
0
  }
586
587
  /// Load a value from the direct property storage space by \p index.
588
  /// \pre index < DIRECT_PROPERTY_SLOTS.
589
  template <SlotIndex index>
590
  inline static SmallHermesValue getDirectSlotValue(const JSObject *self);
591
592
  /// Store a value to the direct property storage space by \p index.
593
  /// \pre index < DIRECT_PROPERTY_SLOTS.
594
  template <SlotIndex index>
595
  inline static void
596
  setDirectSlotValue(JSObject *self, SmallHermesValue value, GC &gc);
597
598
  /// Load a value from the "named value" storage space by \p index.
599
  /// \pre inl == PropStorage::Inline::Yes -> index <
600
  /// PropStorage::kValueToSegmentThreshold.
601
  template <PropStorage::Inline inl = PropStorage::Inline::No>
602
  inline static SmallHermesValue getNamedSlotValueUnsafe(
603
      JSObject *self,
604
      PointerBase &runtime,
605
      SlotIndex index);
606
607
  /// Load a value from the "named value" storage space by the slot described by
608
  /// the property descriptor \p desc.
609
  /// NOTE: This should only be called on non-Proxy non-Host objects, when the
610
  /// caller has already verified those conditions. Otherwise, just use
611
  /// getNamedSlotValue.
612
  static SmallHermesValue getNamedSlotValueUnsafe(
613
      JSObject *self,
614
      PointerBase &runtime,
615
1.56M
      NamedPropertyDescriptor desc) {
616
1.56M
    assert(
617
1.56M
        !self->flags_.proxyObject && !desc.flags.proxyObject &&
618
1.56M
        "getNamedSlotValueUnsafe called on a Proxy");
619
1.56M
    assert(
620
1.56M
        !desc.flags.hostObject &&
621
1.56M
        "getNamedSlotValueUnsafe called on a HostObject");
622
1.56M
    return getNamedSlotValueUnsafe(self, runtime, desc.slot);
623
1.56M
  }
624
625
  /// Load a value from the "named value" storage space by the slot described by
626
  /// the property descriptor \p desc.
627
  static inline CallResult<PseudoHandle<>> getNamedSlotValue(
628
      PseudoHandle<JSObject> self,
629
      Runtime &runtime,
630
      NamedPropertyDescriptor desc);
631
632
  /// Load a value from the "named value" storage space by the slot described by
633
  /// the property descriptor \p desc.
634
  static inline CallResult<PseudoHandle<>> getNamedSlotValue(
635
      Handle<JSObject> self,
636
      Runtime &runtime,
637
      NamedPropertyDescriptor desc);
638
639
  /// Store a value to the "named value" storage space by the slot described by
640
  /// the property descriptor \p desc.
641
  /// The target descriptor may be a Proxy or HostObject.
642
  static inline CallResult<bool> setNamedSlotValue(
643
      PseudoHandle<JSObject> self,
644
      Runtime &runtime,
645
      NamedPropertyDescriptor desc,
646
      PseudoHandle<> value);
647
648
  /// Store a value to the "named value" storage space by \p index.
649
  /// \pre inl == PropStorage::Inline::Yes -> index <
650
  /// PropStorage::kValueToSegmentThreshold.
651
  template <PropStorage::Inline inl = PropStorage::Inline::No>
652
  static void setNamedSlotValueUnsafe(
653
      JSObject *self,
654
      Runtime &runtime,
655
      SlotIndex index,
656
      SmallHermesValue value);
657
658
  /// Store a value to the "named value" storage space by the slot described by
659
  /// \p desc.
660
  static void setNamedSlotValueUnsafe(
661
      JSObject *self,
662
      Runtime &runtime,
663
      NamedPropertyDescriptor desc,
664
306
      SmallHermesValue value) {
665
306
    assert(!desc.flags.proxyObject && "setNamedSlotValue called on a Proxy");
666
306
    assert(
667
306
        !desc.flags.hostObject && "setNamedSlotValue called on a HostObject");
668
306
    setNamedSlotValueUnsafe(self, runtime, desc.slot, value);
669
306
  }
670
671
  /// Load a value using a named descriptor. Read the value either from
672
  /// named storage or indexed storage depending on the presence of the
673
  /// "Indexed" flag. Call the getter function if it's defined.
674
  /// \param selfHandle the object we are loading the property from
675
  /// \param propObj the object where the property was found (it could be
676
  ///   anywhere along the prototype chain).
677
  /// \param desc the property descriptor.
678
  static CallResult<PseudoHandle<>> getNamedPropertyValue_RJS(
679
      Handle<JSObject> selfHandle,
680
      Runtime &runtime,
681
      Handle<JSObject> propObj,
682
      NamedPropertyDescriptor desc);
683
684
  /// Load a value using a computed descriptor. Read the value either from
685
  /// named storage or indexed storage depending on the presence of the
686
  /// "Indexed" flag. This does not call the getter, and can be used to
687
  /// retrieve the accessor directly.
688
  static CallResult<PseudoHandle<>> getComputedSlotValue(
689
      PseudoHandle<JSObject> self,
690
      Runtime &runtime,
691
      MutableHandle<SymbolID> &tmpSymbolStorage,
692
      ComputedPropertyDescriptor desc);
693
694
  /// Load a value using a computed descriptor. Read the value either from
695
  /// named storage or indexed storage depending on the presence of the
696
  /// "Indexed" flag. This does not call the getter, and can be used to
697
  /// retrieve the accessor directly.
698
  /// \pre The property must not be on a Proxy or HostObject.
699
  static HermesValue getComputedSlotValueUnsafe(
700
      PseudoHandle<JSObject> self,
701
      Runtime &runtime,
702
      ComputedPropertyDescriptor desc);
703
704
  /// Store a value using a computed descriptor. Store the value either to
705
  /// named storage or indexed storage depending on the presence of the
706
  /// "Indexed" flag. This does not call the setter, and can be used to
707
  /// set the accessor directly.  The \p gc parameter is necessary for write
708
  /// barriers.
709
  LLVM_NODISCARD static CallResult<bool> setComputedSlotValue(
710
      Handle<JSObject> selfHandle,
711
      Runtime &runtime,
712
      MutableHandle<SymbolID> &tmpSymbolStorage,
713
      ComputedPropertyDescriptor desc,
714
      Handle<> value);
715
716
  /// Store a value using a computed descriptor. Store the value either to
717
  /// named storage or indexed storage depending on the presence of the
718
  /// "Indexed" flag. This does not call the setter, and can be used to
719
  /// set the accessor directly.  The \p gc parameter is necessary for write
720
  /// barriers.
721
  /// \pre The property must not be on a Proxy or HostObject.
722
  LLVM_NODISCARD static ExecutionStatus setComputedSlotValueUnsafe(
723
      Handle<JSObject> selfHandle,
724
      Runtime &runtime,
725
      ComputedPropertyDescriptor desc,
726
      Handle<> value);
727
728
  /// Load a value using a computed descriptor. Read the value either from
729
  /// named storage or indexed storage depending on the presence of the
730
  /// "Indexed" flag. Call the getter function if it's defined. If
731
  /// selfHandle is a proxy, this asserts.
732
  /// \param selfHandle the object we are loading the property from
733
  /// \param propObj the object where the property was found (it could be
734
  ///   anywhere along the prototype chain).
735
  /// \param desc the property descriptor.
736
  /// \pre The property must not be on a Proxy or HostObject.
737
  static CallResult<PseudoHandle<>> getComputedPropertyValueInternal_RJS(
738
      Handle<JSObject> selfHandle,
739
      Runtime &runtime,
740
      Handle<JSObject> propObj,
741
      ComputedPropertyDescriptor desc);
742
743
  /// This adds some functionality to the other overload.  If propObj
744
  /// normal object, this behaves just like the other overload.  This
745
  /// is safe to use with proxies: if the desc has the proxyObject
746
  /// flag set, then \c nameValHandle is used to call the proxy has
747
  /// trap.  If the has trap returns false, then this returns an empty
748
  /// HermesValue, otherwise, the get trap is called (also using \c
749
  /// nameValHandle) and its result is returned.
750
  static CallResult<PseudoHandle<>> getComputedPropertyValue_RJS(
751
      Handle<JSObject> selfHandle,
752
      Runtime &runtime,
753
      Handle<JSObject> propObj,
754
      MutableHandle<SymbolID> &tmpSymbolStorage,
755
      ComputedPropertyDescriptor desc,
756
      Handle<> nameValHandle);
757
758
  /// ES5.1 8.12.1.
759
  /// Extract a descriptor \p desc of an own named property \p name.
760
  /// This will return false if the object is a proxy.
761
  static bool getOwnNamedDescriptor(
762
      Handle<JSObject> selfHandle,
763
      Runtime &runtime,
764
      SymbolID name,
765
      NamedPropertyDescriptor &desc);
766
767
  /// ES5.1 8.12.1.
768
  /// An opportunistic fast path of \c getOwnNamedDescriptor(). If certain
769
  /// implementation-dependent conditions are met, it can look up a property
770
  /// quickly and succeed. If it fails, the "slow path" - \c
771
  /// getOwnNamedDescriptor() must be used.
772
  /// \return true or false if a definitive answer can be provided, llvh::None
773
  /// if the result is unknown.
774
  static OptValue<bool> tryGetOwnNamedDescriptorFast(
775
      JSObject *self,
776
      Runtime &runtime,
777
      SymbolID name,
778
      NamedPropertyDescriptor &desc);
779
780
  /// Tries to get a property without doing any allocation, while searching the
781
  /// prototype chain.
782
  /// If the property cannot be found on this object or any of its prototypes,
783
  /// or if this object's HiddenClass has an uninitialized property map, returns
784
  /// \p llvh::None.
785
  static OptValue<SmallHermesValue>
786
  tryGetNamedNoAlloc(JSObject *self, PointerBase &base, SymbolID name);
787
788
  /// Parameter to getOwnComputedPrimitiveDescriptor
789
  enum class IgnoreProxy { No, Yes };
790
791
  /// ES5.1 8.12.1.
792
  /// \param nameValHandle the name of the property. It must be a primitive.
793
  /// If selfHandle refers to a proxy and \p ignoreProxy is Yes, desc
794
  /// will be untouched and false will be returned.  If selfHandle refers to a
795
  /// proxy, and \p ignoreProxy is No, then if [[GetOwnProperty]] on the
796
  /// proxy is undefined, then false will be returned, otherwise, desc will be
797
  /// filled in with the result, and true will be returned.  If selfHandle is
798
  /// not a proxy, then the flag is irrelevant.
799
  static CallResult<bool> getOwnComputedPrimitiveDescriptor(
800
      Handle<JSObject> selfHandle,
801
      Runtime &runtime,
802
      Handle<> nameValHandle,
803
      IgnoreProxy ignoreProxy,
804
      MutableHandle<SymbolID> &tmpSymbolStorage,
805
      ComputedPropertyDescriptor &desc);
806
807
  /// Provides the functionality of ES9 [[GetOwnProperty]] on selfHandle.  It
808
  /// calls getOwnComputedPrimitiveDescriptor() in the case when \p
809
  /// nameValHandle may be an object.  We will need to call toString() on the
810
  /// object first before we invoke getOwnComputedPrimitiveDescriptor(), to
811
  /// ensure the side-effect only happens once.  If selfHandle is a proxy, this
812
  /// will fill \p desc with the descriptor as specified in ES9 9.5.5, and
813
  /// return true if the descriptor is defined.
814
  static CallResult<bool> getOwnComputedDescriptor(
815
      Handle<JSObject> selfHandle,
816
      Runtime &runtime,
817
      Handle<> nameValHandle,
818
      MutableHandle<SymbolID> &tmpSymbolStorage,
819
      ComputedPropertyDescriptor &desc);
820
821
  /// Like the other overload, except valueOrAccessor will be set to a value or
822
  /// PropertyAccessor corresponding to \p desc.flags.
823
  static CallResult<bool> getOwnComputedDescriptor(
824
      Handle<JSObject> selfHandle,
825
      Runtime &runtime,
826
      Handle<> nameValHandle,
827
      MutableHandle<SymbolID> &tmpSymbolStorage,
828
      ComputedPropertyDescriptor &desc,
829
      MutableHandle<> &valueOrAccessor);
830
831
  /// ES5.1 8.12.2.
832
  /// Extract a descriptor \p desc of a predefined property \p name
833
  /// in this object or along the prototype chain.
834
  /// \return the object instance containing the property, or nullptr.
835
  static JSObject *getNamedDescriptorPredefined(
836
      Handle<JSObject> selfHandle,
837
      Runtime &runtime,
838
      Predefined::Str name,
839
      NamedPropertyDescriptor &desc);
840
841
  /// ES5.1 8.12.2.
842
  /// Extract a descriptor \p desc of a predefined symbol \p name
843
  /// in this object or along the prototype chain.
844
  /// \return the object instance containing the property, or nullptr.
845
  static JSObject *getNamedDescriptorPredefined(
846
      Handle<JSObject> selfHandle,
847
      Runtime &runtime,
848
      Predefined::Sym name,
849
      NamedPropertyDescriptor &desc);
850
851
  /// ES5.1 8.12.2.
852
  /// Extract a descriptor \p desc of a named property \p name in this object
853
  /// or along the prototype chain.
854
  /// IMPORTANT: This is unsafe because the caller must ensure \p name will NOT
855
  /// be freed within the lifetime of \p desc - typically by ensuring \p name
856
  /// is stored in the string table of the bytecode.
857
  /// \param expectedFlags if valid, we are searching for a property which, if
858
  ///   not found, we would create with these specific flags. This can speed
859
  ///   up the search in the negative case - when the property doesn't exist.
860
  /// \return the object instance containing the property, or nullptr.
861
  static JSObject *getNamedDescriptorUnsafe(
862
      Handle<JSObject> selfHandle,
863
      Runtime &runtime,
864
      SymbolID name,
865
      PropertyFlags expectedFlags,
866
      NamedPropertyDescriptor &desc);
867
868
  /// ES5.1 8.12.2.
869
  /// Wrapper around \c getNamedDescriptorUnsafe() passing \c false to \c
870
  /// forPutNamed.
871
  static JSObject *getNamedDescriptorUnsafe(
872
      Handle<JSObject> selfHandle,
873
      Runtime &runtime,
874
      SymbolID name,
875
      NamedPropertyDescriptor &desc);
876
877
  /// ES5.1 8.12.2.
878
  /// Extract a descriptor \p desc of a named property \p name in this object
879
  /// or along the prototype chain.
880
  /// \param nameValHandle the name of the property. It must be a primitive.
881
  /// \param tmpSymbolStorage a temporary handle sometimes used internally
882
  ///    to store SymbolIDs in order to make sure they aren't collected.
883
  ///    Must not be modified or read by the caller for the lifetime of \p desc,
884
  ///    the function makes no guarantees regarding whether it is used.
885
  /// \param[out] propObj it is set to the object in the prototype chain
886
  ///   containing the property, or \c null if we didn't find the property.
887
  /// \param[out] desc if the property was found, set to the property
888
  ///   descriptor.
889
  static ExecutionStatus getComputedPrimitiveDescriptor(
890
      Handle<JSObject> selfHandle,
891
      Runtime &runtime,
892
      Handle<> nameValHandle,
893
      MutableHandle<JSObject> &propObj,
894
      MutableHandle<SymbolID> &tmpSymbolStorage,
895
      ComputedPropertyDescriptor &desc);
896
897
  /// A wrapper to getComputedPrimitiveDescriptor() in the case when
898
  /// \p nameValHandle may be an object, in which case we need to call
899
  /// \c toString() before we  invoke getComputedPrimitiveDescriptor(), to
900
  /// ensure the side-effect only happens once.
901
  /// The values of the output parameters are not defined if the call terminates
902
  /// with an exception.
903
  /// \param nameValHandle the name of the property.
904
  /// \param tmpSymbolStorage a temporary handle sometimes used internally
905
  ///    to store SymbolIDs in order to make sure they aren't collected.
906
  ///    Must not be modified or read by the caller for the lifetime of \p desc,
907
  ///    the function makes no guarantees regarding whether it is used.
908
  /// \param[out] propObj if the method terminates without an exception, it is
909
  ///    set to the object in the prototype chain containing the property, or
910
  ///    \c null if we didn't find the property.
911
  /// \param[out] desc if the property was found, set to the property
912
  ///   descriptor.
913
  static ExecutionStatus getComputedDescriptor(
914
      Handle<JSObject> selfHandle,
915
      Runtime &runtime,
916
      Handle<> nameValHandle,
917
      MutableHandle<JSObject> &propObj,
918
      MutableHandle<SymbolID> &tmpSymbolStorage,
919
      ComputedPropertyDescriptor &desc);
920
921
  /// The following three methods implement ES5.1 8.12.3.
922
  /// getNamed is an optimized path for getting a property with a SymbolID when
923
  /// it is statically known that the SymbolID is not index-like.
924
  /// If \p cacheEntry is not null, and the result is suitable for use in a
925
  /// property cache, populate the cache.
926
  static CallResult<PseudoHandle<>> getNamed_RJS(
927
      Handle<JSObject> selfHandle,
928
      Runtime &runtime,
929
      SymbolID name,
930
      PropOpFlags opFlags = PropOpFlags(),
931
      PropertyCacheEntry *cacheEntry = nullptr);
932
933
  /// Like getNamed, but with a \c receiver.  The receiver is
934
  /// generally only relevant when JavaScript code is executed.  If an
935
  /// accessor is used, \c receiver is used as the \c this for the
936
  /// function call.  If a proxy trap is called, \c receiver is passed
937
  /// to the trap function.  Normally, \c receiver is the same as \c
938
  /// selfHandle, but it can be different when using \c Reflect.
939
  static CallResult<PseudoHandle<>> getNamedWithReceiver_RJS(
940
      Handle<JSObject> selfHandle,
941
      Runtime &runtime,
942
      SymbolID name,
943
      Handle<> receiver,
944
      PropOpFlags opFlags = PropOpFlags(),
945
      PropertyCacheEntry *cacheEntry = nullptr);
946
947
  // getNamedOrIndexed accesses a property with a SymbolIDs which may be
948
  // index-like.
949
  static CallResult<PseudoHandle<>> getNamedOrIndexed(
950
      Handle<JSObject> selfHandle,
951
      Runtime &runtime,
952
      SymbolID name,
953
      PropOpFlags opFlags = PropOpFlags());
954
955
  /// getComputed accesses a property with an arbitrary object key, implementing
956
  /// ES5.1 8.12.3 in full generality.
957
  static CallResult<PseudoHandle<>> getComputed_RJS(
958
      Handle<JSObject> selfHandle,
959
      Runtime &runtime,
960
      Handle<> nameValHandle);
961
962
  /// getComputed accesses a property with an arbitrary object key and
963
  /// receiver value.
964
  static CallResult<PseudoHandle<>> getComputedWithReceiver_RJS(
965
      Handle<JSObject> selfHandle,
966
      Runtime &runtime,
967
      Handle<> nameValHandle,
968
      Handle<> receiver);
969
970
  /// The following three methods implement ES5.1 8.12.6
971
  /// hasNamed is an optimized path for checking existence of a property
972
  /// for SymbolID when it is statically known that the SymbolIDs is not
973
  /// index-like.
974
  static CallResult<bool>
975
  hasNamed(Handle<JSObject> selfHandle, Runtime &runtime, SymbolID name);
976
977
  /// hasNamedOrIndexed checks existence of a property for a SymbolID which may
978
  /// be index-like.
979
  static CallResult<bool> hasNamedOrIndexed(
980
      Handle<JSObject> selfHandle,
981
      Runtime &runtime,
982
      SymbolID name);
983
984
  /// hasComputed checks existence of a property for arbitrary object key
985
  static CallResult<bool> hasComputed(
986
      Handle<JSObject> selfHandle,
987
      Runtime &runtime,
988
      Handle<> nameValHandle);
989
990
  /// The following five methods implement ES5.1 8.12.5.
991
  /// putNamed is an optimized path for setting a property with a SymbolID when
992
  /// it is statically known that the SymbolID is not index-like.
993
  static CallResult<bool> putNamed_RJS(
994
      Handle<JSObject> selfHandle,
995
      Runtime &runtime,
996
      SymbolID name,
997
      Handle<> valueHandle,
998
      PropOpFlags opFlags = PropOpFlags());
999
1000
  /// like putNamed, but with a receiver
1001
  static CallResult<bool> putNamedWithReceiver_RJS(
1002
      Handle<JSObject> selfHandle,
1003
      Runtime &runtime,
1004
      SymbolID name,
1005
      Handle<> valueHandle,
1006
      Handle<> receiver,
1007
      PropOpFlags opFlags = PropOpFlags());
1008
1009
  /// putNamedOrIndexed sets a property with a SymbolID which may be index-like.
1010
  static CallResult<bool> putNamedOrIndexed(
1011
      Handle<JSObject> selfHandle,
1012
      Runtime &runtime,
1013
      SymbolID name,
1014
      Handle<> valueHandle,
1015
      PropOpFlags opFlags = PropOpFlags());
1016
1017
  /// putComputed sets a property with an arbitrary object key.
1018
  static CallResult<bool> putComputed_RJS(
1019
      Handle<JSObject> selfHandle,
1020
      Runtime &runtime,
1021
      Handle<> nameValHandle,
1022
      Handle<> valueHandle,
1023
      PropOpFlags opFlags = PropOpFlags());
1024
1025
  /// putComputed sets a property with an arbitrary object key and receiver
1026
  /// value
1027
  static CallResult<bool> putComputedWithReceiver_RJS(
1028
      Handle<JSObject> selfHandle,
1029
      Runtime &runtime,
1030
      Handle<> nameValHandle,
1031
      Handle<> valueHandle,
1032
      Handle<> receiver,
1033
      PropOpFlags opFlags = PropOpFlags());
1034
1035
  /// ES5.1 8.12.7.
1036
  static CallResult<bool> deleteNamed(
1037
      Handle<JSObject> selfHandle,
1038
      Runtime &runtime,
1039
      SymbolID name,
1040
      PropOpFlags opFlags = PropOpFlags());
1041
  /// ES5.1 8.12.7.
1042
  static CallResult<bool> deleteComputed(
1043
      Handle<JSObject> selfHandle,
1044
      Runtime &runtime,
1045
      Handle<> nameValHandle,
1046
      PropOpFlags opFlags = PropOpFlags());
1047
1048
  /// Calls ObjectVTable::getOwnIndexed.
1049
  static HermesValue
1050
0
  getOwnIndexed(PseudoHandle<JSObject> self, Runtime &runtime, uint32_t index) {
1051
0
    const auto *vtable = self->getVT();
1052
0
    return vtable->getOwnIndexed(std::move(self), runtime, index);
1053
0
  }
1054
1055
  /// Calls ObjectVTable::setOwnIndexed.
1056
  static CallResult<bool> setOwnIndexed(
1057
      Handle<JSObject> selfHandle,
1058
      Runtime &runtime,
1059
      uint32_t index,
1060
469k
      Handle<> value) {
1061
469k
    return selfHandle->getVT()->setOwnIndexed(
1062
469k
        selfHandle, runtime, index, value);
1063
469k
  }
1064
1065
  /// Calls ObjectVTable::deleteOwnIndexed.
1066
  static bool deleteOwnIndexed(
1067
      Handle<JSObject> selfHandle,
1068
      Runtime &runtime,
1069
0
      uint32_t index) {
1070
0
    return selfHandle->getVT()->deleteOwnIndexed(selfHandle, runtime, index);
1071
0
  }
1072
1073
  /// Calls ObjectVTable::checkAllOwnIndexed.
1074
  static bool checkAllOwnIndexed(
1075
      JSObject *self,
1076
      Runtime &runtime,
1077
0
      ObjectVTable::CheckAllOwnIndexedMode mode) {
1078
0
    return self->getVT()->checkAllOwnIndexed(self, runtime, mode);
1079
0
  }
1080
1081
  /// Define a new property or update an existing one following the rules
1082
  /// described in ES5.1 8.12.9.
1083
  /// \param dpFlags flags which in conjuction with the rules of ES5.1 8.12.9
1084
  ///   describing how the property flags of an existing property should be
1085
  ///   updated or the flags of a new property should be initialized.
1086
  /// \param valueOrAccessor the value of the new property. If the property is
1087
  ///   an accessor, it should be an instance of \c PropertyAccessor.
1088
  /// \param opFlags flags modifying the behavior in case of error.
1089
  /// \return \c true on success. In case of failure it returns an exception
1090
  ///   or false, depending on the value of \c opFlags.ThrowOnError.
1091
  /// Note: This can throw even if ThrowOnError is false,
1092
  /// because ThrowOnError is only for specific kinds of errors,
1093
  /// and this function will not swallow other kinds of errors.
1094
  /// \pre Cannot call this function with a name that looks like a valid array
1095
  ///   index. Call \c defineOwnComputedPrimitive instead.
1096
  static CallResult<bool> defineOwnProperty(
1097
      Handle<JSObject> selfHandle,
1098
      Runtime &runtime,
1099
      SymbolID name,
1100
      DefinePropertyFlags dpFlags,
1101
      Handle<> valueOrAccessor,
1102
510k
      PropOpFlags opFlags = PropOpFlags()) {
1103
510k
#ifdef HERMES_SLOW_DEBUG
1104
    // In slow debug, check if the symbol looks like an array index. If that's
1105
    // the case, it should be using defineOwnComputed instead.
1106
510k
    auto nameView = runtime.getIdentifierTable().getStringView(runtime, name);
1107
510k
    assert(
1108
510k
        !toArrayIndex(nameView) &&
1109
510k
        "Array index property should use defineOwnComputed instead");
1110
510k
#endif
1111
510k
    return defineOwnPropertyInternal(
1112
510k
        selfHandle, runtime, name, dpFlags, valueOrAccessor, opFlags);
1113
510k
  }
1114
1115
  /// Same as \c defineOwnProperty, except the name can be a valid array index.
1116
  /// Prefer \c defineOwnProperty and \c defineOwnComputedPrimitive instead.
1117
  static CallResult<bool> defineOwnPropertyInternal(
1118
      Handle<JSObject> selfHandle,
1119
      Runtime &runtime,
1120
      SymbolID name,
1121
      DefinePropertyFlags dpFlags,
1122
      Handle<> valueOrAccessor,
1123
      PropOpFlags opFlags = PropOpFlags());
1124
1125
  /// Define a new property, which must not already exist in this object.
1126
  /// This is similar in intent to ES5.1 \c defineOwnProperty(), but is simpler
1127
  /// and faster since it doesn't support updating of properties. It doesn't
1128
  /// need to search for an existing property and it doesn't need the
1129
  /// complicated set of rules in ES5.1 8.12.9 describing how to synthesize or
1130
  /// update \c PropertyFlags based on instructions in \c DefinedPropertyFlags.
1131
  ///
1132
  /// It is frequently possible to use this method when defining properties of
1133
  /// an object that the caller created since in that case the caller has full
1134
  /// control over the properties in the object (and the prototype chain
1135
  /// doesn't matter).
1136
  /// Don't call this function if you know the \p name is index-like, and the
1137
  /// \p selfHandle has indexedStorage, or it'll lose its fast indexed property.
1138
  ///
1139
  /// \param propertyFlags the actual, final, value of \c PropertyFlags that
1140
  ///   will be stored in the property descriptor.
1141
  /// \param valueOrAccessor the value of the new property.
1142
  LLVM_NODISCARD static ExecutionStatus defineNewOwnProperty(
1143
      Handle<JSObject> selfHandle,
1144
      Runtime &runtime,
1145
      SymbolID name,
1146
      PropertyFlags propertyFlags,
1147
      Handle<> valueOrAccessor);
1148
1149
  /// ES5.1 8.12.9.
1150
  /// \param nameValHandle the name of the property. It must be a primitive.
1151
  static CallResult<bool> defineOwnComputedPrimitive(
1152
      Handle<JSObject> selfHandle,
1153
      Runtime &runtime,
1154
      Handle<> nameValHandle,
1155
      DefinePropertyFlags dpFlags,
1156
      Handle<> valueOrAccessor,
1157
      PropOpFlags opFlags = PropOpFlags());
1158
1159
  /// ES5.1 8.12.9.
1160
  /// A wrapper to \c defineOwnComputedPrimitive() in case \p nameValHandle is
1161
  /// an object.
1162
  /// We will need to call toString() on the object first before we invoke
1163
  /// \c defineOwnComputedPrimitive(), to ensure the side-effect only happens
1164
  /// once.
1165
  static CallResult<bool> defineOwnComputed(
1166
      Handle<JSObject> selfHandle,
1167
      Runtime &runtime,
1168
      Handle<> nameValHandle,
1169
      DefinePropertyFlags dpFlags,
1170
      Handle<> valueOrAccessor,
1171
      PropOpFlags opFlags = PropOpFlags());
1172
1173
  /// ES5.1 15.2.3.8.
1174
  /// Make all own properties non-configurable.
1175
  /// Set [[Extensible]] to false.
1176
  static ExecutionStatus seal(Handle<JSObject> selfHandle, Runtime &runtime);
1177
  /// ES5.1 15.2.3.9.
1178
  /// Make all own properties non-configurable.
1179
  /// Make all own data properties (not accessors) non-writable.
1180
  /// Set [[Extensible]] to false.
1181
  static ExecutionStatus freeze(Handle<JSObject> selfHandle, Runtime &runtime);
1182
  /// ES5.1 15.2.3.10.
1183
  /// Set [[Extensible]] slot on an ordinary object to false, preventing adding
1184
  /// more properties.
1185
  static void preventExtensions(JSObject *self);
1186
  /// ES9 [[PreventExtensons]] internal method.  This works on Proxy
1187
  /// objects and ordinary objects. If opFlags.getThrowOnError() is
1188
  /// true, then this will throw an appropriate TypeError if the
1189
  /// method would have returned false.
1190
  static CallResult<bool> preventExtensions(
1191
      Handle<JSObject> selfHandle,
1192
      Runtime &runtime,
1193
      PropOpFlags opFlags = PropOpFlags());
1194
1195
  /// ES9 9.1.3 [[IsExtensible]] internal method
1196
  /// No properties are can be added.  This also handles the Proxy case.
1197
  static CallResult<bool> isExtensible(
1198
      PseudoHandle<JSObject> self,
1199
      Runtime &runtime);
1200
  /// ES5.1 15.2.3.11.
1201
  /// No properties are configurable.
1202
  /// [[Extensible]] is false.
1203
  static bool isSealed(PseudoHandle<JSObject> self, Runtime &runtime);
1204
  /// ES5.1 15.2.3.12.
1205
  /// No properties are configurable.
1206
  /// No data properties (not accessors) are writable.
1207
  /// [[Extensible]] is false.
1208
  static bool isFrozen(PseudoHandle<JSObject> self, Runtime &runtime);
1209
1210
  /// Update the property flags in the list \p props on \p selfHandle,
1211
  /// with provided \p flagsToClear and \p flagsToSet, and if it is not
1212
  /// provided, update all properties.
1213
  /// This method is efficient in updating multiple properties than updating
1214
  /// them one by one because it creates at most one hidden class and mutates
1215
  /// that hidden class without creating new transitions under the hood.
1216
  /// \p flagsToClear and \p flagsToSet are masks for updating the property
1217
  /// flags.
1218
  /// \p props is a list of SymbolIDs for properties that need to be
1219
  /// updated. It should contain a subset of properties in the object, so
1220
  /// the SymbolIDs won't get freed by gc. It is optional; if it is llvh::None,
1221
  /// update every property.
1222
  static void updatePropertyFlagsWithoutTransitions(
1223
      Handle<JSObject> selfHandle,
1224
      Runtime &runtime,
1225
      PropertyFlags flagsToClear,
1226
      PropertyFlags flagsToSet,
1227
      OptValue<llvh::ArrayRef<SymbolID>> props);
1228
1229
  /// First call \p indexedCB, passing each indexed property's \c uint32_t
1230
  /// index and \c ComputedPropertyDescriptor. Then call \p namedCB passing each
1231
  /// named property's \c SymbolID and \c  NamedPropertyDescriptor as
1232
  /// parameters.
1233
  /// The callbacks return true to continue or false to stop immediately.
1234
  ///
1235
  /// Obviously the callbacks shouldn't be doing naughty things like modifying
1236
  /// the property map or creating new hidden classes (even implicitly).
1237
  ///
1238
  /// A marker for the current gcScope is obtained in the beginning and the
1239
  /// scope is flushed after every callback.
1240
  /// \return false if the callback returned false, true otherwise.
1241
  template <typename IndexedCB, typename NamedCB>
1242
  static bool forEachOwnPropertyWhile(
1243
      Handle<JSObject> selfHandle,
1244
      Runtime &runtime,
1245
      const IndexedCB &indexedCB,
1246
      const NamedCB &namedCB);
1247
1248
#ifdef HERMES_MEMORY_INSTRUMENTATION
1249
  /// Return the type name of this object, if it can be found heuristically.
1250
  /// There is no one definitive type name for an object. If no heuristic is
1251
  /// able to produce a name, the empty string is returned.
1252
  std::string getHeuristicTypeName(GC &gc);
1253
#endif
1254
1255
  /// Accesses the name property on an object, returns the empty string if it
1256
  /// doesn't exist or isn't a string.
1257
  std::string getNameIfExists(PointerBase &base);
1258
1259
 protected:
1260
  /// @name Virtual function implementations
1261
  /// @{
1262
1263
#ifdef HERMES_MEMORY_INSTRUMENTATION
1264
  /// Add an estimate of the type name for this object as the name in heap
1265
  /// snapshots.
1266
  static std::string _snapshotNameImpl(GCCell *cell, GC &gc);
1267
1268
  /// Add user-visible property names to a snapshot.
1269
  static void _snapshotAddEdgesImpl(GCCell *cell, GC &gc, HeapSnapshot &snap);
1270
1271
  /// Add the location of the constructor for this object to the heap snapshot.
1272
  static void
1273
  _snapshotAddLocationsImpl(GCCell *cell, GC &gc, HeapSnapshot &snap);
1274
#endif
1275
1276
  /// \return the range of indexes (end-exclusive) stored in indexed storage.
1277
  static std::pair<uint32_t, uint32_t> _getOwnIndexedRangeImpl(
1278
      JSObject *self,
1279
      Runtime &runtime);
1280
1281
  /// Check whether property with index \p index exists in indexed storage and
1282
  /// \return true if it does.
1283
  static bool
1284
  _haveOwnIndexedImpl(JSObject *self, Runtime &runtime, uint32_t index);
1285
1286
  /// Check whether property with index \p index exists in indexed storage and
1287
  /// extract its \c PropertyFlags (if necessary checking whether the object is
1288
  /// frozen or sealed).
1289
  /// \return PropertyFlags if the property exists.
1290
  static OptValue<PropertyFlags> _getOwnIndexedPropertyFlagsImpl(
1291
      JSObject *self,
1292
      Runtime &runtime,
1293
      uint32_t index);
1294
1295
  /// Obtain an element from the "indexed storage" of this object. The storage
1296
  /// itself is implementation dependent.
1297
  /// \return the value of the element or "empty" if there is no such element.
1298
  static HermesValue _getOwnIndexedImpl(
1299
      PseudoHandle<JSObject> self,
1300
      Runtime &runtime,
1301
      uint32_t index);
1302
1303
  /// Set an element in the "indexed storage" of this object. Depending on the
1304
  /// semantics of the "indexed storage" the storage capacity may need to be
1305
  /// expanded (e.g. affecting Array.length), or the write may simply be ignored
1306
  /// (in the case of typed arrays).
1307
  /// \return true if the write succeeded, or false if it was ignored.
1308
  static CallResult<bool> _setOwnIndexedImpl(
1309
      Handle<JSObject> selfHandle,
1310
      Runtime &runtime,
1311
      uint32_t index,
1312
      Handle<> value);
1313
1314
  /// Delete an element in the "indexed storage".
1315
  /// \return 'true' if the element was successfully deleted, or if it was
1316
  ///     outside of the storage range. 'false' if this storage doesn't support
1317
  ///     "holes"/deletion (e.g. typed arrays).
1318
  static bool _deleteOwnIndexedImpl(
1319
      Handle<JSObject> selfHandle,
1320
      Runtime &runtime,
1321
      uint32_t index);
1322
1323
  /// Check whether all indexed properties satisfy the requirement specified by
1324
  /// \p mode. Either whether they are all non-configurable, or whether they are
1325
  /// all both non-configurable and non-writable.
1326
  static bool _checkAllOwnIndexedImpl(
1327
      JSObject *self,
1328
      Runtime &runtime,
1329
      ObjectVTable::CheckAllOwnIndexedMode mode);
1330
1331
  /// Allocate an instance of property storage with the specified size.
1332
  static inline ExecutionStatus allocatePropStorage(
1333
      Handle<JSObject> selfHandle,
1334
      Runtime &runtime,
1335
      PropStorage::size_type size);
1336
1337
  /// Allocate an instance of property storage with the specified size.
1338
  /// If an allocation is required, a handle is allocated internally and the
1339
  /// updated self value is returned. This means that the return value MUST
1340
  /// be used by the caller.
1341
  static inline CallResult<PseudoHandle<JSObject>> allocatePropStorage(
1342
      PseudoHandle<JSObject> self,
1343
      Runtime &runtime,
1344
      PropStorage::size_type size);
1345
1346
  /// @}
1347
1348
 private:
1349
  // Internal API
1350
1351
2.42M
  const ObjectVTable *getVT() const {
1352
2.42M
    return static_cast<const ObjectVTable *>(GCCell::getVT());
1353
2.42M
  }
1354
1355
  /// Allocate storage for a new slot after the slot index itself has been
1356
  /// allocated by the hidden class.
1357
  /// Note that slot storage is never truly released once allocated. Released
1358
  /// storage slots are put into a free list.
1359
  static void allocateNewSlotStorage(
1360
      Handle<JSObject> selfHandle,
1361
      Runtime &runtime,
1362
      SlotIndex newSlotIndex,
1363
      Handle<> valueHandle);
1364
1365
  /// Look for a property and return a \c PropertyPos identifying it and store
1366
  /// its descriptor in \p desc.
1367
  /// \param expectedFlags if valid, we are searching for a property which, if
1368
  ///   not found, we would create with these specific flags. This can speed
1369
  ///   up the search in the negative case - when the property doesn't exist.
1370
  static OptValue<HiddenClass::PropertyPos> findProperty(
1371
      Handle<JSObject> selfHandle,
1372
      Runtime &runtime,
1373
      SymbolID name,
1374
      PropertyFlags expectedFlags,
1375
      NamedPropertyDescriptor &desc);
1376
1377
  /// Look for a property and return a \c PropertyPos identifying it and store
1378
  /// its descriptor in \p desc.
1379
  static OptValue<HiddenClass::PropertyPos> findProperty(
1380
      Handle<JSObject> selfHandle,
1381
      Runtime &runtime,
1382
      SymbolID name,
1383
      NamedPropertyDescriptor &desc);
1384
1385
  /// ES5.1 8.12.9.
1386
  static CallResult<bool> addOwnProperty(
1387
      Handle<JSObject> selfHandle,
1388
      Runtime &runtime,
1389
      SymbolID name,
1390
      DefinePropertyFlags dpFlags,
1391
      Handle<> valueOrAccessor,
1392
      PropOpFlags opFlags);
1393
  /// Performs the actual adding of the property for \c addOwnProperty()
1394
  static ExecutionStatus addOwnPropertyImpl(
1395
      Handle<JSObject> selfHandle,
1396
      Runtime &runtime,
1397
      SymbolID name,
1398
      PropertyFlags propertyFlags,
1399
      Handle<> valueOrAccessor);
1400
1401
  /// ES5.1 8.12.9.
1402
  static CallResult<bool> updateOwnProperty(
1403
      Handle<JSObject> selfHandle,
1404
      Runtime &runtime,
1405
      SymbolID name,
1406
      HiddenClass::PropertyPos propertyPos,
1407
      NamedPropertyDescriptor desc,
1408
      DefinePropertyFlags dpFlags,
1409
      Handle<> valueOrAccessor,
1410
      PropOpFlags opFlags);
1411
1412
  /// The result of \c checkPropertyUpdate.
1413
  enum class PropertyUpdateStatus {
1414
    /// The property cannot be updated.
1415
    failed,
1416
    /// The update only required changing the property flags, which was done.
1417
    done,
1418
    /// The update is valid: the property flags were changed but the property
1419
    /// value needs to be set by the caller.
1420
    needSet
1421
  };
1422
1423
  /// Check whether a property can be updated based on the rules in
1424
  /// ES5.1 8.12.9. If the update is valid, return the updated property flags
1425
  /// and a value indicating whether the property value needs to be set as well.
1426
  /// If the update cannot be performed, the call will either raise an exception
1427
  /// or return failure, depending on \c PropOpFlags.throwOnError.
1428
  ///
1429
  /// \param currentFlags the current property flags.
1430
  /// \param curValueOrAccessor the current value of the property.
1431
  /// \return a pair of the updated property flags and a status, where the
1432
  ///   status is one of:
1433
  ///   * \c PropertyUpdateStatus::failed if the update cannot be performed.
1434
  ///   * \c PropertyUpdateStatus::done if the update only required changing the
1435
  //      property flags.
1436
  ///   * \c PropertyUpdateStatus::needSet if the update is valid and the value
1437
  ///     of the property must now be set by the caller.
1438
  static CallResult<std::pair<PropertyUpdateStatus, PropertyFlags>>
1439
  checkPropertyUpdate(
1440
      Runtime &runtime,
1441
      PropertyFlags currentFlags,
1442
      DefinePropertyFlags dpFlags,
1443
      HermesValue curValueOrAccessor,
1444
      Handle<> valueOrAccessor,
1445
      PropOpFlags opFlags);
1446
1447
  /// Calls ObjectVTable::getOwnIndexedRange.
1448
  static std::pair<uint32_t, uint32_t> getOwnIndexedRange(
1449
      JSObject *self,
1450
      Runtime &runtime);
1451
1452
  /// Calls ObjectVTable::haveOwnIndexed.
1453
  static bool haveOwnIndexed(JSObject *self, Runtime &runtime, uint32_t index);
1454
1455
  /// Calls ObjectVTable::getOwnIndexedPropertyFlags.
1456
  static OptValue<PropertyFlags>
1457
  getOwnIndexedPropertyFlags(JSObject *self, Runtime &runtime, uint32_t index);
1458
1459
  /// A handler called when a data descriptor has the \c internalSetter flag
1460
  /// set. It is invoked instead of updating the actual property value. The
1461
  /// handler can update the property value by calling \c setNamedSlotValue() if
1462
  /// it didn't manipulate the property storage.
1463
  /// \returns a result logically equivalent to the result of \c putNamed().
1464
  static CallResult<bool> internalSetter(
1465
      Handle<JSObject> selfHandle,
1466
      Runtime &runtime,
1467
      SymbolID name,
1468
      NamedPropertyDescriptor desc,
1469
      Handle<> value,
1470
      PropOpFlags opFlags);
1471
1472
 protected:
1473
  /// Flags affecting the entire object.
1474
  ObjectFlags flags_{};
1475
1476
  /// The prototype of this object.
1477
  GCPointer<JSObject> parent_;
1478
1479
  /// The dynamically derived "class" of the object, describing its fields in
1480
  /// order.
1481
  GCPointer<HiddenClass> clazz_{};
1482
1483
  /// Storage for property values.
1484
  GCPointer<PropStorage> propStorage_{};
1485
1486
  /// Storage for direct property slots.
1487
  inline GCSmallHermesValue *directProps();
1488
  inline const GCSmallHermesValue *directProps() const;
1489
1490
 private:
1491
  /// Byte offset to the first direct property slot in a JSObject.
1492
  static inline constexpr size_t directPropsOffset();
1493
1494
  /// The allocation size needed for a plain JSObject instance (including its
1495
  /// direct property slots).
1496
  static inline constexpr size_t cellSizeJSObject();
1497
1498
 public:
1499
  // Implementation of cellSize. Do not use this directly.
1500
  template <class C>
1501
664k
  static constexpr uint32_t cellSizeImpl() {
1502
664k
    static_assert(
1503
664k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
664k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
664k
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::NativeConstructor>()
Line
Count
Source
1501
4.74k
  static constexpr uint32_t cellSizeImpl() {
1502
4.74k
    static_assert(
1503
4.74k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
4.74k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
4.74k
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::BoundFunction>()
Line
Count
Source
1501
113
  static constexpr uint32_t cellSizeImpl() {
1502
113
    static_assert(
1503
113
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
113
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
113
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::NativeFunction>()
Line
Count
Source
1501
49.8k
  static constexpr uint32_t cellSizeImpl() {
1502
49.8k
    static_assert(
1503
49.8k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
49.8k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
49.8k
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSFunction>()
Line
Count
Source
1501
4.41k
  static constexpr uint32_t cellSizeImpl() {
1502
4.41k
    static_assert(
1503
4.41k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
4.41k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
4.41k
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSAsyncFunction>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSGeneratorFunction>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::GeneratorInnerFunction>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::RequireContext>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::Arguments>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSArray>()
Line
Count
Source
1501
249k
  static constexpr uint32_t cellSizeImpl() {
1502
249k
    static_assert(
1503
249k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
249k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
249k
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSArrayIterator>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSArrayBuffer>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSDataView>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSDate>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSError>()
Line
Count
Source
1501
41
  static constexpr uint32_t cellSizeImpl() {
1502
41
    static_assert(
1503
41
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
41
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
41
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSGenerator>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSObject>()
Line
Count
Source
1501
229k
  static constexpr uint32_t cellSizeImpl() {
1502
229k
    static_assert(
1503
229k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
229k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
229k
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSProxy>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSRegExp>()
Line
Count
Source
1501
964
  static constexpr uint32_t cellSizeImpl() {
1502
964
    static_assert(
1503
964
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
964
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
964
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSMapImpl<(hermes::vm::CellKind)47> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSMapImpl<(hermes::vm::CellKind)48> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSWeakRef>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::DecoratedObject>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::FinalizableNativeFunction>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::HostObject>()
Line
Count
Source
1501
113
  static constexpr uint32_t cellSizeImpl() {
1502
113
    static_assert(
1503
113
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
113
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
113
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSString>()
Line
Count
Source
1501
124
  static constexpr uint32_t cellSizeImpl() {
1502
124
    static_assert(
1503
124
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
124
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
124
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSStringIterator>()
Line
Count
Source
1501
2
  static constexpr uint32_t cellSizeImpl() {
1502
2
    static_assert(
1503
2
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
2
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
2
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSBigInt>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSNumber>()
Line
Count
Source
1501
124k
  static constexpr uint32_t cellSizeImpl() {
1502
124k
    static_assert(
1503
124k
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
124k
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
124k
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSBoolean>()
Line
Count
Source
1501
113
  static constexpr uint32_t cellSizeImpl() {
1502
113
    static_assert(
1503
113
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
113
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
113
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSSymbol>()
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::SingleObject<(hermes::vm::CellKind)60> >()
Line
Count
Source
1501
113
  static constexpr uint32_t cellSizeImpl() {
1502
113
    static_assert(
1503
113
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
113
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
113
  }
unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::SingleObject<(hermes::vm::CellKind)59> >()
Line
Count
Source
1501
113
  static constexpr uint32_t cellSizeImpl() {
1502
113
    static_assert(
1503
113
        std::is_convertible<C *, JSObject *>::value, "must be a JSObject");
1504
113
    return sizeof(C) < cellSizeJSObject() ? cellSizeJSObject() : sizeof(C);
1505
113
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSCallSite>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSCallableProxy>()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::cellSizeImpl<hermes::vm::JSRegExpStringIterator>()
1506
1507
  /// The number of direct property slots that are unused due to overlap with
1508
  /// C++ fields in the class Derived.
1509
  ///
1510
  /// Example layouts ([0-3] = direct props, [A-Z] = other fields):
1511
  ///   JSObject: ABCD0123
1512
  ///   Derived0: ABCDEF23  (2 overlap slots)
1513
  ///   Derived1: ABCDEFGHI (4 overlap slots)
1514
  template <typename Derived>
1515
1.32M
  static constexpr unsigned numOverlapSlots() {
1516
1.32M
    static_assert(
1517
1.32M
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1.32M
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1.32M
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1.32M
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1.32M
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::NativeFunction>()
Line
Count
Source
1515
99.6k
  static constexpr unsigned numOverlapSlots() {
1516
99.6k
    static_assert(
1517
99.6k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
99.6k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
99.6k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
99.6k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
99.6k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::NativeConstructor>()
Line
Count
Source
1515
9.49k
  static constexpr unsigned numOverlapSlots() {
1516
9.49k
    static_assert(
1517
9.49k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
9.49k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
9.49k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
9.49k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
9.49k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::DecoratedObject>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSArray>()
Line
Count
Source
1515
500k
  static constexpr unsigned numOverlapSlots() {
1516
500k
    static_assert(
1517
500k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
500k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
500k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
500k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
500k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::Callable>()
Line
Count
Source
1515
9
  static constexpr unsigned numOverlapSlots() {
1516
9
    static_assert(
1517
9
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
9
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
9
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
9
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
9
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::BoundFunction>()
Line
Count
Source
1515
227
  static constexpr unsigned numOverlapSlots() {
1516
227
    static_assert(
1517
227
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
227
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
227
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
227
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
227
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSFunction>()
Line
Count
Source
1515
8.82k
  static constexpr unsigned numOverlapSlots() {
1516
8.82k
    static_assert(
1517
8.82k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
8.82k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
8.82k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
8.82k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
8.82k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSAsyncFunction>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSGeneratorFunction>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::GeneratorInnerFunction>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::RequireContext>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSObject>()
Line
Count
Source
1515
458k
  static constexpr unsigned numOverlapSlots() {
1516
458k
    static_assert(
1517
458k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
458k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
458k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
458k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
458k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::ArrayImpl>()
Line
Count
Source
1515
2
  static constexpr unsigned numOverlapSlots() {
1516
2
    static_assert(
1517
2
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
2
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
2
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
2
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
2
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::Arguments>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSArrayIterator>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSArrayBuffer>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSDataView>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSDate>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSError>()
Line
Count
Source
1515
83
  static constexpr unsigned numOverlapSlots() {
1516
83
    static_assert(
1517
83
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
83
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
83
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
83
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
83
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSGenerator>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSProxy>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSRegExp>()
Line
Count
Source
1515
1.92k
  static constexpr unsigned numOverlapSlots() {
1516
1.92k
    static_assert(
1517
1.92k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1.92k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1.92k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1.92k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1.92k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSMapImpl<(hermes::vm::CellKind)47> >()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSMapImpl<(hermes::vm::CellKind)48> >()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50> >()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49> >()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44> >()
Unexecuted instantiation: unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45> >()
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSTypedArrayBase>()
Line
Count
Source
1515
11
  static constexpr unsigned numOverlapSlots() {
1516
11
    static_assert(
1517
11
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
11
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
11
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
11
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
11
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51> >()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52> >()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSWeakMapImplBase>()
Line
Count
Source
1515
2
  static constexpr unsigned numOverlapSlots() {
1516
2
    static_assert(
1517
2
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
2
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
2
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
2
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
2
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSWeakRef>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::FinalizableNativeFunction>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::HostObject>()
Line
Count
Source
1515
227
  static constexpr unsigned numOverlapSlots() {
1516
227
    static_assert(
1517
227
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
227
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
227
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
227
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
227
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSString>()
Line
Count
Source
1515
249
  static constexpr unsigned numOverlapSlots() {
1516
249
    static_assert(
1517
249
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
249
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
249
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
249
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
249
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSStringIterator>()
Line
Count
Source
1515
5
  static constexpr unsigned numOverlapSlots() {
1516
5
    static_assert(
1517
5
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
5
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
5
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
5
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
5
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSBigInt>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSNumber>()
Line
Count
Source
1515
249k
  static constexpr unsigned numOverlapSlots() {
1516
249k
    static_assert(
1517
249k
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
249k
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
249k
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
249k
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
249k
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSBoolean>()
Line
Count
Source
1515
227
  static constexpr unsigned numOverlapSlots() {
1516
227
    static_assert(
1517
227
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
227
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
227
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
227
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
227
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSSymbol>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::SingleObject<(hermes::vm::CellKind)60> >()
Line
Count
Source
1515
227
  static constexpr unsigned numOverlapSlots() {
1516
227
    static_assert(
1517
227
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
227
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
227
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
227
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
227
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::SingleObject<(hermes::vm::CellKind)59> >()
Line
Count
Source
1515
227
  static constexpr unsigned numOverlapSlots() {
1516
227
    static_assert(
1517
227
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
227
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
227
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
227
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
227
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSCallSite>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSCallableProxy>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
unsigned int hermes::vm::JSObject::numOverlapSlots<hermes::vm::JSRegExpStringIterator>()
Line
Count
Source
1515
1
  static constexpr unsigned numOverlapSlots() {
1516
1
    static_assert(
1517
1
        std::is_convertible<Derived *, JSObject *>::value, "must be subclass");
1518
1
    auto aligned = llvh::alignTo<sizeof(GCSmallHermesValue)>(sizeof(Derived));
1519
1
    auto excess = (aligned - directPropsOffset()) / sizeof(GCSmallHermesValue);
1520
1
    return std::min<size_t>(excess, DIRECT_PROPERTY_SLOTS);
1521
1
  }
1522
};
1523
1524
/// Convenience class for accessing the direct property slots of a JSObject.
1525
class JSObjectAndDirectProps : public JSObject {
1526
 public:
1527
  GCSmallHermesValue directProps_[DIRECT_PROPERTY_SLOTS];
1528
};
1529
1530
3.71M
GCSmallHermesValue *JSObject::directProps() {
1531
3.71M
  return static_cast<JSObjectAndDirectProps *>(this)->directProps_;
1532
3.71M
}
1533
1534
1.15M
const GCSmallHermesValue *JSObject::directProps() const {
1535
1.15M
  return static_cast<const JSObjectAndDirectProps *>(this)->directProps_;
1536
1.15M
}
1537
1538
1.32M
constexpr size_t JSObject::directPropsOffset() {
1539
1.32M
  return llvh::alignTo<alignof(GCSmallHermesValue)>(sizeof(JSObject));
1540
1.32M
}
1541
1542
604k
constexpr size_t JSObject::cellSizeJSObject() {
1543
604k
  static_assert(
1544
604k
      sizeof(JSObjectAndDirectProps) ==
1545
604k
          directPropsOffset() +
1546
604k
              sizeof(GCSmallHermesValue) * DIRECT_PROPERTY_SLOTS,
1547
604k
      "unexpected padding");
1548
604k
  static_assert(
1549
604k
      heapAlignSize(sizeof(JSObjectAndDirectProps)) ==
1550
604k
          sizeof(JSObjectAndDirectProps),
1551
604k
      "Wasted direct slot due to alignment");
1552
604k
  return sizeof(JSObjectAndDirectProps);
1553
604k
}
1554
1555
/// \return an array that contains all enumerable properties of obj (including
1556
/// those of its prototype etc.) at the indices [beginIndex, endIndex) (any
1557
/// other part of the array is implementation-defined).
1558
/// \param[out] beginIndex beginning of the range of indices storing names
1559
/// \param[out] endIndex end (exclusive) of the range of indices storing names
1560
CallResult<Handle<BigStorage>> getForInPropertyNames(
1561
    Runtime &runtime,
1562
    Handle<JSObject> obj,
1563
    uint32_t &beginIndex,
1564
    uint32_t &endIndex);
1565
1566
/// Helper functions for initialising any kind of JSObject. Ensures direct
1567
/// property slots are initialized. Should be used in a placement new expression
1568
/// or with GC::makeA, whose result is passed through one of the init* methods:
1569
///
1570
///   MyObjectType *obj = runtime.makeAFixed<MyObjectType>();
1571
///   return JSObjectInit::initToHandle(runtime, obj);
1572
///
1573
namespace JSObjectInit {
1574
/// Initialize direct properties of obj and return it in a handle.
1575
template <typename JSObjectType>
1576
299k
static Handle<JSObjectType> initToHandle(Runtime &runtime, JSObjectType *obj) {
1577
  // Check that the object looks well-formed.
1578
299k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1579
299k
  return runtime.makeHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1580
299k
}
Callable.cpp:hermes::vm::Handle<hermes::vm::BoundFunction> hermes::vm::JSObjectInit::initToHandle<hermes::vm::BoundFunction>(hermes::vm::Runtime&, hermes::vm::BoundFunction*)
Line
Count
Source
1576
113
static Handle<JSObjectType> initToHandle(Runtime &runtime, JSObjectType *obj) {
1577
  // Check that the object looks well-formed.
1578
113
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1579
113
  return runtime.makeHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1580
113
}
Callable.cpp:hermes::vm::Handle<hermes::vm::NativeFunction> hermes::vm::JSObjectInit::initToHandle<hermes::vm::NativeFunction>(hermes::vm::Runtime&, hermes::vm::NativeFunction*)
Line
Count
Source
1576
49.8k
static Handle<JSObjectType> initToHandle(Runtime &runtime, JSObjectType *obj) {
1577
  // Check that the object looks well-formed.
1578
49.8k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1579
49.8k
  return runtime.makeHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1580
49.8k
}
Unexecuted instantiation: Callable.cpp:hermes::vm::Handle<hermes::vm::GeneratorInnerFunction> hermes::vm::JSObjectInit::initToHandle<hermes::vm::GeneratorInnerFunction>(hermes::vm::Runtime&, hermes::vm::GeneratorInnerFunction*)
Unexecuted instantiation: Domain.cpp:hermes::vm::Handle<hermes::vm::RequireContext> hermes::vm::JSObjectInit::initToHandle<hermes::vm::RequireContext>(hermes::vm::Runtime&, hermes::vm::RequireContext*)
Unexecuted instantiation: JSArray.cpp:hermes::vm::Handle<hermes::vm::Arguments> hermes::vm::JSObjectInit::initToHandle<hermes::vm::Arguments>(hermes::vm::Runtime&, hermes::vm::Arguments*)
JSArray.cpp:hermes::vm::Handle<hermes::vm::JSArray> hermes::vm::JSObjectInit::initToHandle<hermes::vm::JSArray>(hermes::vm::Runtime&, hermes::vm::JSArray*)
Line
Count
Source
1576
249k
static Handle<JSObjectType> initToHandle(Runtime &runtime, JSObjectType *obj) {
1577
  // Check that the object looks well-formed.
1578
249k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1579
249k
  return runtime.makeHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1580
249k
}
Unexecuted instantiation: HostModel.cpp:hermes::vm::Handle<hermes::vm::FinalizableNativeFunction> hermes::vm::JSObjectInit::initToHandle<hermes::vm::FinalizableNativeFunction>(hermes::vm::Runtime&, hermes::vm::FinalizableNativeFunction*)
PrimitiveBox.cpp:hermes::vm::Handle<hermes::vm::JSString> hermes::vm::JSObjectInit::initToHandle<hermes::vm::JSString>(hermes::vm::Runtime&, hermes::vm::JSString*)
Line
Count
Source
1576
124
static Handle<JSObjectType> initToHandle(Runtime &runtime, JSObjectType *obj) {
1577
  // Check that the object looks well-formed.
1578
124
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1579
124
  return runtime.makeHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1580
124
}
Unexecuted instantiation: PrimitiveBox.cpp:hermes::vm::Handle<hermes::vm::JSBigInt> hermes::vm::JSObjectInit::initToHandle<hermes::vm::JSBigInt>(hermes::vm::Runtime&, hermes::vm::JSBigInt*)
1581
1582
/// Initialize direct properties of obj and return it in a pseudo-handle.
1583
template <typename JSObjectType>
1584
static PseudoHandle<JSObjectType> initToPseudoHandle(
1585
    Runtime &runtime,
1586
364k
    JSObjectType *obj) {
1587
364k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
364k
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
364k
}
Unexecuted instantiation: hermes.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Callable.cpp:hermes::vm::PseudoHandle<hermes::vm::JSFunction> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSFunction>(hermes::vm::Runtime&, hermes::vm::JSFunction*)
Line
Count
Source
1586
4.41k
    JSObjectType *obj) {
1587
4.41k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
4.41k
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
4.41k
}
Unexecuted instantiation: Callable.cpp:hermes::vm::PseudoHandle<hermes::vm::JSAsyncFunction> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSAsyncFunction>(hermes::vm::Runtime&, hermes::vm::JSAsyncFunction*)
Unexecuted instantiation: Callable.cpp:hermes::vm::PseudoHandle<hermes::vm::JSGeneratorFunction> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSGeneratorFunction>(hermes::vm::Runtime&, hermes::vm::JSGeneratorFunction*)
Unexecuted instantiation: Callable.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Domain.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Interpreter.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Interpreter-slowpaths.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSArrayIterator> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSArrayIterator>(hermes::vm::Runtime&, hermes::vm::JSArrayIterator*)
Unexecuted instantiation: JSArray.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSArrayBuffer.cpp:hermes::vm::PseudoHandle<hermes::vm::JSArrayBuffer> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSArrayBuffer>(hermes::vm::Runtime&, hermes::vm::JSArrayBuffer*)
Unexecuted instantiation: JSDataView.cpp:hermes::vm::PseudoHandle<hermes::vm::JSDataView> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSDataView>(hermes::vm::Runtime&, hermes::vm::JSDataView*)
Unexecuted instantiation: JSDate.cpp:hermes::vm::PseudoHandle<hermes::vm::JSDate> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSDate>(hermes::vm::Runtime&, hermes::vm::JSDate*)
JSError.cpp:hermes::vm::PseudoHandle<hermes::vm::JSError> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSError>(hermes::vm::Runtime&, hermes::vm::JSError*)
Line
Count
Source
1586
41
    JSObjectType *obj) {
1587
41
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
41
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
41
}
Unexecuted instantiation: JSError.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSGenerator.cpp:hermes::vm::PseudoHandle<hermes::vm::JSGenerator> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSGenerator>(hermes::vm::Runtime&, hermes::vm::JSGenerator*)
Unexecuted instantiation: JSGenerator.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
JSObject.cpp:hermes::vm::PseudoHandle<hermes::vm::JSObject> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSObject>(hermes::vm::Runtime&, hermes::vm::JSObject*)
Line
Count
Source
1586
229k
    JSObjectType *obj) {
1587
229k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
229k
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
229k
}
Unexecuted instantiation: JSObject.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSProxy.cpp:hermes::vm::PseudoHandle<hermes::vm::JSProxy> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSProxy>(hermes::vm::Runtime&, hermes::vm::JSProxy*)
Unexecuted instantiation: JSProxy.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
JSRegExp.cpp:hermes::vm::PseudoHandle<hermes::vm::JSRegExp> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSRegExp>(hermes::vm::Runtime&, hermes::vm::JSRegExp*)
Line
Count
Source
1586
964
    JSObjectType *obj) {
1587
964
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
964
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
964
}
Unexecuted instantiation: JSMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::JSMapImpl<(hermes::vm::CellKind)47> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSMapImpl<(hermes::vm::CellKind)47> >(hermes::vm::Runtime&, hermes::vm::JSMapImpl<(hermes::vm::CellKind)47>*)
Unexecuted instantiation: JSMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::JSMapImpl<(hermes::vm::CellKind)48> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSMapImpl<(hermes::vm::CellKind)48> >(hermes::vm::Runtime&, hermes::vm::JSMapImpl<(hermes::vm::CellKind)48>*)
Unexecuted instantiation: JSMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50> >(hermes::vm::Runtime&, hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50>*)
Unexecuted instantiation: JSMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49> >(hermes::vm::Runtime&, hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49>*)
Unexecuted instantiation: JSMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSNativeFunctions.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45>*)
Unexecuted instantiation: JSTypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSWeakMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51> >(hermes::vm::Runtime&, hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51>*)
Unexecuted instantiation: JSWeakMapImpl.cpp:hermes::vm::PseudoHandle<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52> > hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52> >(hermes::vm::Runtime&, hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52>*)
Unexecuted instantiation: JSWeakRef.cpp:hermes::vm::PseudoHandle<hermes::vm::JSWeakRef> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSWeakRef>(hermes::vm::Runtime&, hermes::vm::JSWeakRef*)
Unexecuted instantiation: DecoratedObject.cpp:hermes::vm::PseudoHandle<hermes::vm::DecoratedObject> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::DecoratedObject>(hermes::vm::Runtime&, hermes::vm::DecoratedObject*)
Unexecuted instantiation: HostModel.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Operations.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
PrimitiveBox.cpp:hermes::vm::PseudoHandle<hermes::vm::JSStringIterator> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSStringIterator>(hermes::vm::Runtime&, hermes::vm::JSStringIterator*)
Line
Count
Source
1586
2
    JSObjectType *obj) {
1587
2
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
2
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
2
}
PrimitiveBox.cpp:hermes::vm::PseudoHandle<hermes::vm::JSNumber> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSNumber>(hermes::vm::Runtime&, hermes::vm::JSNumber*)
Line
Count
Source
1586
124k
    JSObjectType *obj) {
1587
124k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
124k
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
124k
}
PrimitiveBox.cpp:hermes::vm::PseudoHandle<hermes::vm::JSBoolean> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSBoolean>(hermes::vm::Runtime&, hermes::vm::JSBoolean*)
Line
Count
Source
1586
113
    JSObjectType *obj) {
1587
113
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
113
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
113
}
Unexecuted instantiation: PrimitiveBox.cpp:hermes::vm::PseudoHandle<hermes::vm::JSSymbol> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSSymbol>(hermes::vm::Runtime&, hermes::vm::JSSymbol*)
Unexecuted instantiation: PropertyAccessor.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Runtime.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: CodeCoverageProfiler.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: SamplingProfiler.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: SamplingProfilerPosix.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: SamplingProfilerSampler.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: StackTracesTree.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Array.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: ArrayBuffer.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: ArrayIterator.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
AsyncFunction.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Line
Count
Source
1586
4.74k
    JSObjectType *obj) {
1587
4.74k
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1588
4.74k
  return createPseudoHandle(JSObjectType::initDirectPropStorage(runtime, obj));
1589
4.74k
}
Unexecuted instantiation: Base64.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: BigInt.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: CallSite.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: DataView.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: TypedArray.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Error.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: GeneratorFunction.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: GeneratorPrototype.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: GlobalObject.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: IteratorPrototype.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: HermesInternal.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: HermesBuiltin.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSLibInternal.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Map.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Math.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSON.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: RuntimeJSONUtils.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Object.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Proxy.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Reflect.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Set.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: String.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: StringIterator.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Function.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Number.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Boolean.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: RegExp.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: RegExpStringIterator.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Symbol.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Date.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: WeakMap.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: WeakRef.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: WeakSet.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: print.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: eval.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: escape.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: require.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: TextEncoder.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: Debugger.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: DebuggerInternal.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSCallSite.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSCallableProxy.cpp:hermes::vm::PseudoHandle<hermes::vm::JSCallableProxy> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSCallableProxy>(hermes::vm::Runtime&, hermes::vm::JSCallableProxy*)
Unexecuted instantiation: JSCallableProxy.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: JSRegExpStringIterator.cpp:hermes::vm::PseudoHandle<hermes::vm::JSRegExpStringIterator> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::JSRegExpStringIterator>(hermes::vm::Runtime&, hermes::vm::JSRegExpStringIterator*)
Unexecuted instantiation: JSRegExpStringIterator.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: ChromeTraceSerializer.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Unexecuted instantiation: ProfileGenerator.cpp:hermes::vm::PseudoHandle<hermes::vm::NativeConstructor> hermes::vm::JSObjectInit::initToPseudoHandle<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
1590
1591
/// Initialize direct properties of obj and return it as a raw HermesValue.
1592
template <typename JSObjectType>
1593
339
static HermesValue initToHermesValue(Runtime &runtime, JSObjectType *obj) {
1594
339
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1595
339
  return HermesValue::encodeObjectValue(
1596
339
      JSObjectType::initDirectPropStorage(runtime, obj));
1597
339
}
HostModel.cpp:hermes::vm::HermesValue hermes::vm::JSObjectInit::initToHermesValue<hermes::vm::HostObject>(hermes::vm::Runtime&, hermes::vm::HostObject*)
Line
Count
Source
1593
113
static HermesValue initToHermesValue(Runtime &runtime, JSObjectType *obj) {
1594
113
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1595
113
  return HermesValue::encodeObjectValue(
1596
113
      JSObjectType::initDirectPropStorage(runtime, obj));
1597
113
}
Math.cpp:hermes::vm::HermesValue hermes::vm::JSObjectInit::initToHermesValue<hermes::vm::SingleObject<(hermes::vm::CellKind)60> >(hermes::vm::Runtime&, hermes::vm::SingleObject<(hermes::vm::CellKind)60>*)
Line
Count
Source
1593
113
static HermesValue initToHermesValue(Runtime &runtime, JSObjectType *obj) {
1594
113
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1595
113
  return HermesValue::encodeObjectValue(
1596
113
      JSObjectType::initDirectPropStorage(runtime, obj));
1597
113
}
JSON.cpp:hermes::vm::HermesValue hermes::vm::JSObjectInit::initToHermesValue<hermes::vm::SingleObject<(hermes::vm::CellKind)59> >(hermes::vm::Runtime&, hermes::vm::SingleObject<(hermes::vm::CellKind)59>*)
Line
Count
Source
1593
113
static HermesValue initToHermesValue(Runtime &runtime, JSObjectType *obj) {
1594
113
  assert(JSObjectType::classof(obj) && "Mismatched CellKind");
1595
113
  return HermesValue::encodeObjectValue(
1596
113
      JSObjectType::initDirectPropStorage(runtime, obj));
1597
113
}
Unexecuted instantiation: JSCallSite.cpp:hermes::vm::HermesValue hermes::vm::JSObjectInit::initToHermesValue<hermes::vm::JSCallSite>(hermes::vm::Runtime&, hermes::vm::JSCallSite*)
1598
}; // namespace JSObjectInit
1599
1600
//===----------------------------------------------------------------------===//
1601
// Object inline methods.
1602
1603
template <typename IndexedCB, typename NamedCB>
1604
bool JSObject::forEachOwnPropertyWhile(
1605
    Handle<JSObject> selfHandle,
1606
    Runtime &runtime,
1607
    const IndexedCB &indexedCB,
1608
0
    const NamedCB &namedCB) {
1609
0
  auto range = getOwnIndexedRange(*selfHandle, runtime);
1610
0
  GCScopeMarkerRAII gcMarker{runtime};
1611
0
  for (auto i = range.first; i != range.second; ++i) {
1612
0
    auto optPF = getOwnIndexedPropertyFlags(*selfHandle, runtime, i);
1613
0
    if (!optPF)
1614
0
      continue;
1615
0
    ComputedPropertyDescriptor desc{*optPF, i};
1616
0
    desc.flags.indexed = true;
1617
0
    if (!indexedCB(runtime, i, desc))
1618
0
      return false;
1619
0
    gcMarker.flush();
1620
0
  }
1621
1622
0
  return HiddenClass::forEachPropertyWhile(
1623
0
      runtime.makeHandle(selfHandle->clazz_), runtime, namedCB);
1624
0
}
1625
1626
inline ExecutionStatus JSObject::allocatePropStorage(
1627
    Handle<JSObject> selfHandle,
1628
    Runtime &runtime,
1629
49.8k
    PropStorage::size_type size) {
1630
49.8k
  if (LLVM_LIKELY(size <= DIRECT_PROPERTY_SLOTS))
1631
49.8k
    return ExecutionStatus::RETURNED;
1632
1633
0
  auto res = PropStorage::create(
1634
0
      runtime, size - DIRECT_PROPERTY_SLOTS, size - DIRECT_PROPERTY_SLOTS);
1635
0
  if (LLVM_UNLIKELY(res == ExecutionStatus::EXCEPTION))
1636
0
    return ExecutionStatus::EXCEPTION;
1637
1638
0
  selfHandle->propStorage_.setNonNull(
1639
0
      runtime, vmcast<PropStorage>(*res), runtime.getHeap());
1640
0
  return ExecutionStatus::RETURNED;
1641
0
}
1642
1643
inline CallResult<PseudoHandle<JSObject>> JSObject::allocatePropStorage(
1644
    PseudoHandle<JSObject> self,
1645
    Runtime &runtime,
1646
0
    PropStorage::size_type size) {
1647
0
  if (LLVM_LIKELY(size <= DIRECT_PROPERTY_SLOTS))
1648
0
    return self;
1649
1650
0
  Handle<JSObject> selfHandle = runtime.makeHandle(std::move(self));
1651
0
  if (LLVM_UNLIKELY(
1652
0
          allocatePropStorage(selfHandle, runtime, size) ==
1653
0
          ExecutionStatus::EXCEPTION)) {
1654
0
    return ExecutionStatus::EXCEPTION;
1655
0
  }
1656
1657
0
  return PseudoHandle<JSObject>{selfHandle};
1658
0
}
1659
1660
template <typename T>
1661
664k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
664k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
664k
  static_assert(
1664
664k
      count <= DIRECT_PROPERTY_SLOTS,
1665
664k
      "smallPropStorage size must fit in direct properties");
1666
664k
  GCSmallHermesValue::uninitialized_fill(
1667
664k
      self->directProps() + numOverlapSlots<T>(),
1668
664k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
664k
      SmallHermesValue::encodeUndefinedValue(),
1670
664k
      runtime.getHeap());
1671
664k
  return self;
1672
664k
}
hermes::vm::NativeConstructor* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::NativeConstructor>(hermes::vm::Runtime&, hermes::vm::NativeConstructor*)
Line
Count
Source
1661
4.74k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
4.74k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
4.74k
  static_assert(
1664
4.74k
      count <= DIRECT_PROPERTY_SLOTS,
1665
4.74k
      "smallPropStorage size must fit in direct properties");
1666
4.74k
  GCSmallHermesValue::uninitialized_fill(
1667
4.74k
      self->directProps() + numOverlapSlots<T>(),
1668
4.74k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
4.74k
      SmallHermesValue::encodeUndefinedValue(),
1670
4.74k
      runtime.getHeap());
1671
4.74k
  return self;
1672
4.74k
}
hermes::vm::BoundFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::BoundFunction>(hermes::vm::Runtime&, hermes::vm::BoundFunction*)
Line
Count
Source
1661
113
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
113
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
113
  static_assert(
1664
113
      count <= DIRECT_PROPERTY_SLOTS,
1665
113
      "smallPropStorage size must fit in direct properties");
1666
113
  GCSmallHermesValue::uninitialized_fill(
1667
113
      self->directProps() + numOverlapSlots<T>(),
1668
113
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
113
      SmallHermesValue::encodeUndefinedValue(),
1670
113
      runtime.getHeap());
1671
113
  return self;
1672
113
}
hermes::vm::NativeFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::NativeFunction>(hermes::vm::Runtime&, hermes::vm::NativeFunction*)
Line
Count
Source
1661
49.8k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
49.8k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
49.8k
  static_assert(
1664
49.8k
      count <= DIRECT_PROPERTY_SLOTS,
1665
49.8k
      "smallPropStorage size must fit in direct properties");
1666
49.8k
  GCSmallHermesValue::uninitialized_fill(
1667
49.8k
      self->directProps() + numOverlapSlots<T>(),
1668
49.8k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
49.8k
      SmallHermesValue::encodeUndefinedValue(),
1670
49.8k
      runtime.getHeap());
1671
49.8k
  return self;
1672
49.8k
}
hermes::vm::JSFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSFunction>(hermes::vm::Runtime&, hermes::vm::JSFunction*)
Line
Count
Source
1661
4.41k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
4.41k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
4.41k
  static_assert(
1664
4.41k
      count <= DIRECT_PROPERTY_SLOTS,
1665
4.41k
      "smallPropStorage size must fit in direct properties");
1666
4.41k
  GCSmallHermesValue::uninitialized_fill(
1667
4.41k
      self->directProps() + numOverlapSlots<T>(),
1668
4.41k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
4.41k
      SmallHermesValue::encodeUndefinedValue(),
1670
4.41k
      runtime.getHeap());
1671
4.41k
  return self;
1672
4.41k
}
Unexecuted instantiation: hermes::vm::JSAsyncFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSAsyncFunction>(hermes::vm::Runtime&, hermes::vm::JSAsyncFunction*)
Unexecuted instantiation: hermes::vm::JSGeneratorFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSGeneratorFunction>(hermes::vm::Runtime&, hermes::vm::JSGeneratorFunction*)
Unexecuted instantiation: hermes::vm::GeneratorInnerFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::GeneratorInnerFunction>(hermes::vm::Runtime&, hermes::vm::GeneratorInnerFunction*)
Unexecuted instantiation: hermes::vm::RequireContext* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::RequireContext>(hermes::vm::Runtime&, hermes::vm::RequireContext*)
Unexecuted instantiation: hermes::vm::Arguments* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::Arguments>(hermes::vm::Runtime&, hermes::vm::Arguments*)
hermes::vm::JSArray* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSArray>(hermes::vm::Runtime&, hermes::vm::JSArray*)
Line
Count
Source
1661
249k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
249k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
249k
  static_assert(
1664
249k
      count <= DIRECT_PROPERTY_SLOTS,
1665
249k
      "smallPropStorage size must fit in direct properties");
1666
249k
  GCSmallHermesValue::uninitialized_fill(
1667
249k
      self->directProps() + numOverlapSlots<T>(),
1668
249k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
249k
      SmallHermesValue::encodeUndefinedValue(),
1670
249k
      runtime.getHeap());
1671
249k
  return self;
1672
249k
}
Unexecuted instantiation: hermes::vm::JSArrayIterator* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSArrayIterator>(hermes::vm::Runtime&, hermes::vm::JSArrayIterator*)
Unexecuted instantiation: hermes::vm::JSArrayBuffer* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSArrayBuffer>(hermes::vm::Runtime&, hermes::vm::JSArrayBuffer*)
Unexecuted instantiation: hermes::vm::JSDataView* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSDataView>(hermes::vm::Runtime&, hermes::vm::JSDataView*)
Unexecuted instantiation: hermes::vm::JSDate* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSDate>(hermes::vm::Runtime&, hermes::vm::JSDate*)
hermes::vm::JSError* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSError>(hermes::vm::Runtime&, hermes::vm::JSError*)
Line
Count
Source
1661
41
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
41
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
41
  static_assert(
1664
41
      count <= DIRECT_PROPERTY_SLOTS,
1665
41
      "smallPropStorage size must fit in direct properties");
1666
41
  GCSmallHermesValue::uninitialized_fill(
1667
41
      self->directProps() + numOverlapSlots<T>(),
1668
41
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
41
      SmallHermesValue::encodeUndefinedValue(),
1670
41
      runtime.getHeap());
1671
41
  return self;
1672
41
}
Unexecuted instantiation: hermes::vm::JSGenerator* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSGenerator>(hermes::vm::Runtime&, hermes::vm::JSGenerator*)
hermes::vm::JSObject* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSObject>(hermes::vm::Runtime&, hermes::vm::JSObject*)
Line
Count
Source
1661
229k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
229k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
229k
  static_assert(
1664
229k
      count <= DIRECT_PROPERTY_SLOTS,
1665
229k
      "smallPropStorage size must fit in direct properties");
1666
229k
  GCSmallHermesValue::uninitialized_fill(
1667
229k
      self->directProps() + numOverlapSlots<T>(),
1668
229k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
229k
      SmallHermesValue::encodeUndefinedValue(),
1670
229k
      runtime.getHeap());
1671
229k
  return self;
1672
229k
}
Unexecuted instantiation: hermes::vm::JSProxy* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSProxy>(hermes::vm::Runtime&, hermes::vm::JSProxy*)
hermes::vm::JSRegExp* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSRegExp>(hermes::vm::Runtime&, hermes::vm::JSRegExp*)
Line
Count
Source
1661
964
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
964
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
964
  static_assert(
1664
964
      count <= DIRECT_PROPERTY_SLOTS,
1665
964
      "smallPropStorage size must fit in direct properties");
1666
964
  GCSmallHermesValue::uninitialized_fill(
1667
964
      self->directProps() + numOverlapSlots<T>(),
1668
964
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
964
      SmallHermesValue::encodeUndefinedValue(),
1670
964
      runtime.getHeap());
1671
964
  return self;
1672
964
}
Unexecuted instantiation: hermes::vm::JSMapImpl<(hermes::vm::CellKind)47>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSMapImpl<(hermes::vm::CellKind)47> >(hermes::vm::Runtime&, hermes::vm::JSMapImpl<(hermes::vm::CellKind)47>*)
Unexecuted instantiation: hermes::vm::JSMapImpl<(hermes::vm::CellKind)48>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSMapImpl<(hermes::vm::CellKind)48> >(hermes::vm::Runtime&, hermes::vm::JSMapImpl<(hermes::vm::CellKind)48>*)
Unexecuted instantiation: hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50> >(hermes::vm::Runtime&, hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)50>*)
Unexecuted instantiation: hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49> >(hermes::vm::Runtime&, hermes::vm::JSMapIteratorImpl<(hermes::vm::CellKind)49>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<signed char, (hermes::vm::CellKind)35>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<short, (hermes::vm::CellKind)36>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<int, (hermes::vm::CellKind)37>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)38>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned char, (hermes::vm::CellKind)39>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned short, (hermes::vm::CellKind)40>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned int, (hermes::vm::CellKind)41>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<float, (hermes::vm::CellKind)42>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<double, (hermes::vm::CellKind)43>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<long, (hermes::vm::CellKind)44>*)
Unexecuted instantiation: hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45> >(hermes::vm::Runtime&, hermes::vm::JSTypedArray<unsigned long, (hermes::vm::CellKind)45>*)
Unexecuted instantiation: hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51> >(hermes::vm::Runtime&, hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)51>*)
Unexecuted instantiation: hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52> >(hermes::vm::Runtime&, hermes::vm::JSWeakMapImpl<(hermes::vm::CellKind)52>*)
Unexecuted instantiation: hermes::vm::JSWeakRef* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSWeakRef>(hermes::vm::Runtime&, hermes::vm::JSWeakRef*)
Unexecuted instantiation: hermes::vm::DecoratedObject* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::DecoratedObject>(hermes::vm::Runtime&, hermes::vm::DecoratedObject*)
Unexecuted instantiation: hermes::vm::FinalizableNativeFunction* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::FinalizableNativeFunction>(hermes::vm::Runtime&, hermes::vm::FinalizableNativeFunction*)
hermes::vm::HostObject* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::HostObject>(hermes::vm::Runtime&, hermes::vm::HostObject*)
Line
Count
Source
1661
113
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
113
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
113
  static_assert(
1664
113
      count <= DIRECT_PROPERTY_SLOTS,
1665
113
      "smallPropStorage size must fit in direct properties");
1666
113
  GCSmallHermesValue::uninitialized_fill(
1667
113
      self->directProps() + numOverlapSlots<T>(),
1668
113
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
113
      SmallHermesValue::encodeUndefinedValue(),
1670
113
      runtime.getHeap());
1671
113
  return self;
1672
113
}
hermes::vm::JSString* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSString>(hermes::vm::Runtime&, hermes::vm::JSString*)
Line
Count
Source
1661
124
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
124
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
124
  static_assert(
1664
124
      count <= DIRECT_PROPERTY_SLOTS,
1665
124
      "smallPropStorage size must fit in direct properties");
1666
124
  GCSmallHermesValue::uninitialized_fill(
1667
124
      self->directProps() + numOverlapSlots<T>(),
1668
124
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
124
      SmallHermesValue::encodeUndefinedValue(),
1670
124
      runtime.getHeap());
1671
124
  return self;
1672
124
}
hermes::vm::JSStringIterator* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSStringIterator>(hermes::vm::Runtime&, hermes::vm::JSStringIterator*)
Line
Count
Source
1661
2
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
2
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
2
  static_assert(
1664
2
      count <= DIRECT_PROPERTY_SLOTS,
1665
2
      "smallPropStorage size must fit in direct properties");
1666
2
  GCSmallHermesValue::uninitialized_fill(
1667
2
      self->directProps() + numOverlapSlots<T>(),
1668
2
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
2
      SmallHermesValue::encodeUndefinedValue(),
1670
2
      runtime.getHeap());
1671
2
  return self;
1672
2
}
Unexecuted instantiation: hermes::vm::JSBigInt* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSBigInt>(hermes::vm::Runtime&, hermes::vm::JSBigInt*)
hermes::vm::JSNumber* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSNumber>(hermes::vm::Runtime&, hermes::vm::JSNumber*)
Line
Count
Source
1661
124k
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
124k
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
124k
  static_assert(
1664
124k
      count <= DIRECT_PROPERTY_SLOTS,
1665
124k
      "smallPropStorage size must fit in direct properties");
1666
124k
  GCSmallHermesValue::uninitialized_fill(
1667
124k
      self->directProps() + numOverlapSlots<T>(),
1668
124k
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
124k
      SmallHermesValue::encodeUndefinedValue(),
1670
124k
      runtime.getHeap());
1671
124k
  return self;
1672
124k
}
hermes::vm::JSBoolean* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSBoolean>(hermes::vm::Runtime&, hermes::vm::JSBoolean*)
Line
Count
Source
1661
113
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
113
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
113
  static_assert(
1664
113
      count <= DIRECT_PROPERTY_SLOTS,
1665
113
      "smallPropStorage size must fit in direct properties");
1666
113
  GCSmallHermesValue::uninitialized_fill(
1667
113
      self->directProps() + numOverlapSlots<T>(),
1668
113
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
113
      SmallHermesValue::encodeUndefinedValue(),
1670
113
      runtime.getHeap());
1671
113
  return self;
1672
113
}
Unexecuted instantiation: hermes::vm::JSSymbol* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSSymbol>(hermes::vm::Runtime&, hermes::vm::JSSymbol*)
hermes::vm::SingleObject<(hermes::vm::CellKind)60>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::SingleObject<(hermes::vm::CellKind)60> >(hermes::vm::Runtime&, hermes::vm::SingleObject<(hermes::vm::CellKind)60>*)
Line
Count
Source
1661
113
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
113
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
113
  static_assert(
1664
113
      count <= DIRECT_PROPERTY_SLOTS,
1665
113
      "smallPropStorage size must fit in direct properties");
1666
113
  GCSmallHermesValue::uninitialized_fill(
1667
113
      self->directProps() + numOverlapSlots<T>(),
1668
113
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
113
      SmallHermesValue::encodeUndefinedValue(),
1670
113
      runtime.getHeap());
1671
113
  return self;
1672
113
}
hermes::vm::SingleObject<(hermes::vm::CellKind)59>* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::SingleObject<(hermes::vm::CellKind)59> >(hermes::vm::Runtime&, hermes::vm::SingleObject<(hermes::vm::CellKind)59>*)
Line
Count
Source
1661
113
inline T *JSObject::initDirectPropStorage(Runtime &runtime, T *self) {
1662
113
  constexpr auto count = numOverlapSlots<T>() + T::NAMED_PROPERTY_SLOTS;
1663
113
  static_assert(
1664
113
      count <= DIRECT_PROPERTY_SLOTS,
1665
113
      "smallPropStorage size must fit in direct properties");
1666
113
  GCSmallHermesValue::uninitialized_fill(
1667
113
      self->directProps() + numOverlapSlots<T>(),
1668
113
      self->directProps() + DIRECT_PROPERTY_SLOTS,
1669
113
      SmallHermesValue::encodeUndefinedValue(),
1670
113
      runtime.getHeap());
1671
113
  return self;
1672
113
}
Unexecuted instantiation: hermes::vm::JSCallSite* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSCallSite>(hermes::vm::Runtime&, hermes::vm::JSCallSite*)
Unexecuted instantiation: hermes::vm::JSCallableProxy* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSCallableProxy>(hermes::vm::Runtime&, hermes::vm::JSCallableProxy*)
Unexecuted instantiation: hermes::vm::JSRegExpStringIterator* hermes::vm::JSObject::initDirectPropStorage<hermes::vm::JSRegExpStringIterator>(hermes::vm::Runtime&, hermes::vm::JSRegExpStringIterator*)
1673
1674
template <SlotIndex index>
1675
1.15M
inline SmallHermesValue JSObject::getDirectSlotValue(const JSObject *self) {
1676
1.15M
  static_assert(index < DIRECT_PROPERTY_SLOTS, "Must be a direct property");
1677
1.15M
  return self->directProps()[index];
1678
1.15M
}
1679
1680
template <SlotIndex index>
1681
inline void
1682
722k
JSObject::setDirectSlotValue(JSObject *self, SmallHermesValue value, GC &gc) {
1683
722k
  static_assert(index < DIRECT_PROPERTY_SLOTS, "Must be a direct property");
1684
722k
  self->directProps()[index].set(value, gc);
1685
722k
}
1686
1687
template <PropStorage::Inline inl>
1688
inline SmallHermesValue JSObject::getNamedSlotValueUnsafe(
1689
    JSObject *self,
1690
    PointerBase &runtime,
1691
1.69M
    SlotIndex index) {
1692
1.69M
  assert(!self->flags_.proxyObject && "getNamedSlotValue called on a Proxy");
1693
1694
1.69M
  if (LLVM_LIKELY(index < DIRECT_PROPERTY_SLOTS))
1695
1.19M
    return self->directProps()[index];
1696
1697
497k
  return self->propStorage_.getNonNull(runtime)->at<inl>(
1698
497k
      index - DIRECT_PROPERTY_SLOTS);
1699
1.69M
}
hermes::vm::HermesValue32 hermes::vm::JSObject::getNamedSlotValueUnsafe<(hermes::vm::ArrayStorageBase<hermes::vm::HermesValue32>::Inline)0>(hermes::vm::JSObject*, hermes::vm::PointerBase&, unsigned int)
Line
Count
Source
1691
1.56M
    SlotIndex index) {
1692
1.56M
  assert(!self->flags_.proxyObject && "getNamedSlotValue called on a Proxy");
1693
1694
1.56M
  if (LLVM_LIKELY(index < DIRECT_PROPERTY_SLOTS))
1695
1.19M
    return self->directProps()[index];
1696
1697
371k
  return self->propStorage_.getNonNull(runtime)->at<inl>(
1698
371k
      index - DIRECT_PROPERTY_SLOTS);
1699
1.56M
}
hermes::vm::HermesValue32 hermes::vm::JSObject::getNamedSlotValueUnsafe<(hermes::vm::ArrayStorageBase<hermes::vm::HermesValue32>::Inline)1>(hermes::vm::JSObject*, hermes::vm::PointerBase&, unsigned int)
Line
Count
Source
1691
126k
    SlotIndex index) {
1692
126k
  assert(!self->flags_.proxyObject && "getNamedSlotValue called on a Proxy");
1693
1694
126k
  if (LLVM_LIKELY(index < DIRECT_PROPERTY_SLOTS))
1695
113
    return self->directProps()[index];
1696
1697
125k
  return self->propStorage_.getNonNull(runtime)->at<inl>(
1698
125k
      index - DIRECT_PROPERTY_SLOTS);
1699
126k
}
1700
1701
inline CallResult<PseudoHandle<>> JSObject::getNamedSlotValue(
1702
    PseudoHandle<JSObject> self,
1703
    Runtime &runtime,
1704
0
    NamedPropertyDescriptor desc) {
1705
0
  if (LLVM_UNLIKELY(desc.flags.proxyObject) ||
1706
0
      LLVM_UNLIKELY(desc.flags.hostObject)) {
1707
0
    SymbolID name = SymbolID::unsafeCreate(desc.slot);
1708
0
    assert(name.isValid() && "invalid SymbolID in descriptor");
1709
0
    return getNamed_RJS(runtime.makeHandle(std::move(self)), runtime, name);
1710
0
  }
1711
0
  return createPseudoHandle(
1712
0
      getNamedSlotValueUnsafe(self.get(), runtime, desc).unboxToHV(runtime));
1713
0
}
1714
1715
inline CallResult<PseudoHandle<>> JSObject::getNamedSlotValue(
1716
    Handle<JSObject> self,
1717
    Runtime &runtime,
1718
871
    NamedPropertyDescriptor desc) {
1719
871
  if (LLVM_UNLIKELY(desc.flags.proxyObject) ||
1720
871
      LLVM_UNLIKELY(desc.flags.hostObject)) {
1721
0
    SymbolID name = SymbolID::unsafeCreate(desc.slot);
1722
0
    assert(name.isValid() && "invalid SymbolID in descriptor");
1723
0
    return getNamed_RJS(self, runtime, name);
1724
0
  }
1725
871
  return createPseudoHandle(
1726
871
      getNamedSlotValueUnsafe(self.get(), runtime, desc).unboxToHV(runtime));
1727
871
}
1728
1729
inline CallResult<bool> JSObject::setNamedSlotValue(
1730
    PseudoHandle<JSObject> self,
1731
    Runtime &runtime,
1732
    NamedPropertyDescriptor desc,
1733
0
    PseudoHandle<> value) {
1734
0
  if (LLVM_UNLIKELY(desc.flags.proxyObject) ||
1735
0
      LLVM_UNLIKELY(desc.flags.hostObject)) {
1736
0
    SymbolID name = SymbolID::unsafeCreate(desc.slot);
1737
0
    assert(name.isValid() && "invalid SymbolID in descriptor");
1738
0
    return putNamed_RJS(
1739
0
        runtime.makeHandle(std::move(self)),
1740
0
        runtime,
1741
0
        name,
1742
0
        runtime.makeHandle(std::move(value)));
1743
0
  }
1744
0
  auto shv = SmallHermesValue::encodeHermesValue(value.get(), runtime);
1745
0
  setNamedSlotValueUnsafe(self.get(), runtime, desc, shv);
1746
0
  return true;
1747
0
}
1748
1749
template <PropStorage::Inline inl>
1750
inline void JSObject::setNamedSlotValueUnsafe(
1751
    JSObject *self,
1752
    Runtime &runtime,
1753
    SlotIndex index,
1754
637k
    SmallHermesValue value) {
1755
  // NOTE: even though it is tempting to implement this in terms of assignment
1756
  // to namedSlotRef(), it is a slight performance regression, which is not
1757
  // entirely unexpected.
1758
637k
  if (LLVM_LIKELY(index < DIRECT_PROPERTY_SLOTS))
1759
1.58k
    return self->directProps()[index].set(value, runtime.getHeap());
1760
1761
636k
  self->propStorage_.getNonNull(runtime)->set<inl>(
1762
636k
      index - DIRECT_PROPERTY_SLOTS, value, runtime.getHeap());
1763
636k
}
void hermes::vm::JSObject::setNamedSlotValueUnsafe<(hermes::vm::ArrayStorageBase<hermes::vm::HermesValue32>::Inline)1>(hermes::vm::JSObject*, hermes::vm::Runtime&, unsigned int, hermes::vm::HermesValue32)
Line
Count
Source
1754
1.13k
    SmallHermesValue value) {
1755
  // NOTE: even though it is tempting to implement this in terms of assignment
1756
  // to namedSlotRef(), it is a slight performance regression, which is not
1757
  // entirely unexpected.
1758
1.13k
  if (LLVM_LIKELY(index < DIRECT_PROPERTY_SLOTS))
1759
1.13k
    return self->directProps()[index].set(value, runtime.getHeap());
1760
1761
0
  self->propStorage_.getNonNull(runtime)->set<inl>(
1762
0
      index - DIRECT_PROPERTY_SLOTS, value, runtime.getHeap());
1763
0
}
void hermes::vm::JSObject::setNamedSlotValueUnsafe<(hermes::vm::ArrayStorageBase<hermes::vm::HermesValue32>::Inline)0>(hermes::vm::JSObject*, hermes::vm::Runtime&, unsigned int, hermes::vm::HermesValue32)
Line
Count
Source
1754
636k
    SmallHermesValue value) {
1755
  // NOTE: even though it is tempting to implement this in terms of assignment
1756
  // to namedSlotRef(), it is a slight performance regression, which is not
1757
  // entirely unexpected.
1758
636k
  if (LLVM_LIKELY(index < DIRECT_PROPERTY_SLOTS))
1759
452
    return self->directProps()[index].set(value, runtime.getHeap());
1760
1761
636k
  self->propStorage_.getNonNull(runtime)->set<inl>(
1762
636k
      index - DIRECT_PROPERTY_SLOTS, value, runtime.getHeap());
1763
636k
}
1764
1765
inline CallResult<PseudoHandle<>> JSObject::getComputedSlotValue(
1766
    PseudoHandle<JSObject> self,
1767
    Runtime &runtime,
1768
    MutableHandle<SymbolID> &tmpSymbolStorage,
1769
0
    ComputedPropertyDescriptor desc) {
1770
0
  if (LLVM_LIKELY(desc.flags.indexed)) {
1771
0
    assert(
1772
0
        self->flags_.indexedStorage &&
1773
0
        "indexed flag set but no indexed storage");
1774
0
    return createPseudoHandle(
1775
0
        getOwnIndexed(std::move(self), runtime, desc.slot));
1776
0
  }
1777
0
  if (LLVM_UNLIKELY(desc.flags.proxyObject) ||
1778
0
      LLVM_UNLIKELY(desc.flags.hostObject)) {
1779
0
    SymbolID name = SymbolID::unsafeCreate(desc.slot);
1780
0
    assert(name.isValid() && "invalid SymbolID in descriptor");
1781
0
    return getComputed_RJS(
1782
0
        runtime.makeHandle(std::move(self)),
1783
0
        runtime,
1784
0
        runtime.makeHandle(HermesValue::encodeSymbolValue(name)));
1785
0
  }
1786
0
  return createPseudoHandle(
1787
0
      getNamedSlotValueUnsafe(
1788
0
          self.get(), runtime, desc.castToNamedPropertyDescriptorRef())
1789
0
          .unboxToHV(runtime));
1790
0
}
1791
1792
inline HermesValue JSObject::getComputedSlotValueUnsafe(
1793
    PseudoHandle<JSObject> self,
1794
    Runtime &runtime,
1795
229k
    ComputedPropertyDescriptor desc) {
1796
229k
  if (LLVM_LIKELY(desc.flags.indexed)) {
1797
0
    assert(
1798
0
        self->flags_.indexedStorage &&
1799
0
        "indexed flag set but no indexed storage");
1800
0
    return getOwnIndexed(std::move(self), runtime, desc.slot);
1801
0
  }
1802
  // Call is valid because this function cannot be called with a Proxy.
1803
229k
  return getNamedSlotValueUnsafe(
1804
229k
             self.get(), runtime, desc.castToNamedPropertyDescriptorRef())
1805
229k
      .unboxToHV(runtime);
1806
229k
}
1807
1808
inline CallResult<bool> JSObject::setComputedSlotValue(
1809
    Handle<JSObject> selfHandle,
1810
    Runtime &runtime,
1811
    MutableHandle<SymbolID> &tmpSymbolStorage,
1812
    ComputedPropertyDescriptor desc,
1813
0
    Handle<> value) {
1814
0
  if (LLVM_LIKELY(desc.flags.indexed)) {
1815
0
    assert(
1816
0
        selfHandle->flags_.indexedStorage &&
1817
0
        "indexed flag set but no indexed storage");
1818
0
    return setOwnIndexed(selfHandle, runtime, desc.slot, value);
1819
0
  }
1820
0
  if (LLVM_UNLIKELY(desc.flags.proxyObject) ||
1821
0
      LLVM_UNLIKELY(desc.flags.hostObject)) {
1822
0
    SymbolID name = SymbolID::unsafeCreate(desc.slot);
1823
0
    assert(name.isValid() && "invalid SymbolID in descriptor");
1824
0
    return putComputed_RJS(
1825
0
        selfHandle,
1826
0
        runtime,
1827
0
        runtime.makeHandle(HermesValue::encodeSymbolValue(name)),
1828
0
        value);
1829
0
  }
1830
0
  auto shv = SmallHermesValue::encodeHermesValue(value.get(), runtime);
1831
0
  setNamedSlotValueUnsafe(
1832
0
      selfHandle.get(), runtime, desc.castToNamedPropertyDescriptorRef(), shv);
1833
0
  return true;
1834
0
}
1835
1836
inline ExecutionStatus JSObject::setComputedSlotValueUnsafe(
1837
    Handle<JSObject> selfHandle,
1838
    Runtime &runtime,
1839
    ComputedPropertyDescriptor desc,
1840
0
    Handle<> value) {
1841
0
  if (LLVM_LIKELY(desc.flags.indexed)) {
1842
0
    assert(
1843
0
        selfHandle->flags_.indexedStorage &&
1844
0
        "indexed flag set but no indexed storage");
1845
0
    return setOwnIndexed(selfHandle, runtime, desc.slot, value).getStatus();
1846
0
  }
1847
0
  auto shv = SmallHermesValue::encodeHermesValue(value.get(), runtime);
1848
0
  setNamedSlotValueUnsafe(
1849
0
      selfHandle.get(), runtime, desc.castToNamedPropertyDescriptorRef(), shv);
1850
0
  return ExecutionStatus::RETURNED;
1851
0
}
1852
1853
inline bool JSObject::getOwnNamedDescriptor(
1854
    Handle<JSObject> selfHandle,
1855
    Runtime &runtime,
1856
    SymbolID name,
1857
1.45M
    NamedPropertyDescriptor &desc) {
1858
1.45M
  return findProperty(selfHandle, runtime, name, desc).hasValue();
1859
1.45M
}
1860
1861
inline OptValue<bool> JSObject::tryGetOwnNamedDescriptorFast(
1862
    JSObject *self,
1863
    Runtime &runtime,
1864
    SymbolID name,
1865
643k
    NamedPropertyDescriptor &desc) {
1866
643k
  return HiddenClass::tryFindPropertyFast(
1867
643k
      self->clazz_.getNonNull(runtime), runtime, name, desc);
1868
643k
}
1869
1870
inline OptValue<SmallHermesValue>
1871
0
JSObject::tryGetNamedNoAlloc(JSObject *self, PointerBase &base, SymbolID name) {
1872
0
  for (JSObject *curr = self; curr; curr = curr->parent_.get(base)) {
1873
0
    if (LLVM_UNLIKELY(curr->isProxyObject()) ||
1874
0
        LLVM_UNLIKELY(curr->isHostObject())) {
1875
      // Fail if there is a proxy or host object in the chain,
1876
      // because walking the prototype chain without allocating can't be done.
1877
0
      return llvh::None;
1878
0
    }
1879
0
    auto found =
1880
0
        HiddenClass::findPropertyNoAlloc(curr->getClass(base), base, name);
1881
0
    if (found) {
1882
0
      return getNamedSlotValueUnsafe(curr, base, found.getValue());
1883
0
    }
1884
0
  }
1885
  // It wasn't found on any of the parents of this object, declare it
1886
  // un-findable.
1887
0
  return llvh::None;
1888
0
}
1889
1890
inline JSObject *JSObject::getNamedDescriptorPredefined(
1891
    Handle<JSObject> selfHandle,
1892
    Runtime &runtime,
1893
    Predefined::Str name,
1894
88
    NamedPropertyDescriptor &desc) {
1895
88
  return getNamedDescriptorUnsafe(
1896
88
      selfHandle,
1897
88
      runtime,
1898
88
      Predefined::getSymbolID(name),
1899
88
      PropertyFlags::invalid(),
1900
88
      desc);
1901
88
}
1902
1903
inline JSObject *JSObject::getNamedDescriptorPredefined(
1904
    Handle<JSObject> selfHandle,
1905
    Runtime &runtime,
1906
    Predefined::Sym name,
1907
0
    NamedPropertyDescriptor &desc) {
1908
0
  return getNamedDescriptorUnsafe(
1909
0
      selfHandle,
1910
0
      runtime,
1911
0
      Predefined::getSymbolID(name),
1912
0
      PropertyFlags::invalid(),
1913
0
      desc);
1914
0
}
1915
1916
inline JSObject *JSObject::getNamedDescriptorUnsafe(
1917
    Handle<JSObject> selfHandle,
1918
    Runtime &runtime,
1919
    SymbolID name,
1920
1.45M
    NamedPropertyDescriptor &desc) {
1921
1.45M
  return getNamedDescriptorUnsafe(
1922
1.45M
      selfHandle, runtime, name, PropertyFlags::invalid(), desc);
1923
1.45M
}
1924
1925
inline CallResult<PseudoHandle<>> JSObject::getNamed_RJS(
1926
    Handle<JSObject> selfHandle,
1927
    Runtime &runtime,
1928
    SymbolID name,
1929
    PropOpFlags opFlags,
1930
1.33M
    PropertyCacheEntry *cacheEntry) {
1931
1.33M
  return getNamedWithReceiver_RJS(
1932
1.33M
      selfHandle, runtime, name, selfHandle, opFlags, cacheEntry);
1933
1.33M
}
1934
1935
inline CallResult<PseudoHandle<>> JSObject::getComputed_RJS(
1936
    Handle<JSObject> selfHandle,
1937
    Runtime &runtime,
1938
480k
    Handle<> nameValHandle) {
1939
480k
  return getComputedWithReceiver_RJS(
1940
480k
      selfHandle, runtime, nameValHandle, selfHandle);
1941
480k
}
1942
1943
inline CallResult<bool> JSObject::putNamed_RJS(
1944
    Handle<JSObject> selfHandle,
1945
    Runtime &runtime,
1946
    SymbolID name,
1947
    Handle<> valueHandle,
1948
4.30k
    PropOpFlags opFlags) {
1949
4.30k
  return putNamedWithReceiver_RJS(
1950
4.30k
      selfHandle, runtime, name, valueHandle, selfHandle, opFlags);
1951
4.30k
}
1952
1953
inline CallResult<bool> JSObject::putComputed_RJS(
1954
    Handle<JSObject> selfHandle,
1955
    Runtime &runtime,
1956
    Handle<> nameValHandle,
1957
    Handle<> valueHandle,
1958
113
    PropOpFlags opFlags) {
1959
113
  return putComputedWithReceiver_RJS(
1960
113
      selfHandle, runtime, nameValHandle, valueHandle, selfHandle, opFlags);
1961
113
}
1962
1963
inline std::pair<uint32_t, uint32_t> JSObject::getOwnIndexedRange(
1964
    JSObject *self,
1965
27
    Runtime &runtime) {
1966
27
  return self->getVT()->getOwnIndexedRange(self, runtime);
1967
27
};
1968
1969
inline bool
1970
0
JSObject::haveOwnIndexed(JSObject *self, Runtime &runtime, uint32_t index) {
1971
0
  return self->getVT()->haveOwnIndexed(self, runtime, index);
1972
0
}
1973
1974
inline OptValue<PropertyFlags> JSObject::getOwnIndexedPropertyFlags(
1975
    JSObject *self,
1976
    Runtime &runtime,
1977
1.95M
    uint32_t index) {
1978
1.95M
  return self->getVT()->getOwnIndexedPropertyFlags(self, runtime, index);
1979
1.95M
}
1980
1981
inline OptValue<HiddenClass::PropertyPos> JSObject::findProperty(
1982
    Handle<JSObject> selfHandle,
1983
    Runtime &runtime,
1984
    SymbolID name,
1985
2.17M
    NamedPropertyDescriptor &desc) {
1986
2.17M
  return findProperty(
1987
2.17M
      selfHandle, runtime, name, PropertyFlags::invalid(), desc);
1988
2.17M
}
1989
1990
inline OptValue<HiddenClass::PropertyPos> JSObject::findProperty(
1991
    Handle<JSObject> selfHandle,
1992
    Runtime &runtime,
1993
    SymbolID name,
1994
    PropertyFlags expectedFlags,
1995
4.65M
    NamedPropertyDescriptor &desc) {
1996
4.65M
  auto ret = HiddenClass::findProperty(
1997
4.65M
      createPseudoHandle(selfHandle->clazz_.getNonNull(runtime)),
1998
4.65M
      runtime,
1999
4.65M
      name,
2000
4.65M
      expectedFlags,
2001
4.65M
      desc);
2002
4.65M
  assert(
2003
4.65M
      !(selfHandle->flags_.proxyObject && ret) &&
2004
4.65M
      "Proxy objects should never have own properties");
2005
4.65M
  return ret;
2006
4.65M
}
2007
2008
27
inline bool JSObject::shouldCacheForIn(Runtime &runtime) const {
2009
27
  return !clazz_.getNonNull(runtime)->isDictionary() &&
2010
27
      !flags_.indexedStorage && !flags_.hostObject && !flags_.proxyObject;
2011
27
}
2012
2013
} // namespace vm
2014
} // namespace hermes
2015
#pragma GCC diagnostic pop
2016
2017
#endif // HERMES_VM_JSOBJECT_H