mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:47:34 +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
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(FocusEvent);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> FocusEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<FocusEvent>(realm, realm, event_name, event_init);
|
||||
|
|
|
@ -17,6 +17,7 @@ struct FocusEventInit : public UIEventInit {
|
|||
|
||||
class FocusEvent final : public UIEvent {
|
||||
WEB_PLATFORM_OBJECT(FocusEvent, UIEvent);
|
||||
JS_DECLARE_ALLOCATOR(FocusEvent);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> construct_impl(JS::Realm&, FlyString const& event_name, FocusEventInit const& event_init);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(KeyboardEvent);
|
||||
|
||||
// https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
|
||||
static unsigned long determine_key_code(KeyCode platform_key, u32 code_point)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ enum class DOMKeyLocation {
|
|||
// https://www.w3.org/TR/uievents/#interface-keyboardevent
|
||||
class KeyboardEvent final : public UIEvent {
|
||||
WEB_PLATFORM_OBJECT(KeyboardEvent, UIEvent);
|
||||
JS_DECLARE_ALLOCATOR(KeyboardEvent);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<KeyboardEvent> create(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& = {});
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(MouseEvent);
|
||||
|
||||
MouseEvent::MouseEvent(JS::Realm& realm, FlyString const& event_name, MouseEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y, unsigned modifiers)
|
||||
: UIEvent(realm, event_name, event_init)
|
||||
, m_screen_x(event_init.screen_x)
|
||||
|
|
|
@ -26,6 +26,7 @@ struct MouseEventInit : public EventModifierInit {
|
|||
|
||||
class MouseEvent : public UIEvent {
|
||||
WEB_PLATFORM_OBJECT(MouseEvent, UIEvent);
|
||||
JS_DECLARE_ALLOCATOR(MouseEvent);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<MouseEvent> create(JS::Realm&, FlyString const& event_name, MouseEventInit const& = {}, double page_x = 0, double page_y = 0, double offset_x = 0, double offset_y = 0, unsigned modifiers = 0);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(UIEvent);
|
||||
|
||||
JS::NonnullGCPtr<UIEvent> UIEvent::create(JS::Realm& realm, FlyString const& event_name)
|
||||
{
|
||||
return realm.heap().allocate<UIEvent>(realm, realm, event_name);
|
||||
|
|
|
@ -19,6 +19,7 @@ struct UIEventInit : public DOM::EventInit {
|
|||
|
||||
class UIEvent : public DOM::Event {
|
||||
WEB_PLATFORM_OBJECT(UIEvent, DOM::Event);
|
||||
JS_DECLARE_ALLOCATOR(UIEvent);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<UIEvent> create(JS::Realm&, FlyString const& type);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WheelEvent);
|
||||
|
||||
WheelEvent::WheelEvent(JS::Realm& realm, FlyString const& event_name, WheelEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y, unsigned modifiers)
|
||||
: MouseEvent(realm, event_name, event_init, page_x, page_y, offset_x, offset_y, modifiers)
|
||||
, m_delta_x(event_init.delta_x)
|
||||
|
|
|
@ -27,6 +27,7 @@ struct WheelEventInit : public MouseEventInit {
|
|||
|
||||
class WheelEvent final : public MouseEvent {
|
||||
WEB_PLATFORM_OBJECT(WheelEvent, MouseEvent);
|
||||
JS_DECLARE_ALLOCATOR(WheelEvent);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<WheelEvent> create(JS::Realm&, FlyString const& event_name, WheelEventInit const& event_init = {}, double page_x = 0, double page_y = 0, double offset_x = 0, double offset_y = 0, unsigned modifiers = 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue