Bläddra i källkod

LibJS: Convert ordinary_create_from_constructor() to NonnullGCPtr

Linus Groh 2 år sedan
förälder
incheckning
1c24b82dd7
39 ändrade filer med 80 tillägg och 80 borttagningar
  1. 2 2
      Userland/Libraries/LibJS/Runtime/AbstractOperations.h
  2. 2 2
      Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.cpp
  3. 2 2
      Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp
  4. 1 1
      Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp
  5. 2 2
      Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp
  6. 1 1
      Userland/Libraries/LibJS/Runtime/DateConstructor.cpp
  7. 2 2
      Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
  8. 4 4
      Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp
  9. 1 1
      Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp
  10. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp
  11. 3 3
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
  12. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp
  13. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp
  14. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp
  15. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp
  16. 3 3
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp
  17. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
  18. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp
  19. 2 2
      Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp
  20. 3 3
      Userland/Libraries/LibJS/Runtime/MapConstructor.cpp
  21. 1 1
      Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
  22. 1 1
      Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
  23. 1 1
      Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
  24. 2 2
      Userland/Libraries/LibJS/Runtime/RegExpObject.cpp
  25. 3 3
      Userland/Libraries/LibJS/Runtime/SetConstructor.cpp
  26. 2 2
      Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp
  27. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp
  28. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp
  29. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp
  30. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp
  31. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp
  32. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp
  33. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp
  34. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp
  35. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp
  36. 2 2
      Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp
  37. 3 3
      Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp
  38. 2 2
      Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp
  39. 3 3
      Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp

+ 2 - 2
Userland/Libraries/LibJS/Runtime/AbstractOperations.h

@@ -131,11 +131,11 @@ ALWAYS_INLINE ThrowCompletionOr<Object*> construct(VM& vm, FunctionObject& funct
 
 // 10.1.13 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] ), https://tc39.es/ecma262/#sec-ordinarycreatefromconstructor
 template<typename T, typename... Args>
-ThrowCompletionOr<T*> ordinary_create_from_constructor(VM& vm, FunctionObject const& constructor, Object* (Intrinsics::*intrinsic_default_prototype)(), Args&&... args)
+ThrowCompletionOr<NonnullGCPtr<T>> ordinary_create_from_constructor(VM& vm, FunctionObject const& constructor, Object* (Intrinsics::*intrinsic_default_prototype)(), Args&&... args)
 {
     auto& realm = *vm.current_realm();
     auto* prototype = TRY(get_prototype_from_constructor(vm, constructor, intrinsic_default_prototype));
-    return realm.heap().allocate<T>(realm, forward<Args>(args)..., *prototype).ptr();
+    return realm.heap().allocate<T>(realm, forward<Args>(args)..., *prototype);
 }
 
 // 14.1 MergeLists ( a, b ), https://tc39.es/proposal-temporal/#sec-temporal-mergelists

+ 2 - 2
Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.cpp

@@ -48,7 +48,7 @@ ThrowCompletionOr<Object*> AggregateErrorConstructor::construct(FunctionObject&
     auto options = vm.argument(2);
 
     // 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%AggregateError.prototype%", « [[ErrorData]] »).
-    auto* aggregate_error = TRY(ordinary_create_from_constructor<AggregateError>(vm, new_target, &Intrinsics::aggregate_error_prototype));
+    auto aggregate_error = TRY(ordinary_create_from_constructor<AggregateError>(vm, new_target, &Intrinsics::aggregate_error_prototype));
 
     // 3. If message is not undefined, then
     if (!message.is_undefined()) {
@@ -69,7 +69,7 @@ ThrowCompletionOr<Object*> AggregateErrorConstructor::construct(FunctionObject&
     MUST(aggregate_error->define_property_or_throw(vm.names.errors, { .value = Array::create_from(realm, errors_list), .writable = true, .enumerable = false, .configurable = true }));
 
     // 7. Return O.
-    return aggregate_error;
+    return aggregate_error.ptr();
 }
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/ArrayBuffer.cpp

@@ -54,7 +54,7 @@ void ArrayBuffer::visit_edges(Cell::Visitor& visitor)
 ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM& vm, FunctionObject& constructor, size_t byte_length)
 {
     // 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBuffer.prototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]], [[ArrayBufferDetachKey]] »).
-    auto* obj = TRY(ordinary_create_from_constructor<ArrayBuffer>(vm, constructor, &Intrinsics::array_buffer_prototype, nullptr));
+    auto obj = TRY(ordinary_create_from_constructor<ArrayBuffer>(vm, constructor, &Intrinsics::array_buffer_prototype, nullptr));
 
     // 2. Let block be ? CreateByteDataBlock(byteLength).
     auto block = ByteBuffer::create_zeroed(byte_length);
@@ -67,7 +67,7 @@ ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM& vm, FunctionObject& co
     // 4. Set obj.[[ArrayBufferByteLength]] to byteLength.
 
     // 5. Return obj.
-    return obj;
+    return obj.ptr();
 }
 
 // 25.1.2.3 DetachArrayBuffer ( arrayBuffer [ , key ] ), https://tc39.es/ecma262/#sec-detacharraybuffer

+ 1 - 1
Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp

@@ -42,7 +42,7 @@ ThrowCompletionOr<Object*> BooleanConstructor::construct(FunctionObject& new_tar
     auto& vm = this->vm();
 
     auto b = vm.argument(0).to_boolean();
-    return TRY(ordinary_create_from_constructor<BooleanObject>(vm, new_target, &Intrinsics::boolean_prototype, b));
+    return TRY(ordinary_create_from_constructor<BooleanObject>(vm, new_target, &Intrinsics::boolean_prototype, b)).ptr();
 }
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp

@@ -67,12 +67,12 @@ ThrowCompletionOr<Object*> DataViewConstructor::construct(FunctionObject& new_ta
             return vm.throw_completion<RangeError>(ErrorType::InvalidLength, vm.names.DataView);
     }
 
-    auto* data_view = TRY(ordinary_create_from_constructor<DataView>(vm, new_target, &Intrinsics::data_view_prototype, &array_buffer, view_byte_length, offset));
+    auto data_view = TRY(ordinary_create_from_constructor<DataView>(vm, new_target, &Intrinsics::data_view_prototype, &array_buffer, view_byte_length, offset));
 
     if (array_buffer.is_detached())
         return vm.throw_completion<TypeError>(ErrorType::DetachedArrayBuffer);
 
-    return data_view;
+    return data_view.ptr();
 }
 
 }

+ 1 - 1
Userland/Libraries/LibJS/Runtime/DateConstructor.cpp

@@ -299,7 +299,7 @@ ThrowCompletionOr<Object*> DateConstructor::construct(FunctionObject& new_target
     // 6. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Date.prototype%", « [[DateValue]] »).
     // 7. Set O.[[DateValue]] to dv.
     // 8. Return O.
-    return TRY(ordinary_create_from_constructor<Date>(vm, new_target, &Intrinsics::date_prototype, date_value));
+    return TRY(ordinary_create_from_constructor<Date>(vm, new_target, &Intrinsics::date_prototype, date_value)).ptr();
 }
 
 // 21.4.3.1 Date.now ( ), https://tc39.es/ecma262/#sec-date.now

+ 2 - 2
Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp

@@ -203,7 +203,7 @@ ThrowCompletionOr<Object*> ECMAScriptFunctionObject::internal_construct(MarkedVe
     // 2. Let kind be F.[[ConstructorKind]].
     auto kind = m_constructor_kind;
 
-    Object* this_argument = nullptr;
+    GCPtr<Object> this_argument;
 
     // 3. If kind is base, then
     if (kind == ConstructorKind::Base) {
@@ -269,7 +269,7 @@ ThrowCompletionOr<Object*> ECMAScriptFunctionObject::internal_construct(MarkedVe
 
         // b. If kind is base, return thisArgument.
         if (kind == ConstructorKind::Base)
-            return this_argument;
+            return this_argument.ptr();
 
         // c. If result.[[Value]] is not undefined, throw a TypeError exception.
         if (!result.value()->is_undefined())

+ 4 - 4
Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp

@@ -43,7 +43,7 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
     auto options = vm.argument(1);
 
     // 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%Error.prototype%", « [[ErrorData]] »).
-    auto* error = TRY(ordinary_create_from_constructor<Error>(vm, new_target, &Intrinsics::error_prototype));
+    auto error = TRY(ordinary_create_from_constructor<Error>(vm, new_target, &Intrinsics::error_prototype));
 
     // 3. If message is not undefined, then
     if (!message.is_undefined()) {
@@ -58,7 +58,7 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
     TRY(error->install_error_cause(options));
 
     // 5. Return O.
-    return error;
+    return error.ptr();
 }
 
 #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType)                                        \
@@ -96,7 +96,7 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
         auto options = vm.argument(1);                                                                                          \
                                                                                                                                 \
         /* 2. Let O be ? OrdinaryCreateFromConstructor(newTarget, "%NativeError.prototype%", « [[ErrorData]] »). */           \
-        auto* error = TRY(ordinary_create_from_constructor<ClassName>(vm, new_target, &Intrinsics::snake_name##_prototype));    \
+        auto error = TRY(ordinary_create_from_constructor<ClassName>(vm, new_target, &Intrinsics::snake_name##_prototype));     \
                                                                                                                                 \
         /* 3. If message is not undefined, then */                                                                              \
         if (!message.is_undefined()) {                                                                                          \
@@ -111,7 +111,7 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
         TRY(error->install_error_cause(options));                                                                               \
                                                                                                                                 \
         /* 5. Return O. */                                                                                                      \
-        return error;                                                                                                           \
+        return error.ptr();                                                                                                     \
     }
 
 JS_ENUMERATE_NATIVE_ERRORS

+ 1 - 1
Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp

@@ -56,7 +56,7 @@ ThrowCompletionOr<Object*> FinalizationRegistryConstructor::construct(FunctionOb
     // 7. Set finalizationRegistry.[[Cells]] to a new empty List.
     // NOTE: This is done inside FinalizationRegistry instead of here.
     // 8. Return finalizationRegistry.
-    return TRY(ordinary_create_from_constructor<FinalizationRegistry>(vm, new_target, &Intrinsics::finalization_registry_prototype, *realm(), vm.host_make_job_callback(cleanup_callback.as_function())));
+    return TRY(ordinary_create_from_constructor<FinalizationRegistry>(vm, new_target, &Intrinsics::finalization_registry_prototype, *realm(), vm.host_make_job_callback(cleanup_callback.as_function()))).ptr();
 }
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp

@@ -171,10 +171,10 @@ ThrowCompletionOr<Object*> CollatorConstructor::construct(FunctionObject& new_ta
     //     a. Append [[CaseFirst]] as the last element of internalSlotsList.
 
     // 5. Let collator be ? OrdinaryCreateFromConstructor(newTarget, "%Collator.prototype%", internalSlotsList).
-    auto* collator = TRY(ordinary_create_from_constructor<Collator>(vm, new_target, &Intrinsics::intl_collator_prototype));
+    auto collator = TRY(ordinary_create_from_constructor<Collator>(vm, new_target, &Intrinsics::intl_collator_prototype));
 
     // 6. Return ? InitializeCollator(collator, locales, options).
-    return TRY(initialize_collator(vm, *collator, locales, options));
+    return TRY(initialize_collator(vm, collator, locales, options));
 }
 
 // 10.2.2 Intl.Collator.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.collator.supportedlocalesof

+ 3 - 3
Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp

@@ -54,17 +54,17 @@ ThrowCompletionOr<Object*> DateTimeFormatConstructor::construct(FunctionObject&
     auto options = vm.argument(1);
 
     // 2. Let dateTimeFormat be ? OrdinaryCreateFromConstructor(newTarget, "%DateTimeFormat.prototype%", « [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[Weekday]], [[Era]], [[Year]], [[Month]], [[Day]], [[DayPeriod]], [[Hour]], [[Minute]], [[Second]], [[FractionalSecondDigits]], [[TimeZoneName]], [[HourCycle]], [[Pattern]], [[BoundFormat]] »).
-    auto* date_time_format = TRY(ordinary_create_from_constructor<DateTimeFormat>(vm, new_target, &Intrinsics::intl_date_time_format_prototype));
+    auto date_time_format = TRY(ordinary_create_from_constructor<DateTimeFormat>(vm, new_target, &Intrinsics::intl_date_time_format_prototype));
 
     // 3. Perform ? InitializeDateTimeFormat(dateTimeFormat, locales, options).
-    TRY(initialize_date_time_format(vm, *date_time_format, locales, options));
+    TRY(initialize_date_time_format(vm, date_time_format, locales, options));
 
     // 4. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then
     //     a. Let this be the this value.
     //     b. Return ? ChainDateTimeFormat(dateTimeFormat, NewTarget, this).
 
     // 5. Return dateTimeFormat.
-    return date_time_format;
+    return date_time_format.ptr();
 }
 
 // 11.2.2 Intl.DateTimeFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.datetimeformat.supportedlocalesof

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp

@@ -52,7 +52,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
     auto options_value = vm.argument(1);
 
     // 2. Let displayNames be ? OrdinaryCreateFromConstructor(NewTarget, "%DisplayNames.prototype%", « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[LanguageDisplay]], [[Fields]] »).
-    auto* display_names = TRY(ordinary_create_from_constructor<DisplayNames>(vm, new_target, &Intrinsics::intl_display_names_prototype));
+    auto display_names = TRY(ordinary_create_from_constructor<DisplayNames>(vm, new_target, &Intrinsics::intl_display_names_prototype));
 
     // 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
     auto requested_locales = TRY(canonicalize_locale_list(vm, locale_value));
@@ -130,7 +130,7 @@ ThrowCompletionOr<Object*> DisplayNamesConstructor::construct(FunctionObject& ne
     // 29. Set displayNames.[[Fields]] to styleFields.
 
     // 30. Return displayNames.
-    return display_names;
+    return display_names.ptr();
 }
 
 // 12.2.2 Intl.DisplayNames.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.DisplayNames.supportedLocalesOf

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp

@@ -50,7 +50,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
     auto options_value = vm.argument(1);
 
     // 2. Let durationFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%DurationFormatPrototype%", « [[InitializedDurationFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[YearsStyle]], [[YearsDisplay]], [[MonthsStyle]], [[MonthsDisplay]] , [[WeeksStyle]], [[WeeksDisplay]] , [[DaysStyle]], [[DaysDisplay]] , [[HoursStyle]], [[HoursDisplay]] , [[MinutesStyle]], [[MinutesDisplay]] , [[SecondsStyle]], [[SecondsDisplay]] , [[MillisecondsStyle]], [[MillisecondsDisplay]] , [[MicrosecondsStyle]], [[MicrosecondsDisplay]] , [[NanosecondsStyle]], [[NanosecondsDisplay]], [[FractionalDigits]] »).
-    auto* duration_format = TRY(ordinary_create_from_constructor<DurationFormat>(vm, new_target, &Intrinsics::intl_duration_format_prototype));
+    auto duration_format = TRY(ordinary_create_from_constructor<DurationFormat>(vm, new_target, &Intrinsics::intl_duration_format_prototype));
 
     // 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
     auto requested_locales = TRY(canonicalize_locale_list(vm, locales));
@@ -138,7 +138,7 @@ ThrowCompletionOr<Object*> DurationFormatConstructor::construct(FunctionObject&
     duration_format->set_fractional_digits(Optional<u8>(TRY(get_number_option(vm, *options, vm.names.fractionalDigits, 0, 9, 0))));
 
     // 19. Return durationFormat.
-    return duration_format;
+    return duration_format.ptr();
 }
 
 // 1.3.2 Intl.DurationFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/proposal-intl-duration-format/#sec-Intl.DurationFormat.supportedLocalesOf

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp

@@ -51,7 +51,7 @@ ThrowCompletionOr<Object*> ListFormatConstructor::construct(FunctionObject& new_
     auto options_value = vm.argument(1);
 
     // 2. Let listFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%ListFormat.prototype%", « [[InitializedListFormat]], [[Locale]], [[Type]], [[Style]], [[Templates]] »).
-    auto* list_format = TRY(ordinary_create_from_constructor<ListFormat>(vm, new_target, &Intrinsics::intl_list_format_prototype));
+    auto list_format = TRY(ordinary_create_from_constructor<ListFormat>(vm, new_target, &Intrinsics::intl_list_format_prototype));
 
     // 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
     auto requested_locales = TRY(canonicalize_locale_list(vm, locale_value));
@@ -91,7 +91,7 @@ ThrowCompletionOr<Object*> ListFormatConstructor::construct(FunctionObject& new_
     // Note: The remaining steps are skipped in favor of deferring to LibUnicode.
 
     // 19. Return listFormat.
-    return list_format;
+    return list_format.ptr();
 }
 
 // 13.2.2 Intl.ListFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.ListFormat.supportedLocalesOf

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp

@@ -258,7 +258,7 @@ ThrowCompletionOr<Object*> LocaleConstructor::construct(FunctionObject& new_targ
     //     a. Append [[Numeric]] as the last element of internalSlotsList.
 
     // 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, "%Locale.prototype%", internalSlotsList).
-    auto* locale = TRY(ordinary_create_from_constructor<Locale>(vm, new_target, &Intrinsics::intl_locale_prototype));
+    auto locale = TRY(ordinary_create_from_constructor<Locale>(vm, new_target, &Intrinsics::intl_locale_prototype));
 
     DeprecatedString tag;
 
@@ -362,7 +362,7 @@ ThrowCompletionOr<Object*> LocaleConstructor::construct(FunctionObject& new_targ
         locale->set_numbering_system(result.nu.release_value());
 
     // 37. Return locale.
-    return locale;
+    return locale.ptr();
 }
 
 }

+ 3 - 3
Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp

@@ -50,17 +50,17 @@ ThrowCompletionOr<Object*> NumberFormatConstructor::construct(FunctionObject& ne
     auto options = vm.argument(1);
 
     // 2. Let numberFormat be ? OrdinaryCreateFromConstructor(newTarget, "%NumberFormat.prototype%", « [[InitializedNumberFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[Unit]], [[UnitDisplay]], [[Currency]], [[CurrencyDisplay]], [[CurrencySign]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]], [[Notation]], [[CompactDisplay]], [[UseGrouping]], [[SignDisplay]], [[BoundFormat]] »).
-    auto* number_format = TRY(ordinary_create_from_constructor<NumberFormat>(vm, new_target, &Intrinsics::intl_number_format_prototype));
+    auto number_format = TRY(ordinary_create_from_constructor<NumberFormat>(vm, new_target, &Intrinsics::intl_number_format_prototype));
 
     // 3. Perform ? InitializeNumberFormat(numberFormat, locales, options).
-    TRY(initialize_number_format(vm, *number_format, locales, options));
+    TRY(initialize_number_format(vm, number_format, locales, options));
 
     // 4. If the implementation supports the normative optional constructor mode of 4.3 Note 1, then
     //     a. Let this be the this value.
     //     b. Return ? ChainNumberFormat(numberFormat, NewTarget, this).
 
     // 5. Return numberFormat.
-    return number_format;
+    return number_format.ptr();
 }
 
 // 15.2.2 Intl.NumberFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.numberformat.supportedlocalesof

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp

@@ -51,10 +51,10 @@ ThrowCompletionOr<Object*> PluralRulesConstructor::construct(FunctionObject& new
     auto options = vm.argument(1);
 
     // 2. Let pluralRules be ? OrdinaryCreateFromConstructor(NewTarget, "%PluralRules.prototype%", « [[InitializedPluralRules]], [[Locale]], [[Type]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]] »).
-    auto* plural_rules = TRY(ordinary_create_from_constructor<PluralRules>(vm, new_target, &Intrinsics::intl_plural_rules_prototype));
+    auto plural_rules = TRY(ordinary_create_from_constructor<PluralRules>(vm, new_target, &Intrinsics::intl_plural_rules_prototype));
 
     // 3. Return ? InitializePluralRules(pluralRules, locales, options).
-    return TRY(initialize_plural_rules(vm, *plural_rules, locales, options));
+    return TRY(initialize_plural_rules(vm, plural_rules, locales, options));
 }
 
 // 16.2.2 Intl.PluralRules.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.pluralrules.supportedlocalesof

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp

@@ -54,10 +54,10 @@ ThrowCompletionOr<Object*> RelativeTimeFormatConstructor::construct(FunctionObje
     auto options = vm.argument(1);
 
     // 2. Let relativeTimeFormat be ? OrdinaryCreateFromConstructor(NewTarget, "%RelativeTimeFormat.prototype%", « [[InitializedRelativeTimeFormat]], [[Locale]], [[DataLocale]], [[Style]], [[Numeric]], [[NumberFormat]], [[NumberingSystem]], [[PluralRules]] »).
-    auto* relative_time_format = TRY(ordinary_create_from_constructor<RelativeTimeFormat>(vm, new_target, &Intrinsics::intl_relative_time_format_prototype));
+    auto relative_time_format = TRY(ordinary_create_from_constructor<RelativeTimeFormat>(vm, new_target, &Intrinsics::intl_relative_time_format_prototype));
 
     // 3. Return ? InitializeRelativeTimeFormat(relativeTimeFormat, locales, options).
-    return TRY(initialize_relative_time_format(vm, *relative_time_format, locales, options));
+    return TRY(initialize_relative_time_format(vm, relative_time_format, locales, options));
 }
 
 // 17.2.2 Intl.RelativeTimeFormat.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-Intl.RelativeTimeFormat.supportedLocalesOf

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp

@@ -51,7 +51,7 @@ ThrowCompletionOr<Object*> SegmenterConstructor::construct(FunctionObject& new_t
 
     // 2. Let internalSlotsList be « [[InitializedSegmenter]], [[Locale]], [[SegmenterGranularity]] ».
     // 3. Let segmenter be ? OrdinaryCreateFromConstructor(NewTarget, "%Segmenter.prototype%", internalSlotsList).
-    auto* segmenter = TRY(ordinary_create_from_constructor<Segmenter>(vm, new_target, &Intrinsics::intl_segmenter_prototype));
+    auto segmenter = TRY(ordinary_create_from_constructor<Segmenter>(vm, new_target, &Intrinsics::intl_segmenter_prototype));
 
     // 4. Let requestedLocales be ? CanonicalizeLocaleList(locales).
     auto requested_locales = TRY(canonicalize_locale_list(vm, locales));
@@ -83,7 +83,7 @@ ThrowCompletionOr<Object*> SegmenterConstructor::construct(FunctionObject& new_t
     segmenter->set_segmenter_granularity(granularity.as_string().deprecated_string());
 
     // 14. Return segmenter.
-    return segmenter;
+    return segmenter.ptr();
 }
 
 // 18.2.2 Intl.Segmenter.supportedLocalesOf ( locales [ , options ] ), https://tc39.es/ecma402/#sec-intl.segmenter.supportedlocalesof

+ 3 - 3
Userland/Libraries/LibJS/Runtime/MapConstructor.cpp

@@ -43,10 +43,10 @@ ThrowCompletionOr<Object*> MapConstructor::construct(FunctionObject& new_target)
 {
     auto& vm = this->vm();
 
-    auto* map = TRY(ordinary_create_from_constructor<Map>(vm, new_target, &Intrinsics::map_prototype));
+    auto map = TRY(ordinary_create_from_constructor<Map>(vm, new_target, &Intrinsics::map_prototype));
 
     if (vm.argument(0).is_nullish())
-        return map;
+        return map.ptr();
 
     auto adder = TRY(map->get(vm.names.set));
     if (!adder.is_function())
@@ -63,7 +63,7 @@ ThrowCompletionOr<Object*> MapConstructor::construct(FunctionObject& new_target)
         return {};
     }));
 
-    return map;
+    return map.ptr();
 }
 
 // 24.1.2.2 get Map [ @@species ], https://tc39.es/ecma262/#sec-get-map-@@species

+ 1 - 1
Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp

@@ -99,7 +99,7 @@ ThrowCompletionOr<Object*> NumberConstructor::construct(FunctionObject& new_targ
     // 4. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%Number.prototype%", « [[NumberData]] »).
     // 5. Set O.[[NumberData]] to n.
     // 6. Return O.
-    return TRY(ordinary_create_from_constructor<NumberObject>(vm, new_target, &Intrinsics::number_prototype, number.as_double()));
+    return TRY(ordinary_create_from_constructor<NumberObject>(vm, new_target, &Intrinsics::number_prototype, number.as_double())).ptr();
 }
 
 // 21.1.2.2 Number.isFinite ( number ), https://tc39.es/ecma262/#sec-number.isfinite

+ 1 - 1
Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp

@@ -70,7 +70,7 @@ ThrowCompletionOr<Object*> ObjectConstructor::construct(FunctionObject& new_targ
     auto& realm = *vm.current_realm();
 
     if (&new_target != this)
-        return TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype, ConstructWithPrototypeTag::Tag));
+        return TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype, ConstructWithPrototypeTag::Tag)).ptr();
     auto value = vm.argument(0);
     if (value.is_nullish())
         return Object::create(realm, realm.intrinsics().object_prototype()).ptr();

+ 1 - 1
Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp

@@ -305,7 +305,7 @@ ThrowCompletionOr<Object*> PromiseConstructor::construct(FunctionObject& new_tar
     }
 
     // 11. Return promise.
-    return promise;
+    return promise.ptr();
 }
 
 // 27.2.4.1 Promise.all ( iterable ), https://tc39.es/ecma262/#sec-promise.all

+ 2 - 2
Userland/Libraries/LibJS/Runtime/RegExpObject.cpp

@@ -263,7 +263,7 @@ ThrowCompletionOr<NonnullGCPtr<RegExpObject>> regexp_create(VM& vm, Value patter
 ThrowCompletionOr<NonnullGCPtr<RegExpObject>> regexp_alloc(VM& vm, FunctionObject& new_target)
 {
     // 1. Let obj be ? OrdinaryCreateFromConstructor(newTarget, "%RegExp.prototype%", « [[OriginalSource]], [[OriginalFlags]], [[RegExpRecord]], [[RegExpMatcher]] »).
-    auto* regexp_object = TRY(ordinary_create_from_constructor<RegExpObject>(vm, new_target, &Intrinsics::regexp_prototype));
+    auto regexp_object = TRY(ordinary_create_from_constructor<RegExpObject>(vm, new_target, &Intrinsics::regexp_prototype));
 
     // 2. Let thisRealm be the current Realm Record.
     auto& this_realm = *vm.current_realm();
@@ -287,7 +287,7 @@ ThrowCompletionOr<NonnullGCPtr<RegExpObject>> regexp_alloc(VM& vm, FunctionObjec
     MUST(regexp_object->define_property_or_throw(vm.names.lastIndex, PropertyDescriptor { .writable = true, .enumerable = false, .configurable = false }));
 
     // 7. Return obj.
-    return NonnullGCPtr { *regexp_object };
+    return regexp_object;
 }
 
 }

+ 3 - 3
Userland/Libraries/LibJS/Runtime/SetConstructor.cpp

@@ -43,10 +43,10 @@ ThrowCompletionOr<Object*> SetConstructor::construct(FunctionObject& new_target)
 {
     auto& vm = this->vm();
 
-    auto* set = TRY(ordinary_create_from_constructor<Set>(vm, new_target, &Intrinsics::set_prototype));
+    auto set = TRY(ordinary_create_from_constructor<Set>(vm, new_target, &Intrinsics::set_prototype));
 
     if (vm.argument(0).is_nullish())
-        return set;
+        return set.ptr();
 
     auto adder = TRY(set->get(vm.names.add));
     if (!adder.is_function())
@@ -57,7 +57,7 @@ ThrowCompletionOr<Object*> SetConstructor::construct(FunctionObject& new_target)
         return {};
     }));
 
-    return set;
+    return set.ptr();
 }
 
 // 24.2.2.2 get Set [ @@species ], https://tc39.es/ecma262/#sec-get-set-@@species

+ 2 - 2
Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp

@@ -59,7 +59,7 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
     // 2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%", « [[ShadowRealm]], [[ExecutionContext]] »).
     // 4. Set O.[[ShadowRealm]] to realmRec.
     // 9. Set O.[[ExecutionContext]] to context.
-    auto* object = TRY(ordinary_create_from_constructor<ShadowRealm>(vm, new_target, &Intrinsics::shadow_realm_prototype, *realm, move(context)));
+    auto object = TRY(ordinary_create_from_constructor<ShadowRealm>(vm, new_target, &Intrinsics::shadow_realm_prototype, *realm, move(context)));
 
     // 10. Perform ? SetRealmGlobalObject(realmRec, undefined, undefined).
     realm->set_global_object(nullptr, nullptr);
@@ -71,7 +71,7 @@ ThrowCompletionOr<Object*> ShadowRealmConstructor::construct(FunctionObject& new
     global_object.initialize(object->shadow_realm());
 
     // 13. Return O.
-    return object;
+    return object.ptr();
 }
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp

@@ -78,10 +78,10 @@ ThrowCompletionOr<Calendar*> create_temporal_calendar(VM& vm, DeprecatedString c
 
     // 3. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.Calendar.prototype%", « [[InitializedTemporalCalendar]], [[Identifier]] »).
     // 4. Set object.[[Identifier]] to the ASCII-lowercase of identifier.
-    auto* object = TRY(ordinary_create_from_constructor<Calendar>(vm, *new_target, &Intrinsics::temporal_calendar_prototype, identifier.to_lowercase()));
+    auto object = TRY(ordinary_create_from_constructor<Calendar>(vm, *new_target, &Intrinsics::temporal_calendar_prototype, identifier.to_lowercase()));
 
     // 5. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 12.2.2 GetBuiltinCalendar ( id ), https://tc39.es/proposal-temporal/#sec-temporal-getbuiltincalendar

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp

@@ -413,10 +413,10 @@ ThrowCompletionOr<Duration*> create_temporal_duration(VM& vm, double years, doub
     // 11. Set object.[[Milliseconds]] to ℝ(𝔽(milliseconds)).
     // 12. Set object.[[Microseconds]] to ℝ(𝔽(microseconds)).
     // 13. Set object.[[Nanoseconds]] to ℝ(𝔽(nanoseconds)).
-    auto* object = TRY(ordinary_create_from_constructor<Duration>(vm, *new_target, &Intrinsics::temporal_duration_prototype, years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds));
+    auto object = TRY(ordinary_create_from_constructor<Duration>(vm, *new_target, &Intrinsics::temporal_duration_prototype, years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds));
 
     // 14. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 7.5.15 CreateNegatedTemporalDuration ( duration ), https://tc39.es/proposal-temporal/#sec-temporal-createnegatedtemporalduration

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/Instant.cpp

@@ -73,10 +73,10 @@ ThrowCompletionOr<Instant*> create_temporal_instant(VM& vm, BigInt const& epoch_
 
     // 4. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.Instant.prototype%", « [[InitializedTemporalInstant]], [[Nanoseconds]] »).
     // 5. Set object.[[Nanoseconds]] to epochNanoseconds.
-    auto* object = TRY(ordinary_create_from_constructor<Instant>(vm, *new_target, &Intrinsics::temporal_instant_prototype, epoch_nanoseconds));
+    auto object = TRY(ordinary_create_from_constructor<Instant>(vm, *new_target, &Intrinsics::temporal_instant_prototype, epoch_nanoseconds));
 
     // 6. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 8.5.3 ToTemporalInstant ( item ), https://tc39.es/proposal-temporal/#sec-temporal-totemporalinstant

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.cpp

@@ -75,9 +75,9 @@ ThrowCompletionOr<PlainDate*> create_temporal_date(VM& vm, i32 iso_year, u8 iso_
     // 10. Set object.[[ISOMonth]] to isoMonth.
     // 11. Set object.[[ISODay]] to isoDay.
     // 12. Set object.[[Calendar]] to calendar.
-    auto* object = TRY(ordinary_create_from_constructor<PlainDate>(vm, *new_target, &Intrinsics::temporal_plain_date_prototype, iso_year, iso_month, iso_day, calendar));
+    auto object = TRY(ordinary_create_from_constructor<PlainDate>(vm, *new_target, &Intrinsics::temporal_plain_date_prototype, iso_year, iso_month, iso_day, calendar));
 
-    return object;
+    return object.ptr();
 }
 
 // 3.5.2 ToTemporalDate ( item [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaldate

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTime.cpp

@@ -240,10 +240,10 @@ ThrowCompletionOr<PlainDateTime*> create_temporal_date_time(VM& vm, i32 iso_year
     // 15. Set object.[[ISOMicrosecond]] to microsecond.
     // 16. Set object.[[ISONanosecond]] to nanosecond.
     // 17. Set object.[[Calendar]] to calendar.
-    auto* object = TRY(ordinary_create_from_constructor<PlainDateTime>(vm, *new_target, &Intrinsics::temporal_plain_date_prototype, iso_year, iso_month, iso_day, hour, minute, second, millisecond, microsecond, nanosecond, calendar));
+    auto object = TRY(ordinary_create_from_constructor<PlainDateTime>(vm, *new_target, &Intrinsics::temporal_plain_date_prototype, iso_year, iso_month, iso_day, hour, minute, second, millisecond, microsecond, nanosecond, calendar));
 
     // 18. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 5.5.6 TemporalDateTimeToString ( isoYear, isoMonth, isoDay, hour, minute, second, millisecond, microsecond, nanosecond, calendar, precision, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-temporaldatetimetostring

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDay.cpp

@@ -167,10 +167,10 @@ ThrowCompletionOr<PlainMonthDay*> create_temporal_month_day(VM& vm, u8 iso_month
     // 8. Set object.[[ISODay]] to isoDay.
     // 9. Set object.[[Calendar]] to calendar.
     // 10. Set object.[[ISOYear]] to referenceISOYear.
-    auto* object = TRY(ordinary_create_from_constructor<PlainMonthDay>(vm, *new_target, &Intrinsics::temporal_plain_month_day_prototype, iso_month, iso_day, reference_iso_year, calendar));
+    auto object = TRY(ordinary_create_from_constructor<PlainMonthDay>(vm, *new_target, &Intrinsics::temporal_plain_month_day_prototype, iso_month, iso_day, reference_iso_year, calendar));
 
     // 11. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 10.5.3 TemporalMonthDayToString ( monthDay, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-temporalmonthdaytostring

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp

@@ -331,10 +331,10 @@ ThrowCompletionOr<PlainTime*> create_temporal_time(VM& vm, u8 hour, u8 minute, u
     // 9. Set object.[[ISOMicrosecond]] to microsecond.
     // 10. Set object.[[ISONanosecond]] to nanosecond.
     // 11. Set object.[[Calendar]] to ! GetISO8601Calendar().
-    auto* object = TRY(ordinary_create_from_constructor<PlainTime>(vm, *new_target, &Intrinsics::temporal_plain_time_prototype, hour, minute, second, millisecond, microsecond, nanosecond, *get_iso8601_calendar(vm)));
+    auto object = TRY(ordinary_create_from_constructor<PlainTime>(vm, *new_target, &Intrinsics::temporal_plain_time_prototype, hour, minute, second, millisecond, microsecond, nanosecond, *get_iso8601_calendar(vm)));
 
     // 12. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 4.5.8 ToTemporalTimeRecord ( temporalTimeLike [ , completeness ] ), https://tc39.es/proposal-temporal/#sec-temporal-totemporaltimerecord

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp

@@ -194,10 +194,10 @@ ThrowCompletionOr<PlainYearMonth*> create_temporal_year_month(VM& vm, i32 iso_ye
     // 8. Set object.[[ISOMonth]] to isoMonth.
     // 9. Set object.[[Calendar]] to calendar.
     // 10. Set object.[[ISODay]] to referenceISODay.
-    auto* object = TRY(ordinary_create_from_constructor<PlainYearMonth>(vm, *new_target, &Intrinsics::temporal_plain_year_month_prototype, iso_year, iso_month, reference_iso_day, calendar));
+    auto object = TRY(ordinary_create_from_constructor<PlainYearMonth>(vm, *new_target, &Intrinsics::temporal_plain_year_month_prototype, iso_year, iso_month, reference_iso_day, calendar));
 
     // 11. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 9.5.6 TemporalYearMonthToString ( yearMonth, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-temporalyearmonthtostring

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp

@@ -66,7 +66,7 @@ ThrowCompletionOr<TimeZone*> create_temporal_time_zone(VM& vm, DeprecatedString
         new_target = realm.intrinsics().temporal_time_zone_constructor();
 
     // 2. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.TimeZone.prototype%", « [[InitializedTemporalTimeZone]], [[Identifier]], [[OffsetNanoseconds]] »).
-    auto* object = TRY(ordinary_create_from_constructor<TimeZone>(vm, *new_target, &Intrinsics::temporal_time_zone_prototype));
+    auto object = TRY(ordinary_create_from_constructor<TimeZone>(vm, *new_target, &Intrinsics::temporal_time_zone_prototype));
 
     // 3. If IsTimeZoneOffsetString(identifier) is true, then
     if (is_time_zone_offset_string(identifier)) {
@@ -92,7 +92,7 @@ ThrowCompletionOr<TimeZone*> create_temporal_time_zone(VM& vm, DeprecatedString
     }
 
     // 5. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 11.6.2 GetISOPartsFromEpoch ( epochNanoseconds ), https://tc39.es/proposal-temporal/#sec-temporal-getisopartsfromepoch

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp

@@ -277,10 +277,10 @@ ThrowCompletionOr<ZonedDateTime*> create_temporal_zoned_date_time(VM& vm, BigInt
     // 4. Set object.[[Nanoseconds]] to epochNanoseconds.
     // 5. Set object.[[TimeZone]] to timeZone.
     // 6. Set object.[[Calendar]] to calendar.
-    auto* object = TRY(ordinary_create_from_constructor<ZonedDateTime>(vm, *new_target, &Intrinsics::temporal_time_zone_prototype, epoch_nanoseconds, time_zone, calendar));
+    auto object = TRY(ordinary_create_from_constructor<ZonedDateTime>(vm, *new_target, &Intrinsics::temporal_time_zone_prototype, epoch_nanoseconds, time_zone, calendar));
 
     // 7. Return object.
-    return object;
+    return object.ptr();
 }
 
 // 6.5.4 TemporalZonedDateTimeToString ( zonedDateTime, precision, showCalendar, showTimeZone, showOffset [ , increment, unit, roundingMode ] ), https://tc39.es/proposal-temporal/#sec-temporal-temporalzoneddatetimetostring

+ 3 - 3
Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp

@@ -41,10 +41,10 @@ ThrowCompletionOr<Object*> WeakMapConstructor::construct(FunctionObject& new_tar
 {
     auto& vm = this->vm();
 
-    auto* weak_map = TRY(ordinary_create_from_constructor<WeakMap>(vm, new_target, &Intrinsics::weak_map_prototype));
+    auto weak_map = TRY(ordinary_create_from_constructor<WeakMap>(vm, new_target, &Intrinsics::weak_map_prototype));
 
     if (vm.argument(0).is_nullish())
-        return weak_map;
+        return weak_map.ptr();
 
     auto adder = TRY(weak_map->get(vm.names.set));
     if (!adder.is_function())
@@ -61,7 +61,7 @@ ThrowCompletionOr<Object*> WeakMapConstructor::construct(FunctionObject& new_tar
         return {};
     }));
 
-    return weak_map;
+    return weak_map.ptr();
 }
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp

@@ -45,9 +45,9 @@ ThrowCompletionOr<Object*> WeakRefConstructor::construct(FunctionObject& new_tar
         return vm.throw_completion<TypeError>(ErrorType::CannotBeHeldWeakly, target.to_string_without_side_effects());
 
     if (target.is_object())
-        return TRY(ordinary_create_from_constructor<WeakRef>(vm, new_target, &Intrinsics::weak_ref_prototype, target.as_object()));
+        return TRY(ordinary_create_from_constructor<WeakRef>(vm, new_target, &Intrinsics::weak_ref_prototype, target.as_object())).ptr();
     VERIFY(target.is_symbol());
-    return TRY(ordinary_create_from_constructor<WeakRef>(vm, new_target, &Intrinsics::weak_ref_prototype, target.as_symbol()));
+    return TRY(ordinary_create_from_constructor<WeakRef>(vm, new_target, &Intrinsics::weak_ref_prototype, target.as_symbol())).ptr();
 }
 
 }

+ 3 - 3
Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp

@@ -41,10 +41,10 @@ ThrowCompletionOr<Object*> WeakSetConstructor::construct(FunctionObject& new_tar
 {
     auto& vm = this->vm();
 
-    auto* weak_set = TRY(ordinary_create_from_constructor<WeakSet>(vm, new_target, &Intrinsics::weak_set_prototype));
+    auto weak_set = TRY(ordinary_create_from_constructor<WeakSet>(vm, new_target, &Intrinsics::weak_set_prototype));
 
     if (vm.argument(0).is_nullish())
-        return weak_set;
+        return weak_set.ptr();
 
     auto adder = TRY(weak_set->get(vm.names.add));
     if (!adder.is_function())
@@ -55,7 +55,7 @@ ThrowCompletionOr<Object*> WeakSetConstructor::construct(FunctionObject& new_tar
         return {};
     }));
 
-    return weak_set;
+    return weak_set.ptr();
 }
 
 }