mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 00:42:14 +00:00
LibWeb: Put most LibWeb GC objects in type-specific heap blocks
With this change, we now have ~1200 CellAllocators across both LibJS and LibWeb in a normal WebContent instance. This gives us a minimum heap size of 4.7 MiB in the scenario where we only have one cell allocated per type. Of course, in practice there will be many more of each type, so the effective overhead is quite a bit smaller than that in practice. I left a few types unconverted to this mechanism because I got tired of doing this. :^)
This commit is contained in:
parent
536596632b
commit
bfd354492e
599 changed files with 933 additions and 3 deletions
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ClassicScript);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
|
||||
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(DeprecatedString filename, StringView source, EnvironmentSettingsObject& environment_settings_object, AK::URL base_url, size_t source_line_number, MutedErrors muted_errors)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::HTML {
|
|||
// https://html.spec.whatwg.org/multipage/webappapis.html#classic-script
|
||||
class ClassicScript final : public Script {
|
||||
JS_CELL(ClassicScript, Script);
|
||||
JS_DECLARE_ALLOCATOR(ClassicScript);
|
||||
|
||||
public:
|
||||
virtual ~ClassicScript() override;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ModuleMap);
|
||||
|
||||
void ModuleMap::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -37,6 +37,7 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/webappapis.html#module-map
|
||||
class ModuleMap final : public JS::Cell {
|
||||
JS_CELL(ModuleMap, Cell);
|
||||
JS_DECLARE_ALLOCATOR(ModuleMap);
|
||||
|
||||
public:
|
||||
ModuleMap() = default;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(JavaScriptModuleScript);
|
||||
|
||||
ModuleScript::~ModuleScript() = default;
|
||||
|
||||
ModuleScript::ModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
|
||||
|
|
|
@ -24,6 +24,7 @@ protected:
|
|||
|
||||
class JavaScriptModuleScript final : public ModuleScript {
|
||||
JS_CELL(JavaScriptModuleScript, ModuleScript);
|
||||
JS_DECLARE_ALLOCATOR(JavaScriptModuleScript);
|
||||
|
||||
public:
|
||||
virtual ~JavaScriptModuleScript() override;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Script);
|
||||
|
||||
Script::Script(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
|
||||
: m_base_url(move(base_url))
|
||||
, m_filename(move(filename))
|
||||
|
|
|
@ -18,6 +18,7 @@ class Script
|
|||
: public JS::Cell
|
||||
, public JS::Script::HostDefined {
|
||||
JS_CELL(Script, JS::Cell);
|
||||
JS_DECLARE_ALLOCATOR(Script);
|
||||
|
||||
public:
|
||||
virtual ~Script() override;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WindowEnvironmentSettingsObject);
|
||||
|
||||
WindowEnvironmentSettingsObject::WindowEnvironmentSettingsObject(Window& window, NonnullOwnPtr<JS::ExecutionContext> execution_context)
|
||||
: EnvironmentSettingsObject(move(execution_context))
|
||||
, m_window(window)
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::HTML {
|
|||
|
||||
class WindowEnvironmentSettingsObject final : public EnvironmentSettingsObject {
|
||||
JS_CELL(WindowEnvironmentSettingsObject, EnvironmentSettingsObject);
|
||||
JS_DECLARE_ALLOCATOR(WindowEnvironmentSettingsObject);
|
||||
|
||||
public:
|
||||
static void setup(AK::URL const& creation_url, NonnullOwnPtr<JS::ExecutionContext>, Optional<Environment>, AK::URL top_level_creation_url, Origin top_level_origin);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WorkerEnvironmentSettingsObject);
|
||||
|
||||
JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObject::setup(NonnullOwnPtr<JS::ExecutionContext> execution_context /* FIXME: null or an environment reservedEnvironment, a URL topLevelCreationURL, and an origin topLevelOrigin */)
|
||||
{
|
||||
auto realm = execution_context->realm;
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::HTML {
|
|||
class WorkerEnvironmentSettingsObject final
|
||||
: public EnvironmentSettingsObject {
|
||||
JS_CELL(WindowEnvironmentSettingsObject, EnvironmentSettingsObject);
|
||||
JS_DECLARE_ALLOCATOR(WorkerEnvironmentSettingsObject);
|
||||
|
||||
public:
|
||||
WorkerEnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> execution_context, JS::NonnullGCPtr<WorkerGlobalScope> global_scope)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue