瀏覽代碼

LibJS: Do not invoke Cell::vm in constructors before Cell is constructed

In a subclass of Cell, we cannot use Cell::vm() before the base Cell
object itself is constructed. Use the Realm's VM instead.

This was caught by UBSAN with vptr sanitation enabled.
Timothy Flynn 2 年之前
父節點
當前提交
85e313077a
共有 46 個文件被更改,包括 97 次插入97 次删除
  1. 1 1
      Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.cpp
  2. 1 1
      Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp
  3. 1 1
      Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.cpp
  4. 1 1
      Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.cpp
  5. 1 1
      Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp
  6. 1 1
      Userland/Libraries/LibJS/Runtime/BooleanConstructor.cpp
  7. 1 1
      Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp
  8. 1 1
      Userland/Libraries/LibJS/Runtime/DateConstructor.cpp
  9. 52 52
      Userland/Libraries/LibJS/Runtime/ErrorConstructor.cpp
  10. 1 1
      Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp
  11. 1 1
      Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
  12. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.cpp
  13. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.cpp
  14. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.cpp
  15. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.cpp
  16. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.cpp
  17. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.cpp
  18. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp
  19. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.cpp
  20. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.cpp
  21. 1 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.cpp
  22. 1 1
      Userland/Libraries/LibJS/Runtime/MapConstructor.cpp
  23. 1 1
      Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
  24. 1 1
      Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
  25. 1 1
      Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp
  26. 1 1
      Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp
  27. 1 1
      Userland/Libraries/LibJS/Runtime/RegExpConstructor.cpp
  28. 1 1
      Userland/Libraries/LibJS/Runtime/SetConstructor.cpp
  29. 1 1
      Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp
  30. 1 1
      Userland/Libraries/LibJS/Runtime/StringConstructor.cpp
  31. 1 1
      Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp
  32. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp
  33. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp
  34. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp
  35. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp
  36. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp
  37. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp
  38. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp
  39. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp
  40. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp
  41. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp
  42. 1 1
      Userland/Libraries/LibJS/Runtime/TypedArray.cpp
  43. 1 1
      Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp
  44. 1 1
      Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp
  45. 1 1
      Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp
  46. 1 1
      Userland/Libraries/LibJS/Runtime/WeakSetConstructor.cpp

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 ArrayBufferConstructor::ArrayBufferConstructor(Realm& realm)
 ArrayBufferConstructor::ArrayBufferConstructor(Realm& realm)
-    : NativeFunction(vm().names.ArrayBuffer.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.ArrayBuffer.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -17,7 +17,7 @@
 namespace JS {
 namespace JS {
 
 
 ArrayConstructor::ArrayConstructor(Realm& realm)
 ArrayConstructor::ArrayConstructor(Realm& realm)
-    : NativeFunction(vm().names.Array.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Array.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -13,7 +13,7 @@
 namespace JS {
 namespace JS {
 
 
 AsyncFunctionConstructor::AsyncFunctionConstructor(Realm& realm)
 AsyncFunctionConstructor::AsyncFunctionConstructor(Realm& realm)
-    : NativeFunction(vm().names.AsyncFunction.as_string(), *realm.intrinsics().function_constructor())
+    : NativeFunction(realm.vm().names.AsyncFunction.as_string(), *realm.intrinsics().function_constructor())
 {
 {
 }
 }
 
 

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

@@ -13,7 +13,7 @@
 namespace JS {
 namespace JS {
 
 
 AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(Realm& realm)
 AsyncGeneratorFunctionConstructor::AsyncGeneratorFunctionConstructor(Realm& realm)
-    : NativeFunction(vm().names.AsyncGeneratorFunction.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.AsyncGeneratorFunction.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -18,7 +18,7 @@ namespace JS {
 static const Crypto::SignedBigInteger BIGINT_ONE { 1 };
 static const Crypto::SignedBigInteger BIGINT_ONE { 1 };
 
 
 BigIntConstructor::BigIntConstructor(Realm& realm)
 BigIntConstructor::BigIntConstructor(Realm& realm)
-    : NativeFunction(vm().names.BigInt.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.BigInt.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -12,7 +12,7 @@
 namespace JS {
 namespace JS {
 
 
 BooleanConstructor::BooleanConstructor(Realm& realm)
 BooleanConstructor::BooleanConstructor(Realm& realm)
-    : NativeFunction(vm().names.Boolean.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Boolean.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 DataViewConstructor::DataViewConstructor(Realm& realm)
 DataViewConstructor::DataViewConstructor(Realm& realm)
-    : NativeFunction(vm().names.DataView.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.DataView.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -163,7 +163,7 @@ static double parse_date_string(String const& date_string)
 }
 }
 
 
 DateConstructor::DateConstructor(Realm& realm)
 DateConstructor::DateConstructor(Realm& realm)
-    : NativeFunction(vm().names.Date.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Date.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -12,7 +12,7 @@
 namespace JS {
 namespace JS {
 
 
 ErrorConstructor::ErrorConstructor(Realm& realm)
 ErrorConstructor::ErrorConstructor(Realm& realm)
-    : NativeFunction(vm().names.Error.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Error.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 
@@ -61,57 +61,57 @@ ThrowCompletionOr<Object*> ErrorConstructor::construct(FunctionObject& new_targe
     return error;
     return error;
 }
 }
 
 
-#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType)                                     \
-    ConstructorName::ConstructorName(Realm& realm)                                                                           \
-        : NativeFunction(vm().names.ClassName.as_string(), *static_cast<Object*>(realm.intrinsics().error_constructor()))    \
-    {                                                                                                                        \
-    }                                                                                                                        \
-                                                                                                                             \
-    void ConstructorName::initialize(Realm& realm)                                                                           \
-    {                                                                                                                        \
-        auto& vm = this->vm();                                                                                               \
-        NativeFunction::initialize(realm);                                                                                   \
-                                                                                                                             \
-        /* 20.5.6.2.1 NativeError.prototype, https://tc39.es/ecma262/#sec-nativeerror.prototype */                           \
-        define_direct_property(vm.names.prototype, realm.intrinsics().snake_name##_prototype(), 0);                          \
-                                                                                                                             \
-        define_direct_property(vm.names.length, Value(1), Attribute::Configurable);                                          \
-    }                                                                                                                        \
-                                                                                                                             \
-    ConstructorName::~ConstructorName() = default;                                                                           \
-                                                                                                                             \
-    /* 20.5.6.1.1 NativeError ( message [ , options ] ), https://tc39.es/ecma262/#sec-nativeerror */                         \
-    ThrowCompletionOr<Value> ConstructorName::call()                                                                         \
-    {                                                                                                                        \
-        /* 1. If NewTarget is undefined, let newTarget be the active function object; else let newTarget be NewTarget. */    \
-        return TRY(construct(*this));                                                                                        \
-    }                                                                                                                        \
-                                                                                                                             \
-    /* 20.5.6.1.1 NativeError ( message [ , options ] ), https://tc39.es/ecma262/#sec-nativeerror */                         \
-    ThrowCompletionOr<Object*> ConstructorName::construct(FunctionObject& new_target)                                        \
-    {                                                                                                                        \
-        auto& vm = this->vm();                                                                                               \
-                                                                                                                             \
-        auto message = vm.argument(0);                                                                                       \
-        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)); \
-                                                                                                                             \
-        /* 3. If message is not undefined, then */                                                                           \
-        if (!message.is_undefined()) {                                                                                       \
-            /* a. Let msg be ? ToString(message). */                                                                         \
-            auto msg = TRY(message.to_string(vm));                                                                           \
-                                                                                                                             \
-            /* b. Perform CreateNonEnumerableDataPropertyOrThrow(O, "message", msg). */                                      \
-            error->create_non_enumerable_data_property_or_throw(vm.names.message, js_string(vm, move(msg)));                 \
-        }                                                                                                                    \
-                                                                                                                             \
-        /* 4. Perform ? InstallErrorCause(O, options). */                                                                    \
-        TRY(error->install_error_cause(options));                                                                            \
-                                                                                                                             \
-        /* 5. Return O. */                                                                                                   \
-        return error;                                                                                                        \
+#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType)                                        \
+    ConstructorName::ConstructorName(Realm& realm)                                                                              \
+        : NativeFunction(realm.vm().names.ClassName.as_string(), *static_cast<Object*>(realm.intrinsics().error_constructor())) \
+    {                                                                                                                           \
+    }                                                                                                                           \
+                                                                                                                                \
+    void ConstructorName::initialize(Realm& realm)                                                                              \
+    {                                                                                                                           \
+        auto& vm = this->vm();                                                                                                  \
+        NativeFunction::initialize(realm);                                                                                      \
+                                                                                                                                \
+        /* 20.5.6.2.1 NativeError.prototype, https://tc39.es/ecma262/#sec-nativeerror.prototype */                              \
+        define_direct_property(vm.names.prototype, realm.intrinsics().snake_name##_prototype(), 0);                             \
+                                                                                                                                \
+        define_direct_property(vm.names.length, Value(1), Attribute::Configurable);                                             \
+    }                                                                                                                           \
+                                                                                                                                \
+    ConstructorName::~ConstructorName() = default;                                                                              \
+                                                                                                                                \
+    /* 20.5.6.1.1 NativeError ( message [ , options ] ), https://tc39.es/ecma262/#sec-nativeerror */                            \
+    ThrowCompletionOr<Value> ConstructorName::call()                                                                            \
+    {                                                                                                                           \
+        /* 1. If NewTarget is undefined, let newTarget be the active function object; else let newTarget be NewTarget. */       \
+        return TRY(construct(*this));                                                                                           \
+    }                                                                                                                           \
+                                                                                                                                \
+    /* 20.5.6.1.1 NativeError ( message [ , options ] ), https://tc39.es/ecma262/#sec-nativeerror */                            \
+    ThrowCompletionOr<Object*> ConstructorName::construct(FunctionObject& new_target)                                           \
+    {                                                                                                                           \
+        auto& vm = this->vm();                                                                                                  \
+                                                                                                                                \
+        auto message = vm.argument(0);                                                                                          \
+        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));    \
+                                                                                                                                \
+        /* 3. If message is not undefined, then */                                                                              \
+        if (!message.is_undefined()) {                                                                                          \
+            /* a. Let msg be ? ToString(message). */                                                                            \
+            auto msg = TRY(message.to_string(vm));                                                                              \
+                                                                                                                                \
+            /* b. Perform CreateNonEnumerableDataPropertyOrThrow(O, "message", msg). */                                         \
+            error->create_non_enumerable_data_property_or_throw(vm.names.message, js_string(vm, move(msg)));                    \
+        }                                                                                                                       \
+                                                                                                                                \
+        /* 4. Perform ? InstallErrorCause(O, options). */                                                                       \
+        TRY(error->install_error_cause(options));                                                                               \
+                                                                                                                                \
+        /* 5. Return O. */                                                                                                      \
+        return error;                                                                                                           \
     }
     }
 
 
 JS_ENUMERATE_NATIVE_ERRORS
 JS_ENUMERATE_NATIVE_ERRORS

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 FinalizationRegistryConstructor::FinalizationRegistryConstructor(Realm& realm)
 FinalizationRegistryConstructor::FinalizationRegistryConstructor(Realm& realm)
-    : NativeFunction(vm().names.FinalizationRegistry.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.FinalizationRegistry.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -20,7 +20,7 @@
 namespace JS {
 namespace JS {
 
 
 FunctionConstructor::FunctionConstructor(Realm& realm)
 FunctionConstructor::FunctionConstructor(Realm& realm)
-    : NativeFunction(vm().names.Function.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Function.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -131,7 +131,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
 
 
 // 10.1 The Intl.Collator Constructor, https://tc39.es/ecma402/#sec-the-intl-collator-constructor
 // 10.1 The Intl.Collator Constructor, https://tc39.es/ecma402/#sec-the-intl-collator-constructor
 CollatorConstructor::CollatorConstructor(Realm& realm)
 CollatorConstructor::CollatorConstructor(Realm& realm)
-    : NativeFunction(vm().names.Collator.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Collator.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -18,7 +18,7 @@ namespace JS::Intl {
 
 
 // 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor
 // 11.1 The Intl.DateTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor
 DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
 DateTimeFormatConstructor::DateTimeFormatConstructor(Realm& realm)
-    : NativeFunction(vm().names.DateTimeFormat.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.DateTimeFormat.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -17,7 +17,7 @@ namespace JS::Intl {
 
 
 // 12.1 The Intl.DisplayNames Constructor, https://tc39.es/ecma402/#sec-intl-displaynames-constructor
 // 12.1 The Intl.DisplayNames Constructor, https://tc39.es/ecma402/#sec-intl-displaynames-constructor
 DisplayNamesConstructor::DisplayNamesConstructor(Realm& realm)
 DisplayNamesConstructor::DisplayNamesConstructor(Realm& realm)
-    : NativeFunction(vm().names.DisplayNames.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.DisplayNames.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -16,7 +16,7 @@ namespace JS::Intl {
 
 
 // 1.2 The Intl.DurationFormat Constructor, https://tc39.es/proposal-intl-duration-format/#sec-intl-durationformat-constructor
 // 1.2 The Intl.DurationFormat Constructor, https://tc39.es/proposal-intl-duration-format/#sec-intl-durationformat-constructor
 DurationFormatConstructor::DurationFormatConstructor(Realm& realm)
 DurationFormatConstructor::DurationFormatConstructor(Realm& realm)
-    : NativeFunction(vm().names.DurationFormat.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.DurationFormat.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -16,7 +16,7 @@ namespace JS::Intl {
 
 
 // 13.1 The Intl.ListFormat Constructor, https://tc39.es/ecma402/#sec-intl-listformat-constructor
 // 13.1 The Intl.ListFormat Constructor, https://tc39.es/ecma402/#sec-intl-listformat-constructor
 ListFormatConstructor::ListFormatConstructor(Realm& realm)
 ListFormatConstructor::ListFormatConstructor(Realm& realm)
-    : NativeFunction(vm().names.ListFormat.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.ListFormat.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -217,7 +217,7 @@ static LocaleAndKeys apply_unicode_extension_to_tag(StringView tag, LocaleAndKey
 
 
 // 14.1 The Intl.Locale Constructor, https://tc39.es/ecma402/#sec-intl-locale-constructor
 // 14.1 The Intl.Locale Constructor, https://tc39.es/ecma402/#sec-intl-locale-constructor
 LocaleConstructor::LocaleConstructor(Realm& realm)
 LocaleConstructor::LocaleConstructor(Realm& realm)
-    : NativeFunction(vm().names.Locale.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Locale.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -15,7 +15,7 @@ namespace JS::Intl {
 
 
 // 15.1 The Intl.NumberFormat Constructor, https://tc39.es/ecma402/#sec-intl-numberformat-constructor
 // 15.1 The Intl.NumberFormat Constructor, https://tc39.es/ecma402/#sec-intl-numberformat-constructor
 NumberFormatConstructor::NumberFormatConstructor(Realm& realm)
 NumberFormatConstructor::NumberFormatConstructor(Realm& realm)
-    : NativeFunction(vm().names.NumberFormat.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.NumberFormat.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -17,7 +17,7 @@ namespace JS::Intl {
 
 
 // 16.1 The Intl.PluralRules Constructor, https://tc39.es/ecma402/#sec-intl-pluralrules-constructor
 // 16.1 The Intl.PluralRules Constructor, https://tc39.es/ecma402/#sec-intl-pluralrules-constructor
 PluralRulesConstructor::PluralRulesConstructor(Realm& realm)
 PluralRulesConstructor::PluralRulesConstructor(Realm& realm)
-    : NativeFunction(vm().names.PluralRules.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.PluralRules.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -20,7 +20,7 @@ namespace JS::Intl {
 
 
 // 17.1 The Intl.RelativeTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor
 // 17.1 The Intl.RelativeTimeFormat Constructor, https://tc39.es/ecma402/#sec-intl-relativetimeformat-constructor
 RelativeTimeFormatConstructor::RelativeTimeFormatConstructor(Realm& realm)
 RelativeTimeFormatConstructor::RelativeTimeFormatConstructor(Realm& realm)
-    : NativeFunction(vm().names.RelativeTimeFormat.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.RelativeTimeFormat.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -16,7 +16,7 @@ namespace JS::Intl {
 
 
 // 18.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructor
 // 18.1 The Intl.Segmenter Constructor, https://tc39.es/ecma402/#sec-intl-segmenter-constructor
 SegmenterConstructor::SegmenterConstructor(Realm& realm)
 SegmenterConstructor::SegmenterConstructor(Realm& realm)
-    : NativeFunction(vm().names.Segmenter.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Segmenter.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 MapConstructor::MapConstructor(Realm& realm)
 MapConstructor::MapConstructor(Realm& realm)
-    : NativeFunction(vm().names.Map.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Map.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -24,7 +24,7 @@ constexpr double const MIN_SAFE_INTEGER_VALUE { -(__builtin_exp2(53) - 1) };
 namespace JS {
 namespace JS {
 
 
 NumberConstructor::NumberConstructor(Realm& realm)
 NumberConstructor::NumberConstructor(Realm& realm)
-    : NativeFunction(vm().names.Number.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Number.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -18,7 +18,7 @@
 namespace JS {
 namespace JS {
 
 
 ObjectConstructor::ObjectConstructor(Realm& realm)
 ObjectConstructor::ObjectConstructor(Realm& realm)
-    : NativeFunction(vm().names.Object.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Object.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -240,7 +240,7 @@ static ThrowCompletionOr<Value> perform_promise_race(VM& vm, Iterator& iterator_
 }
 }
 
 
 PromiseConstructor::PromiseConstructor(Realm& realm)
 PromiseConstructor::PromiseConstructor(Realm& realm)
-    : NativeFunction(vm().names.Promise.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Promise.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -25,7 +25,7 @@ static ThrowCompletionOr<ProxyObject*> proxy_create(VM& vm, Value target, Value
 }
 }
 
 
 ProxyConstructor::ProxyConstructor(Realm& realm)
 ProxyConstructor::ProxyConstructor(Realm& realm)
-    : NativeFunction(vm().names.Proxy.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Proxy.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -12,7 +12,7 @@
 namespace JS {
 namespace JS {
 
 
 RegExpConstructor::RegExpConstructor(Realm& realm)
 RegExpConstructor::RegExpConstructor(Realm& realm)
-    : NativeFunction(vm().names.RegExp.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.RegExp.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 SetConstructor::SetConstructor(Realm& realm)
 SetConstructor::SetConstructor(Realm& realm)
-    : NativeFunction(vm().names.Set.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Set.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -12,7 +12,7 @@ namespace JS {
 
 
 // 3.2 The ShadowRealm Constructor, https://tc39.es/proposal-shadowrealm/#sec-shadowrealm-constructor
 // 3.2 The ShadowRealm Constructor, https://tc39.es/proposal-shadowrealm/#sec-shadowrealm-constructor
 ShadowRealmConstructor::ShadowRealmConstructor(Realm& realm)
 ShadowRealmConstructor::ShadowRealmConstructor(Realm& realm)
-    : NativeFunction(vm().names.ShadowRealm.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.ShadowRealm.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -18,7 +18,7 @@
 namespace JS {
 namespace JS {
 
 
 StringConstructor::StringConstructor(Realm& realm)
 StringConstructor::StringConstructor(Realm& realm)
-    : NativeFunction(vm().names.String.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.String.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -11,7 +11,7 @@
 namespace JS {
 namespace JS {
 
 
 SymbolConstructor::SymbolConstructor(Realm& realm)
 SymbolConstructor::SymbolConstructor(Realm& realm)
-    : NativeFunction(vm().names.Symbol.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Symbol.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/CalendarConstructor.cpp

@@ -12,7 +12,7 @@ namespace JS::Temporal {
 
 
 // 12.2 The Temporal.Calendar Constructor, https://tc39.es/proposal-temporal/#sec-temporal-calendar-constructor
 // 12.2 The Temporal.Calendar Constructor, https://tc39.es/proposal-temporal/#sec-temporal-calendar-constructor
 CalendarConstructor::CalendarConstructor(Realm& realm)
 CalendarConstructor::CalendarConstructor(Realm& realm)
-    : NativeFunction(vm().names.Calendar.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Calendar.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/DurationConstructor.cpp

@@ -15,7 +15,7 @@ namespace JS::Temporal {
 
 
 // 7.1 The Temporal.Duration Constructor, https://tc39.es/proposal-temporal/#sec-temporal-duration-constructor
 // 7.1 The Temporal.Duration Constructor, https://tc39.es/proposal-temporal/#sec-temporal-duration-constructor
 DurationConstructor::DurationConstructor(Realm& realm)
 DurationConstructor::DurationConstructor(Realm& realm)
-    : NativeFunction(vm().names.Duration.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Duration.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/InstantConstructor.cpp

@@ -14,7 +14,7 @@ namespace JS::Temporal {
 
 
 // 8.1 The Temporal.Instant Constructor, https://tc39.es/proposal-temporal/#sec-temporal-instant-constructor
 // 8.1 The Temporal.Instant Constructor, https://tc39.es/proposal-temporal/#sec-temporal-instant-constructor
 InstantConstructor::InstantConstructor(Realm& realm)
 InstantConstructor::InstantConstructor(Realm& realm)
-    : NativeFunction(vm().names.Instant.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.Instant.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/PlainDateConstructor.cpp

@@ -16,7 +16,7 @@ namespace JS::Temporal {
 
 
 // 3.1 The Temporal.PlainDate Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-constructor
 // 3.1 The Temporal.PlainDate Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindate-constructor
 PlainDateConstructor::PlainDateConstructor(Realm& realm)
 PlainDateConstructor::PlainDateConstructor(Realm& realm)
-    : NativeFunction(vm().names.PlainDate.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.PlainDate.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimeConstructor.cpp

@@ -16,7 +16,7 @@ namespace JS::Temporal {
 
 
 // 5.1 The Temporal.PlainDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-constructor
 // 5.1 The Temporal.PlainDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaindatetime-constructor
 PlainDateTimeConstructor::PlainDateTimeConstructor(Realm& realm)
 PlainDateTimeConstructor::PlainDateTimeConstructor(Realm& realm)
-    : NativeFunction(vm().names.PlainDateTime.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.PlainDateTime.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayConstructor.cpp

@@ -15,7 +15,7 @@ namespace JS::Temporal {
 
 
 // 10.1 The Temporal.PlainMonthDay Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-constructor
 // 10.1 The Temporal.PlainMonthDay Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainmonthday-constructor
 PlainMonthDayConstructor::PlainMonthDayConstructor(Realm& realm)
 PlainMonthDayConstructor::PlainMonthDayConstructor(Realm& realm)
-    : NativeFunction(vm().names.PlainMonthDay.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.PlainMonthDay.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/PlainTimeConstructor.cpp

@@ -14,7 +14,7 @@ namespace JS::Temporal {
 
 
 // 4.1 The Temporal.PlainTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-constructor
 // 4.1 The Temporal.PlainTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plaintime-constructor
 PlainTimeConstructor::PlainTimeConstructor(Realm& realm)
 PlainTimeConstructor::PlainTimeConstructor(Realm& realm)
-    : NativeFunction(vm().names.PlainTime.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.PlainTime.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthConstructor.cpp

@@ -16,7 +16,7 @@ namespace JS::Temporal {
 
 
 // 9.1 The Temporal.PlainYearMonth Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-constructor
 // 9.1 The Temporal.PlainYearMonth Constructor, https://tc39.es/proposal-temporal/#sec-temporal-plainyearmonth-constructor
 PlainYearMonthConstructor::PlainYearMonthConstructor(Realm& realm)
 PlainYearMonthConstructor::PlainYearMonthConstructor(Realm& realm)
-    : NativeFunction(vm().names.PlainYearMonth.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.PlainYearMonth.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/TimeZoneConstructor.cpp

@@ -12,7 +12,7 @@ namespace JS::Temporal {
 
 
 // 11.2 The Temporal.TimeZone Constructor, https://tc39.es/proposal-temporal/#sec-temporal-timezone-constructor
 // 11.2 The Temporal.TimeZone Constructor, https://tc39.es/proposal-temporal/#sec-temporal-timezone-constructor
 TimeZoneConstructor::TimeZoneConstructor(Realm& realm)
 TimeZoneConstructor::TimeZoneConstructor(Realm& realm)
-    : NativeFunction(vm().names.TimeZone.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.TimeZone.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimeConstructor.cpp

@@ -17,7 +17,7 @@ namespace JS::Temporal {
 
 
 // 6.1 The Temporal.ZonedDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-constructor
 // 6.1 The Temporal.ZonedDateTime Constructor, https://tc39.es/proposal-temporal/#sec-temporal-zoneddatetime-constructor
 ZonedDateTimeConstructor::ZonedDateTimeConstructor(Realm& realm)
 ZonedDateTimeConstructor::ZonedDateTimeConstructor(Realm& realm)
-    : NativeFunction(vm().names.ZonedDateTime.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.ZonedDateTime.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -478,7 +478,7 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
     }                                                                                                                            \
     }                                                                                                                            \
                                                                                                                                  \
                                                                                                                                  \
     ConstructorName::ConstructorName(Realm& realm)                                                                               \
     ConstructorName::ConstructorName(Realm& realm)                                                                               \
-        : TypedArrayConstructor(vm().names.ClassName.as_string(), *realm.intrinsics().typed_array_constructor())                 \
+        : TypedArrayConstructor(realm.vm().names.ClassName.as_string(), *realm.intrinsics().typed_array_constructor())           \
     {                                                                                                                            \
     {                                                                                                                            \
     }                                                                                                                            \
     }                                                                                                                            \
                                                                                                                                  \
                                                                                                                                  \

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

@@ -17,7 +17,7 @@ TypedArrayConstructor::TypedArrayConstructor(FlyString const& name, Object& prot
 }
 }
 
 
 TypedArrayConstructor::TypedArrayConstructor(Realm& realm)
 TypedArrayConstructor::TypedArrayConstructor(Realm& realm)
-    : NativeFunction(vm().names.TypedArray.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.TypedArray.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 WeakMapConstructor::WeakMapConstructor(Realm& realm)
 WeakMapConstructor::WeakMapConstructor(Realm& realm)
-    : NativeFunction(vm().names.WeakMap.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.WeakMap.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -13,7 +13,7 @@
 namespace JS {
 namespace JS {
 
 
 WeakRefConstructor::WeakRefConstructor(Realm& realm)
 WeakRefConstructor::WeakRefConstructor(Realm& realm)
-    : NativeFunction(vm().names.WeakRef.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.WeakRef.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }
 
 

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

@@ -14,7 +14,7 @@
 namespace JS {
 namespace JS {
 
 
 WeakSetConstructor::WeakSetConstructor(Realm& realm)
 WeakSetConstructor::WeakSetConstructor(Realm& realm)
-    : NativeFunction(vm().names.WeakSet.as_string(), *realm.intrinsics().function_prototype())
+    : NativeFunction(realm.vm().names.WeakSet.as_string(), *realm.intrinsics().function_prototype())
 {
 {
 }
 }