@@ -520,21 +520,35 @@ template <typename HVType>
520
520
class GCHermesValueBase final : public HVType {
521
521
public:
522
522
GCHermesValueBase () : HVType(HVType::encodeUndefinedValue()) {}
523
- // / Initialize a GCHermesValue from another HV. Performs a write barrier.
523
+ // / Initialize a GCHermesValue from another HV. Performs a write barrier. This
524
+ // / must not be used if it lives in an object that supports large allocation.
524
525
template <typename NeedsBarriers = std::true_type>
525
526
GCHermesValueBase (HVType hv, GC &gc);
527
+ // / Initialize a GCHermesValue from another HV. Performs a write barrier using
528
+ // / \p owningObj, which owns this GCHermesValue and may support large
529
+ // / allocation.
530
+ template <typename NeedsBarriers = std::true_type>
531
+ GCHermesValueBase (HVType hv, GC &gc, const GCCell *owningObj);
526
532
// / Initialize a GCHermesValue from a non-pointer HV. Might perform a write
527
533
// / barrier, depending on the GC.
528
534
// / NOTE: The last parameter is unused, but acts as an overload selector.
529
535
template <typename NeedsBarriers = std::true_type>
530
536
GCHermesValueBase (HVType hv, GC &gc, std::nullptr_t );
531
537
GCHermesValueBase (const HVType &) = delete ;
532
538
533
- // / The HermesValue \p hv may be an object pointer. Assign the
534
- // / value, and perform any necessary write barriers.
539
+ // / The HermesValue \p hv may be an object pointer. Assign the value, and
540
+ // / perform any necessary write barriers. This must not be used if it lives in
541
+ // / an object that supports large allocation.
535
542
template <typename NeedsBarriers = std::true_type>
536
543
inline void set (HVType hv, GC &gc);
537
544
545
+ // / The HermesValue \p hv may be an object pointer. Assign the value, and
546
+ // / perform any necessary write barriers. \p owningObj is the object that
547
+ // / contains this GCHermesValueBase, and it may support large allocation.
548
+ // / for which the object pointer is needed by writer barriers.
549
+ template <typename NeedsBarriers = std::true_type>
550
+ inline void setInLarge (HVType hv, GC &gc, const GCCell *owningObj);
551
+
538
552
// / The HermesValue \p hv must not be an object pointer. Assign the
539
553
// / value.
540
554
// / Some GCs still need to do a write barrier though, so pass a GC parameter.
0 commit comments