mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:27:35 +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
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace Web::Animations {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(Animation);
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-animation-animation
|
||||
JS::NonnullGCPtr<Animation> Animation::create(JS::Realm& realm, JS::GCPtr<AnimationEffect> effect, JS::GCPtr<AnimationTimeline> timeline)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::Animations {
|
|||
// https://www.w3.org/TR/web-animations-1/#the-animation-interface
|
||||
class Animation : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(Animation, DOM::EventTarget);
|
||||
JS_DECLARE_ALLOCATOR(Animation);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<Animation> create(JS::Realm&, JS::GCPtr<AnimationEffect>, JS::GCPtr<AnimationTimeline>);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
namespace Web::Animations {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(AnimationEffect);
|
||||
|
||||
JS::NonnullGCPtr<AnimationEffect> AnimationEffect::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<AnimationEffect>(realm, realm);
|
||||
|
|
|
@ -58,6 +58,7 @@ enum class AnimationDirection {
|
|||
// https://www.w3.org/TR/web-animations-1/#the-animationeffect-interface
|
||||
class AnimationEffect : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(AnimationEffect, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(AnimationEffect);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<AnimationEffect> create(JS::Realm&);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::Animations {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(AnimationPlaybackEvent);
|
||||
|
||||
JS::NonnullGCPtr<AnimationPlaybackEvent> AnimationPlaybackEvent::create(JS::Realm& realm, FlyString const& event_name, AnimationPlaybackEventInit const& event_init)
|
||||
{
|
||||
return realm.heap().allocate<AnimationPlaybackEvent>(realm, realm, event_name, event_init);
|
||||
|
|
|
@ -20,6 +20,7 @@ struct AnimationPlaybackEventInit : public DOM::EventInit {
|
|||
// https://www.w3.org/TR/web-animations-1/#animationplaybackevent
|
||||
class AnimationPlaybackEvent : public DOM::Event {
|
||||
WEB_PLATFORM_OBJECT(AnimationPlaybackEvent, DOM::Event);
|
||||
JS_DECLARE_ALLOCATOR(AnimationPlaybackEvent);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<AnimationPlaybackEvent> create(JS::Realm&, FlyString const& event_name, AnimationPlaybackEventInit const& event_init = {});
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace Web::Animations {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(AnimationTimeline);
|
||||
|
||||
WebIDL::ExceptionOr<void> AnimationTimeline::set_current_time(Optional<double> value)
|
||||
{
|
||||
if (value == m_current_time)
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::Animations {
|
|||
// https://www.w3.org/TR/web-animations-1/#animationtimeline
|
||||
class AnimationTimeline : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(AnimationTimeline, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(AnimationTimeline);
|
||||
|
||||
public:
|
||||
Optional<double> current_time() const { return m_current_time; }
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::Animations {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(DocumentTimeline);
|
||||
|
||||
JS::NonnullGCPtr<DocumentTimeline> DocumentTimeline::create(JS::Realm& realm, DOM::Document& document, HighResolutionTime::DOMHighResTimeStamp origin_time)
|
||||
{
|
||||
return realm.heap().allocate<DocumentTimeline>(realm, realm, document, origin_time);
|
||||
|
|
|
@ -20,6 +20,7 @@ struct DocumentTimelineOptions {
|
|||
// https://www.w3.org/TR/web-animations-1/#the-documenttimeline-interface
|
||||
class DocumentTimeline : public AnimationTimeline {
|
||||
WEB_PLATFORM_OBJECT(DocumentTimeline, AnimationTimeline);
|
||||
JS_DECLARE_ALLOCATOR(DocumentTimeline);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<DocumentTimeline> create(JS::Realm&, DOM::Document&, HighResolutionTime::DOMHighResTimeStamp origin_time);
|
||||
|
|
|
@ -39,6 +39,7 @@ struct BaseKeyframe {
|
|||
// https://www.w3.org/TR/web-animations-1/#the-keyframeeffect-interface
|
||||
class KeyframeEffect : public AnimationEffect {
|
||||
WEB_PLATFORM_OBJECT(KeyframeEffect, AnimationEffect);
|
||||
JS_DECLARE_ALLOCATOR(KeyframeEffect);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<KeyframeEffect> create(JS::Realm&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue