-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
Cross realm symbols #1243
Cross realm symbols #1243
Conversation
Test262 conformance changes:
|
Benchmark for e4b198bClick to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking very good @HalidOdat. This will be very helpful when implementing the rest of the test262 suite with the shared object that should be able to create new realms, for example.
I only added a couple of comments on documentation, and opened a question on whether we should be using the Default
trait for an empty new()
function, mostly related to this clippy lint.
There was a problem hiding this 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!
Benchmark for b9c478eClick to view benchmark
|
* Cross context symbols * Remove redundant '_symbol' suffix for well known symbol getters * Fix symbol equality and hashing * Add documentation
* Cross context symbols * Remove redundant '_symbol' suffix for well known symbol getters * Fix symbol equality and hashing * Add documentation
Well known Symbols are able to be used between contexts (in the same thread) interchangeably, as described in the spec (
"Unless otherwise specified, well-known symbols values are shared by all realms"
). The spec only says this about well known symbols, but it's better to have all symbols be interchangeable rather than a few, since we will run into some hash collisions for later created symbols.It changes the following:
_symbol
suffix for well known symbol getters.PartialEq
forSymbol
so it only checks equality for hashes (which are unique).Hash
forSymbol
so it only hashes theSymbol
's hash.The two fixes (
PartialEq
andHash
) might gives us a performance boots since we don't need to compare and hash the symbol description. (now we only compare and hash a u64, instead of the string description too).