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
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

@ -7,7 +7,7 @@
#pragma once
#include <AK/OwnPtr.h>
#include <LibJS/Heap/Handle.h>
#include <LibGC/Root.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/VM.h>
@ -16,15 +16,15 @@ namespace JS {
// 9.5.1 JobCallback Records, https://tc39.es/ecma262/#sec-jobcallback-records
class JobCallback : public JS::Cell {
JS_CELL(JobCallback, JS::Cell);
JS_DECLARE_ALLOCATOR(JobCallback);
GC_CELL(JobCallback, JS::Cell);
GC_DECLARE_ALLOCATOR(JobCallback);
public:
struct CustomData {
virtual ~CustomData() = default;
};
[[nodiscard]] static JS::NonnullGCPtr<JobCallback> create(JS::VM& vm, FunctionObject& callback, OwnPtr<CustomData> custom_data);
[[nodiscard]] static GC::Ref<JobCallback> create(JS::VM& vm, FunctionObject& callback, OwnPtr<CustomData> custom_data);
JobCallback(FunctionObject& callback, OwnPtr<CustomData> custom_data)
: m_callback(callback)
@ -38,11 +38,11 @@ public:
CustomData* custom_data() { return m_custom_data; }
private:
JS::NonnullGCPtr<FunctionObject> m_callback;
GC::Ref<FunctionObject> m_callback;
OwnPtr<CustomData> m_custom_data { nullptr };
};
JS::NonnullGCPtr<JobCallback> make_job_callback(FunctionObject& callback);
ThrowCompletionOr<Value> call_job_callback(VM&, JS::NonnullGCPtr<JobCallback>, Value this_value, ReadonlySpan<Value> arguments_list);
GC::Ref<JobCallback> make_job_callback(FunctionObject& callback);
ThrowCompletionOr<Value> call_job_callback(VM&, GC::Ref<JobCallback>, Value this_value, ReadonlySpan<Value> arguments_list);
}