mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
LibJS: Make IteratorRecord inherit from Cell, not Object
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This shaves its size down from 104 bytes to 48 bytes, cutting GC pressure caused by this type in more than half.
This commit is contained in:
parent
1d88c4529c
commit
5f12b2a05d
Notes:
github-actions[bot]
2025-03-22 22:00:36 +00:00
Author: https://github.com/awesomekling
Commit: 5f12b2a05d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4051
5 changed files with 18 additions and 25 deletions
|
@ -17,14 +17,13 @@
|
|||
namespace JS {
|
||||
|
||||
// 7.4.1 Iterator Records, https://tc39.es/ecma262/#sec-iterator-records
|
||||
class IteratorRecord final : public Object {
|
||||
JS_OBJECT(IteratorRecord, Object);
|
||||
class IteratorRecord final : public Cell {
|
||||
GC_CELL(IteratorRecord, Cell);
|
||||
GC_DECLARE_ALLOCATOR(IteratorRecord);
|
||||
|
||||
public:
|
||||
IteratorRecord(Realm& realm, GC::Ptr<Object> iterator, Value next_method, bool done)
|
||||
: Object(ConstructWithoutPrototypeTag::Tag, realm)
|
||||
, iterator(iterator)
|
||||
IteratorRecord(GC::Ptr<Object> iterator, Value next_method, bool done)
|
||||
: iterator(iterator)
|
||||
, next_method(next_method)
|
||||
, done(done)
|
||||
{
|
||||
|
@ -36,12 +35,8 @@ public:
|
|||
|
||||
private:
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual bool is_iterator_record() const override { return true; }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Object::fast_is<IteratorRecord>() const { return is_iterator_record(); }
|
||||
|
||||
class Iterator : public Object {
|
||||
JS_OBJECT(Iterator, Object);
|
||||
GC_DECLARE_ALLOCATOR(Iterator);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue