Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Implement WeakSet #2586

Closed
wants to merge 4 commits into from
Closed

[Merged by Bors] - Implement WeakSet #2586

wants to merge 4 commits into from

Conversation

raskad
Copy link
Member

@raskad raskad commented Feb 3, 2023

This Pull Request changes the following:

@raskad raskad added enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics labels Feb 3, 2023
@raskad raskad added this to the v0.17.0 milestone Feb 3, 2023
@github-actions
Copy link

github-actions bot commented Feb 3, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,233 94,233 0
Passed 71,503 71,683 +180
Ignored 17,326 17,326 0
Failed 5,404 5,224 -180
Panics 12 12 0
Conformance 75.88% 76.07% +0.19%
Fixed tests (180):
test/built-ins/WeakSet/weakset.js [strict mode] (previously Failed)
test/built-ins/WeakSet/weakset.js (previously Failed)
test/built-ins/WeakSet/empty-iterable.js [strict mode] (previously Failed)
test/built-ins/WeakSet/empty-iterable.js (previously Failed)
test/built-ins/WeakSet/iterable-with-object-values.js [strict mode] (previously Failed)
test/built-ins/WeakSet/iterable-with-object-values.js (previously Failed)
test/built-ins/WeakSet/length.js [strict mode] (previously Failed)
test/built-ins/WeakSet/length.js (previously Failed)
test/built-ins/WeakSet/prototype-of-weakset.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype-of-weakset.js (previously Failed)
test/built-ins/WeakSet/undefined-newtarget.js [strict mode] (previously Failed)
test/built-ins/WeakSet/undefined-newtarget.js (previously Failed)
test/built-ins/WeakSet/name.js [strict mode] (previously Failed)
test/built-ins/WeakSet/name.js (previously Failed)
test/built-ins/WeakSet/properties-of-the-weakset-prototype-object.js [strict mode] (previously Failed)
test/built-ins/WeakSet/properties-of-the-weakset-prototype-object.js (previously Failed)
test/built-ins/WeakSet/get-add-method-failure.js [strict mode] (previously Failed)
test/built-ins/WeakSet/get-add-method-failure.js (previously Failed)
test/built-ins/WeakSet/constructor.js [strict mode] (previously Failed)
test/built-ins/WeakSet/constructor.js (previously Failed)
test/built-ins/WeakSet/iterator-value-failure.js [strict mode] (previously Failed)
test/built-ins/WeakSet/iterator-value-failure.js (previously Failed)
test/built-ins/WeakSet/iterator-next-failure.js [strict mode] (previously Failed)
test/built-ins/WeakSet/iterator-next-failure.js (previously Failed)
test/built-ins/WeakSet/is-a-constructor.js [strict mode] (previously Failed)
test/built-ins/WeakSet/is-a-constructor.js (previously Failed)
test/built-ins/WeakSet/no-iterable.js [strict mode] (previously Failed)
test/built-ins/WeakSet/no-iterable.js (previously Failed)
test/built-ins/WeakSet/proto-from-ctor-realm.js [strict mode] (previously Failed)
test/built-ins/WeakSet/proto-from-ctor-realm.js (previously Failed)
test/built-ins/WeakSet/iterable-failure.js [strict mode] (previously Failed)
test/built-ins/WeakSet/iterable-failure.js (previously Failed)
test/built-ins/WeakSet/iterator-close-after-add-failure.js [strict mode] (previously Failed)
test/built-ins/WeakSet/iterator-close-after-add-failure.js (previously Failed)
test/built-ins/WeakSet/add-not-callable-throws.js [strict mode] (previously Failed)
test/built-ins/WeakSet/add-not-callable-throws.js (previously Failed)
test/built-ins/WeakSet/prototype/prototype-attributes.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/prototype-attributes.js (previously Failed)
test/built-ins/WeakSet/prototype/Symbol.toStringTag.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/Symbol.toStringTag.js (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-boolean.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-boolean.js (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-symbol.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-symbol.js (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-null.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-null.js (previously Failed)
test/built-ins/WeakSet/prototype/has/length.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/length.js (previously Failed)
test/built-ins/WeakSet/prototype/has/name.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/name.js (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-number.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-number.js (previously Failed)
test/built-ins/WeakSet/prototype/has/not-a-constructor.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/not-a-constructor.js (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-object.js (previously Failed)
test/built-ins/WeakSet/prototype/has/has.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/has.js (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-undefined.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-undefined.js (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-string.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/this-not-object-throw-string.js (previously Failed)
test/built-ins/WeakSet/prototype/has/returns-false-when-value-cannot-be-held-weakly.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/returns-false-when-value-cannot-be-held-weakly.js (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-weakset-prototype.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-weakset-prototype.js (previously Failed)
test/built-ins/WeakSet/prototype/has/returns-true-when-object-value-present.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/returns-true-when-object-value-present.js (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-array.js (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-map.js (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/does-not-have-weaksetdata-internal-slot-set.js (previously Failed)
test/built-ins/WeakSet/prototype/has/returns-false-when-object-value-not-present.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/has/returns-false-when-object-value-not-present.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-boolean.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-boolean.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/delete-entry-initial-iterable.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/delete-entry-initial-iterable.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-symbol.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-symbol.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-null.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-null.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/length.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/length.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/name.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/name.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-number.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-number.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/not-a-constructor.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/not-a-constructor.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-object.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-object.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-undefined.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-undefined.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-string.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/this-not-object-throw-string.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/returns-false-when-value-cannot-be-held-weakly.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/returns-false-when-value-cannot-be-held-weakly.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-weakset-prototype.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-weakset-prototype.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-array.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-array.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/returns-false-when-delete-is-noop.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/returns-false-when-delete-is-noop.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-map.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-map.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-set.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/does-not-have-weaksetdata-internal-slot-set.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/delete-object-entry.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/delete-object-entry.js (previously Failed)
test/built-ins/WeakSet/prototype/delete/delete.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/delete/delete.js (previously Failed)
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor.js (previously Failed)
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor-intrinsic.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/constructor/weakset-prototype-constructor-intrinsic.js (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-boolean.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-boolean.js (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-symbol.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-symbol.js (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-null.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-null.js (previously Failed)
test/built-ins/WeakSet/prototype/add/length.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/length.js (previously Failed)
test/built-ins/WeakSet/prototype/add/returns-this.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/returns-this.js (previously Failed)
test/built-ins/WeakSet/prototype/add/name.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/name.js (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-number.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-number.js (previously Failed)
test/built-ins/WeakSet/prototype/add/not-a-constructor.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/not-a-constructor.js (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-object.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-object.js (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-undefined.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-undefined.js (previously Failed)
test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/returns-this-when-ignoring-duplicate.js (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-string.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/this-not-object-throw-string.js (previously Failed)
test/built-ins/WeakSet/prototype/add/add.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/add.js (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-weakset-prototype.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-weakset-prototype.js (previously Failed)
test/built-ins/WeakSet/prototype/add/adds-object-element.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/adds-object-element.js (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-array.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-array.js (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-map.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-map.js (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-set.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/does-not-have-weaksetdata-internal-slot-set.js (previously Failed)
test/built-ins/WeakSet/prototype/add/throw-when-value-cannot-be-held-weakly.js [strict mode] (previously Failed)
test/built-ins/WeakSet/prototype/add/throw-when-value-cannot-be-held-weakly.js (previously Failed)
test/built-ins/Object/seal/seal-weakset.js [strict mode] (previously Failed)
test/built-ins/Object/seal/seal-weakset.js (previously Failed)
test/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/clear/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/forEach/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/has/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/delete/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/entries/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/values/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.js [strict mode] (previously Failed)
test/built-ins/Set/prototype/add/does-not-have-setdata-internal-slot-weakset.js (previously Failed)
test/language/expressions/class/subclass-builtins/subclass-WeakSet.js [strict mode] (previously Failed)
test/language/expressions/class/subclass-builtins/subclass-WeakSet.js (previously Failed)
test/language/statements/class/subclass-builtins/subclass-WeakSet.js [strict mode] (previously Failed)
test/language/statements/class/subclass-builtins/subclass-WeakSet.js (previously Failed)
test/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js [strict mode] (previously Failed)
test/language/statements/class/subclass/builtin-objects/WeakSet/regular-subclassing.js (previously Failed)
test/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js [strict mode] (previously Failed)
test/language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called.js (previously Failed)

@codecov
Copy link

codecov bot commented Feb 3, 2023

Codecov Report

Merging #2586 (cd1e1c8) into main (4aebe39) will decrease coverage by 0.52%.
The diff coverage is 49.71%.

@@            Coverage Diff             @@
##             main    #2586      +/-   ##
==========================================
- Coverage   49.38%   48.86%   -0.52%     
==========================================
  Files         381      393      +12     
  Lines       37906    39061    +1155     
==========================================
+ Hits        18720    19089     +369     
- Misses      19186    19972     +786     
Impacted Files Coverage Δ
boa_engine/src/object/mod.rs 29.83% <0.00%> (-0.59%) ⬇️
boa_engine/src/builtins/weak_set/mod.rs 14.28% <14.28%> (ø)
boa_gc/src/pointers/weak.rs 66.66% <50.00%> (-19.05%) ⬇️
boa_gc/src/internals/weak_map_box.rs 90.90% <90.90%> (ø)
boa_engine/src/builtins/mod.rs 100.00% <100.00%> (ø)
boa_engine/src/context/intrinsics.rs 100.00% <100.00%> (ø)
boa_gc/src/lib.rs 100.00% <100.00%> (+0.63%) ⬆️
boa_gc/src/pointers/weak_map.rs 100.00% <100.00%> (ø)
boa_parser/src/parser/statement/declaration/mod.rs 46.15% <0.00%> (-39.57%) ⬇️
boa_engine/src/bytecompiler/statement/continue.rs 39.36% <0.00%> (-31.48%) ⬇️
... and 69 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the preliminar work! Though, this implementation has the problem of not freeing the inner EphemeronBox when the inner value invalidates. I think this could only be solved by creating a WeakMap structure with direct support from our GC. The GC would then track every WeakMap to free the invalidated boxes from the map.

Anyways, I think we could technically merge this as it is and improve the design later, but let me know what you think first :)

Comment on lines 80 to 95
/// Insert the value into the set.
pub fn add(&mut self, value: &JsObject) -> bool {
self.inner.insert(WeakSetObject(WeakGc::new(value.inner())))
}

/// Remove the value from the set, and return `true` if it was present.
pub fn delete(&mut self, value: &JsObject) -> bool {
self.inner
.shift_remove(&WeakSetObject(WeakGc::new(value.inner())))
}

/// Return `true` if an equivalent to value exists in the set.
pub fn contains(&self, value: &JsObject) -> bool {
self.inner
.contains(&WeakSetObject(WeakGc::new(value.inner())))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think implementing a special HashMap using ephemerons directly in our GC would avoid having to create a WeakSetObject on each access.

@raskad
Copy link
Member Author

raskad commented Feb 3, 2023

Though, this implementation has the problem of not freeing the inner EphemeronBox when the inner value invalidates. I think this could only be solved by creating a WeakMap structure with direct support from our GC. The GC would then track every WeakMap to free the invalidated boxes from the map.

Yes I was thinking the same thing, but I'm not sure where exactly that would fit in our gc process and how much we would have to adjust it. My first instinct is that we would want to check for any collected weak refs in WeakMaps at the end of the sweep phase. The big question to me is, how would we keep track of the WeakMaps?

@jedel1043
Copy link
Member

The big question to me is, how would we keep track of the WeakMaps?

Probably by doing something similar as the strong pointers: a queue of GcBox<dyn ErasedWeakMap>s that automatically drops all collected weakmaps. (Though, we could also use something like a WeakBox<dyn ErasedWeakMap> queue to avoid having to add more collection logic, but I don't know if having to track weak boxes manually will be any better)

@raskad
Copy link
Member Author

raskad commented Feb 9, 2023

@jedel1043 I implemented a WeakMap in the GC that is just uses Gc and WeakGc internally to avoid having much new logic. I think this should fix the leaked set/map keys. I wrote some tests and they pass miri. Let me know if you see any errors with it.
Even if it works, I'm not sure if we want to go with it or if the design should be different.

/// A map that holds weak references to its keys and is traced by the garbage collector.
#[derive(Clone, Debug, Default, Trace, Finalize)]
pub struct WeakMap<K: Trace + Sized + 'static, V: Trace + Sized + 'static> {
pub(crate) inner: Gc<GcRefCell<HashMap<WeakGc<K>, V>>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this works, I think it would be better to directly use a HashSet<Ephemeron<K, V>> to optimize this, since right now it is using an Ephemeron<K, ()> and a V.

Copy link
Member

@jedel1043 jedel1043 Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, realized that to do this we'll probably have to implement our own HashMap...

Copy link
Member

@jedel1043 jedel1043 Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this should work for now. Maybe in the future we'll have to inline HashMap to optimize the memory of this.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! We can improve this in the future by implementing our own HashMap using Ephemerons, so maybe we should open an issue for it?

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty good. I just had a question on one small thing.

boa_gc/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Nice work on this!

@raskad
Copy link
Member Author

raskad commented Feb 11, 2023

bors r+

bors bot pushed a commit that referenced this pull request Feb 11, 2023
This Pull Request changes the following:

- Implement `WeakSet` buildin object.
- Supersedes #2009



Co-authored-by: raskad <[email protected]>
@bors
Copy link

bors bot commented Feb 11, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement WeakSet [Merged by Bors] - Implement WeakSet Feb 11, 2023
@bors bors bot closed this Feb 11, 2023
@bors bors bot deleted the impl-weakset branch February 11, 2023 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants