mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17: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
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGAnimatedLength);
|
||||
|
||||
JS::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
|
||||
{
|
||||
return realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val));
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedLength
|
||||
class SVGAnimatedLength final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(SVGAnimatedLength, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(SVGAnimatedLength);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedLength> create(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGAnimatedNumber);
|
||||
|
||||
JS::NonnullGCPtr<SVGAnimatedNumber> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
|
||||
{
|
||||
return realm.heap().allocate<SVGAnimatedNumber>(realm, realm, base_val, anim_val);
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedNumber
|
||||
class SVGAnimatedNumber final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(SVGAnimatedNumber, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(SVGAnimatedNumber);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedNumber> create(JS::Realm&, float base_val, float anim_val);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGCircleElement);
|
||||
|
||||
SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGCircleElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGCircleElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGCircleElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGCircleElement() override = default;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGClipPathElement);
|
||||
|
||||
SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGClipPathElement final : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(SVGClipPathElement, SVGElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGClipPathElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGClipPathElement();
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGDefsElement);
|
||||
|
||||
SVGDefsElement::SVGDefsElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGDefsElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGDefsElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGDefsElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGDefsElement();
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGEllipseElement);
|
||||
|
||||
SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGEllipseElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGEllipseElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGEllipseElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGEllipseElement() override = default;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGForeignObjectElement);
|
||||
|
||||
SVGForeignObjectElement::SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
// https://svgwg.org/svg2-draft/embedded.html#InterfaceSVGForeignObjectElement
|
||||
class SVGForeignObjectElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGForeignObjectElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGForeignObjectElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGForeignObjectElement() override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGGElement);
|
||||
|
||||
SVGGElement::SVGGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGGElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGGElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGGElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGGElement() override = default;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGLength);
|
||||
|
||||
JS::NonnullGCPtr<SVGLength> SVGLength::create(JS::Realm& realm, u8 unit_type, float value)
|
||||
{
|
||||
return realm.heap().allocate<SVGLength>(realm, realm, unit_type, value);
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength
|
||||
class SVGLength : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(SVGLength);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SVGLength> create(JS::Realm&, u8 unit_type, float value);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGLineElement);
|
||||
|
||||
SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGLineElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGLineElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGLineElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGLineElement() override = default;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGLinearGradientElement);
|
||||
|
||||
SVGLinearGradientElement::SVGLinearGradientElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGradientElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGLinearGradientElement : public SVGGradientElement {
|
||||
WEB_PLATFORM_OBJECT(SVGLinearGradientElement, SVGGradientElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGLinearGradientElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGLinearGradientElement() override = default;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGMaskElement);
|
||||
|
||||
SVGMaskElement::SVGMaskElement(DOM::Document& document, DOM::QualifiedName tag_name)
|
||||
: SVGGraphicsElement(document, move(tag_name))
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGMaskElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGMaskElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGMaskElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGMaskElement() override;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGPathElement);
|
||||
|
||||
[[maybe_unused]] static void print_instruction(PathInstruction const& instruction)
|
||||
{
|
||||
VERIFY(PATH_DEBUG);
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGPathElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGPathElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGPathElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGPathElement() override = default;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGPolygonElement);
|
||||
|
||||
SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGPolygonElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGPolygonElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGPolygonElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGPolygonElement() override = default;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGPolylineElement);
|
||||
|
||||
SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGPolylineElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGPolylineElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGPolylineElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGPolylineElement() override = default;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGRadialGradientElement);
|
||||
|
||||
SVGRadialGradientElement::SVGRadialGradientElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGradientElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGRadialGradientElement : public SVGGradientElement {
|
||||
WEB_PLATFORM_OBJECT(SVGRadialGradientElement, SVGGradientElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGRadialGradientElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGRadialGradientElement() override = default;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGRectElement);
|
||||
|
||||
SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
// https://www.w3.org/TR/SVG11/shapes.html#RectElement
|
||||
class SVGRectElement final : public SVGGeometryElement {
|
||||
WEB_PLATFORM_OBJECT(SVGRectElement, SVGGeometryElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGRectElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGRectElement() override = default;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGSVGElement);
|
||||
|
||||
SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGSVGElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGSVGElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGSVGElement);
|
||||
|
||||
public:
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGScriptElement);
|
||||
|
||||
SVGScriptElement::SVGScriptElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
// https://www.w3.org/TR/SVG/interact.html#InterfaceSVGScriptElement
|
||||
class SVGScriptElement : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(SVGScriptElement, SVGElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGScriptElement);
|
||||
|
||||
public:
|
||||
void process_the_script_element();
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGStopElement);
|
||||
|
||||
SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGStopElement final : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(SVGStopElement, SVGElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGStopElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGStopElement() override = default;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGStyleElement);
|
||||
|
||||
SVGStyleElement::SVGStyleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGStyleElement final : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(HTMLStyleElement, SVGElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGStyleElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGStyleElement() override;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGSymbolElement);
|
||||
|
||||
SVGSymbolElement::SVGSymbolElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGSymbolElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGSymbolElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGSymbolElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGSymbolElement() override = default;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGTSpanElement);
|
||||
|
||||
SVGTSpanElement::SVGTSpanElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGTextPositioningElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
// https://svgwg.org/svg2-draft/text.html#InterfaceSVGTSpanElement
|
||||
class SVGTSpanElement : public SVGTextPositioningElement {
|
||||
WEB_PLATFORM_OBJECT(SVGTSpanElement, SVGTextPositioningElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGTSpanElement);
|
||||
|
||||
public:
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGTextElement);
|
||||
|
||||
SVGTextElement::SVGTextElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGTextPositioningElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Web::SVG {
|
|||
// https://svgwg.org/svg2-draft/text.html#InterfaceSVGTextElement
|
||||
class SVGTextElement : public SVGTextPositioningElement {
|
||||
WEB_PLATFORM_OBJECT(SVGTextElement, SVGTextPositioningElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGTextElement);
|
||||
|
||||
public:
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGTitleElement);
|
||||
|
||||
SVGTitleElement::SVGTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGTitleElement final : public SVGElement {
|
||||
WEB_PLATFORM_OBJECT(SVGTitleElement, SVGElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGTitleElement);
|
||||
|
||||
private:
|
||||
SVGTitleElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(SVGUseElement);
|
||||
|
||||
SVGUseElement::SVGUseElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, qualified_name)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGUseElement final : public SVGGraphicsElement {
|
||||
WEB_PLATFORM_OBJECT(SVGUseElement, SVGGraphicsElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGUseElement);
|
||||
|
||||
public:
|
||||
virtual ~SVGUseElement() override = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue