-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Context
independent CodeBlock
s
#3424
Conversation
Test262 conformance changes
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3424 +/- ##
==========================================
+ Coverage 44.59% 44.66% +0.07%
==========================================
Files 487 487
Lines 50601 50640 +39
==========================================
+ Hits 22563 22620 +57
+ Misses 28038 28020 -18 ☔ View full report in Codecov by Sentry. |
6f25a7c
to
a023801
Compare
Ideally we would make the interner store |
Does this affect performance in any way? Just thinking that copying The other alternative would be to have an API similar to V8's, where scripts are "linked" to contexts, and you can unlink them and relink them to other contexts if you need to. |
Yes, there is a small perf. increase.
NOTE: I didn't run all of them, the
I'm fine with keeping
Sounds interesting! Is there any resource that describes this? :) |
I don't think V8 has an example on how to use that API, but I think it's slightly more flexible, since an |
0107b83
to
7838764
Compare
7838764
to
eeecbfc
Compare
eeecbfc
to
ace1009
Compare
This allows us to share `CodeBlock`s between `Context`, which makes functions sharable between `Context`s.
ace1009
to
e5a8e64
Compare
@jedel1043 and @raskad will review this. |
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.
Really nice, I just got one comment.
pub(crate) trait ToJsString { | ||
fn to_js_string(&self, interner: &Interner) -> JsString; | ||
} | ||
|
||
impl ToJsString for Sym { | ||
fn to_js_string(&self, interner: &Interner) -> JsString { | ||
js_string!(interner.resolve_expect(*self).utf16()) | ||
} | ||
} | ||
|
||
impl ToJsString for Identifier { | ||
fn to_js_string(&self, interner: &Interner) -> JsString { | ||
self.sym().to_js_string(interner) | ||
} | ||
} | ||
|
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.
Note for later: see if we can avoid taking interner
as a parameter on this, to make it a bit more similar to the ToString
trait.
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 great!
Fixes/Closes #2626
This allows us to share
CodeBlock
s betweenContext
, which makes functions sharable betweenContext
s.