mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:27:46 +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
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ByteLengthQueuingStrategy);
|
||||
|
||||
// https://streams.spec.whatwg.org/#blqs-constructor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ByteLengthQueuingStrategy>> ByteLengthQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Web::Streams {
|
|||
// https://streams.spec.whatwg.org/#bytelengthqueuingstrategy
|
||||
class ByteLengthQueuingStrategy final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(ByteLengthQueuingStrategy, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ByteLengthQueuingStrategy);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ByteLengthQueuingStrategy>> construct_impl(JS::Realm&, QueuingStrategyInit const&);
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CountQueuingStrategy);
|
||||
|
||||
// https://streams.spec.whatwg.org/#blqs-constructor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<CountQueuingStrategy>> CountQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Web::Streams {
|
|||
// https://streams.spec.whatwg.org/#countqueuingstrategy
|
||||
class CountQueuingStrategy final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(CountQueuingStrategy, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(CountQueuingStrategy);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CountQueuingStrategy>> construct_impl(JS::Realm&, QueuingStrategyInit const&);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableByteStreamController);
|
||||
|
||||
// https://streams.spec.whatwg.org/#rbs-controller-desired-size
|
||||
Optional<double> ReadableByteStreamController::desired_size() const
|
||||
{
|
||||
|
|
|
@ -72,6 +72,7 @@ struct ReadableByteStreamQueueEntry {
|
|||
// https://streams.spec.whatwg.org/#readablebytestreamcontroller
|
||||
class ReadableByteStreamController : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(ReadableByteStreamController, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ReadableByteStreamController);
|
||||
|
||||
public:
|
||||
virtual ~ReadableByteStreamController() override = default;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableStream);
|
||||
|
||||
// https://streams.spec.whatwg.org/#rs-constructor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStream>> ReadableStream::construct_impl(JS::Realm& realm, Optional<JS::Handle<JS::Object>> const& underlying_source_object, QueuingStrategy const& strategy)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ struct ReadableStreamGetReaderOptions {
|
|||
// https://streams.spec.whatwg.org/#readablestream
|
||||
class ReadableStream final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(ReadableStream, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ReadableStream);
|
||||
|
||||
public:
|
||||
enum class State {
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableStreamBYOBReader);
|
||||
|
||||
ReadableStreamBYOBReader::ReadableStreamBYOBReader(JS::Realm& realm)
|
||||
: Bindings::PlatformObject(realm)
|
||||
, ReadableStreamGenericReaderMixin(realm)
|
||||
|
|
|
@ -38,6 +38,7 @@ class ReadableStreamBYOBReader final
|
|||
: public Bindings::PlatformObject
|
||||
, public ReadableStreamGenericReaderMixin {
|
||||
WEB_PLATFORM_OBJECT(ReadableStreamBYOBReader, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ReadableStreamBYOBReader);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamBYOBReader>> construct_impl(JS::Realm&, JS::NonnullGCPtr<ReadableStream>);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableStreamBYOBRequest);
|
||||
|
||||
// https://streams.spec.whatwg.org/#rs-byob-request-view
|
||||
JS::GCPtr<JS::TypedArrayBase> ReadableStreamBYOBRequest::view()
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Web::Streams {
|
|||
// https://streams.spec.whatwg.org/#readablestreambyobrequest
|
||||
class ReadableStreamBYOBRequest : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(ReadableStreamBYOBRequest, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ReadableStreamBYOBRequest);
|
||||
|
||||
public:
|
||||
virtual ~ReadableStreamBYOBRequest() override = default;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableStreamDefaultController);
|
||||
|
||||
ReadableStreamDefaultController::ReadableStreamDefaultController(JS::Realm& realm)
|
||||
: Bindings::PlatformObject(realm)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace Web::Streams {
|
|||
// https://streams.spec.whatwg.org/#readablestreamdefaultcontroller
|
||||
class ReadableStreamDefaultController : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(ReadableStreamDefaultController, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ReadableStreamDefaultController);
|
||||
|
||||
public:
|
||||
explicit ReadableStreamDefaultController(JS::Realm&);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ReadableStreamDefaultReader);
|
||||
|
||||
void ReadLoopReadRequest::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -65,6 +65,7 @@ class ReadableStreamDefaultReader final
|
|||
: public Bindings::PlatformObject
|
||||
, public ReadableStreamGenericReaderMixin {
|
||||
WEB_PLATFORM_OBJECT(ReadableStreamDefaultReader, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(ReadableStreamDefaultReader);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamDefaultReader>> construct_impl(JS::Realm&, JS::NonnullGCPtr<ReadableStream>);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(TransformStream);
|
||||
|
||||
// https://streams.spec.whatwg.org/#ts-construct
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<TransformStream>> TransformStream::construct_impl(JS::Realm& realm, Optional<JS::Handle<JS::Object>> transformer_object, QueuingStrategy const& writable_strategy, QueuingStrategy const& readable_strategy)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Web::Streams {
|
|||
|
||||
class TransformStream final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(TransformStream, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(TransformStream);
|
||||
|
||||
public:
|
||||
virtual ~TransformStream() override;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(TransformStreamDefaultController);
|
||||
|
||||
TransformStreamDefaultController::TransformStreamDefaultController(JS::Realm& realm)
|
||||
: Bindings::PlatformObject(realm)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Web::Streams {
|
|||
|
||||
class TransformStreamDefaultController : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(TransformStreamDefaultController, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(TransformStreamDefaultController);
|
||||
|
||||
public:
|
||||
explicit TransformStreamDefaultController(JS::Realm&);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WritableStream);
|
||||
|
||||
// https://streams.spec.whatwg.org/#ws-constructor
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStream>> WritableStream::construct_impl(JS::Realm& realm, Optional<JS::Handle<JS::Object>> const& underlying_sink_object, QueuingStrategy const& strategy)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ struct PendingAbortRequest {
|
|||
// https://streams.spec.whatwg.org/#writablestream
|
||||
class WritableStream final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(WritableStream, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(WritableStream);
|
||||
|
||||
public:
|
||||
enum class State {
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WritableStreamDefaultController);
|
||||
|
||||
void WritableStreamDefaultController::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Web::Streams {
|
|||
// https://streams.spec.whatwg.org/#writablestreamdefaultcontroller
|
||||
class WritableStreamDefaultController final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(WritableStreamDefaultController, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(WritableStreamDefaultController);
|
||||
|
||||
public:
|
||||
virtual ~WritableStreamDefaultController() override = default;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace Web::Streams {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(WritableStreamDefaultWriter);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStreamDefaultWriter>> WritableStreamDefaultWriter::construct_impl(JS::Realm& realm, JS::NonnullGCPtr<WritableStream> stream)
|
||||
{
|
||||
auto writer = realm.heap().allocate<WritableStreamDefaultWriter>(realm, realm);
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Web::Streams {
|
|||
// https://streams.spec.whatwg.org/#writablestreamdefaultwriter
|
||||
class WritableStreamDefaultWriter final : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(WritableStreamDefaultWriter, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(WritableStreamDefaultWriter);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStreamDefaultWriter>> construct_impl(JS::Realm&, JS::NonnullGCPtr<WritableStream>);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue