1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

ignore "use asm" (#9019)

Preventing V8 from logging erroneous line numbers. Use wasm.
This commit is contained in:
Anonymous 2021-01-07 07:50:57 -08:00 committed by GitHub
parent 9b3338fa2f
commit b40d5e5e0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 0 deletions

View file

@ -3521,6 +3521,23 @@ itest!(inline_js_source_map_with_contents_from_graph {
http_server: true,
});
#[test]
fn no_validate_asm() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.arg("run")
.arg("cli/tests/no_validate_asm.js")
.stderr(std::process::Stdio::piped())
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
.wait_with_output()
.unwrap();
assert!(output.status.success());
assert!(output.stderr.is_empty());
assert!(output.stdout.is_empty());
}
#[test]
fn cafile_env_fetch() {
use deno_core::url::Url;

View file

@ -0,0 +1,20 @@
// V8 logs any asmjs validation errors to stdout, but it shows line numbers that
// are non-existent in the source.
const asmJsModule = function () {
"use asm";
function func(
x,
) {
x = +x; // cast to float
~x;
// asmjs error: `~` is only valid on integers
// should not log to stdout with --no-validate-asm
}
return {
f: func,
};
}();

View file

@ -158,6 +158,7 @@ pub unsafe fn v8_init() {
"--wasm-test-streaming".to_string(),
"--no-wasm-async-compilation".to_string(),
"--harmony-top-level-await".to_string(),
"--no-validate-asm".to_string(),
];
v8::V8::set_flags_from_command_line(argv);
}