1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 13:37:10 +09:00

LibGC+Everywhere: Factor out a LibGC from LibJS

Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
This commit is contained in:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -15,7 +15,7 @@
namespace JS {
JS_DEFINE_ALLOCATOR(Error);
GC_DEFINE_ALLOCATOR(Error);
static SourceRange dummy_source_range { SourceCode::create(String {}, String {}), {}, {} };
@ -34,12 +34,12 @@ SourceRange const& TracebackFrame::source_range() const
return cached_source_range->source_range.get<SourceRange>();
}
NonnullGCPtr<Error> Error::create(Realm& realm)
GC::Ref<Error> Error::create(Realm& realm)
{
return realm.create<Error>(realm.intrinsics().error_prototype());
}
NonnullGCPtr<Error> Error::create(Realm& realm, String message)
GC::Ref<Error> Error::create(Realm& realm, String message)
{
auto& vm = realm.vm();
auto error = Error::create(realm);
@ -48,7 +48,7 @@ NonnullGCPtr<Error> Error::create(Realm& realm, String message)
return error;
}
NonnullGCPtr<Error> Error::create(Realm& realm, StringView message)
GC::Ref<Error> Error::create(Realm& realm, StringView message)
{
return create(realm, MUST(String::from_utf8(message)));
}
@ -157,13 +157,13 @@ String Error::stack_string(CompactTraceback compact) const
}
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
JS_DEFINE_ALLOCATOR(ClassName); \
NonnullGCPtr<ClassName> ClassName::create(Realm& realm) \
GC_DEFINE_ALLOCATOR(ClassName); \
GC::Ref<ClassName> ClassName::create(Realm& realm) \
{ \
return realm.create<ClassName>(realm.intrinsics().snake_name##_prototype()); \
} \
\
NonnullGCPtr<ClassName> ClassName::create(Realm& realm, String message) \
GC::Ref<ClassName> ClassName::create(Realm& realm, String message) \
{ \
auto& vm = realm.vm(); \
auto error = ClassName::create(realm); \
@ -172,7 +172,7 @@ String Error::stack_string(CompactTraceback compact) const
return error; \
} \
\
NonnullGCPtr<ClassName> ClassName::create(Realm& realm, StringView message) \
GC::Ref<ClassName> ClassName::create(Realm& realm, StringView message) \
{ \
return create(realm, MUST(String::from_utf8(message))); \
} \