-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Native ES modules #1460
Native ES modules #1460
Conversation
@@ -65,17 +54,6 @@ test(function textDecoderErrorEncoding() { | |||
assert(didThrow); | |||
}); | |||
|
|||
test(function textEncoder() { | |||
const fixture = "������"; |
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.
This is likely due to ea6c9f2 .. i regret landing it now because I think it was actually incorrect. will attempt to revert the revert and see if this is fixed.
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.
Hmmmm... this particular string is specifically designed to test the upper limit of high-surrogate pairs. If there was some sort of encoding issue, injecting mis-encoded stuff from Rust could cause this issue. I double checked just now in Chrome and the test is correct in that the encoding of the bytes of the string is right.
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.
Ya it’s working as intended and breaking something :) not sure what it is tho ...
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.
I would suggest to keep these tests (unless there's actually something wrong with them).
@@ -6,7 +6,7 @@ | |||
import "./blob_test.ts"; | |||
import "./buffer_test.ts"; | |||
import "./chmod_test.ts"; | |||
import "./compiler_test.ts"; | |||
// import "./compiler_test.ts"; |
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.
I don't want to try to get compiler_test working in this PR. It's too much of a headache. We will need to do several passes of refactoring on compiler after this PR is landed.
fd93825
to
fd4b392
Compare
4735a30
to
6fe1a69
Compare
This is a major refactor of internal compiler. Before: JS and TS both were sent through the typescript compiler where their imports were parsed and handled. Both compiled to AMD JS and finally sent to V8 Now: JS is sent directly into V8. TS is sent through the typescript compiler, but tsc generates ES modules now instead of AMD. This generated JS is then dumped into V8. This should much faster for pure JS code. It may improve TS compilation speed. In the future this allows us to separate TS out of the runtime heap and into its own dedicated snapshot. This will result in a smaller runtime heap, and thus should be faster. Many tests had to be disabled to make this happen. Apologies - but as you can see this is a very complex patch - and I had to sledge hammer it into place in a few places. Also worth noting that this is necessary to support WASM
@@ -25,17 +25,6 @@ test(function btoaFailed() { | |||
assertEqual(err.name, "InvalidInput"); | |||
}); | |||
|
|||
test(function textDecoder() { |
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.
Why does this test need to go? It no longer passes?
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.
The issue is that this file isn't valid UTF-8, it dies on v8::String::NewFromUtf8
... I'm not sure how it worked before. I will investigate...
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.
Currently code is loaded through the CodeFetch op. The source code is passed through the flatbuffer message and decoded by the flatbuffer library on the JS side. Looking at that source code, it does not die on invalid utf-8 input:
https://github.com/denoland/deno_third_party/blob/de4fbe4edfdabfbd053a0cca1bb113cfc97da73b/node_modules/flatbuffers/js/flatbuffers.js#L1082-L1138
With this change, source code is loaded more directly in C++ using v8::String::NewFromUtf8
, which appear to be stricter.
There's no obvious solution to this.... I could run the source code through some sort of sanitizer first?
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.
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.
I see lots of loose ends but nothing that looks like an oversight on your part.
Please save the encoding tests tho...
I'm going to approve this now so you you're not going to be held up.
But don't throw away the encoding tests pls...
Major refactor of internal compiler.
Before: JS and TS both were sent through the typescript compiler where their imports were parsed and handled. Both compiled to AMD JS and finally sent to V8
Now: JS is sent directly into V8. TS is sent through the typescript compiler, but tsc generates ES modules now instead of AMD. This generated JS is then dumped into V8.
This should much faster for pure JS code. It may improve TS compilation speed.
In the future this allows us to separate TS out of the runtime heap and into its own dedicated snapshot. This will result in a smaller runtime heap, and thus should be faster.
Many tests had to be disabled to make this happen. Apologies - but as you can see this is a very complex patch - and I had to sledge hammer it into place in a few places.
Also worth noting that this is necessary to support WASM
Fixes #975
Fixes #1190
Preliminary PRs:
Revert "Split Runner from Compiler" #1462Add libdeno.builtinModules #1463Minimal Worker support #1476