Browse Source

Merge pull request #312 from jasonwilliams/fix_309

pull/330/head
HalidOdat 5 years ago committed by GitHub
parent
commit
44de1901ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      Cargo.lock
  2. 3
      boa/Cargo.toml
  3. 7
      boa/benches/exec.rs
  4. 7
      boa/benches/lexer.rs
  5. 7
      boa/benches/parser.rs
  6. 3
      boa_cli/Cargo.toml
  7. 60
      boa_cli/src/main.rs

35
Cargo.lock generated

@ -7,6 +7,7 @@ dependencies = [
"criterion", "criterion",
"gc", "gc",
"gc_derive", "gc_derive",
"jemallocator",
"rand", "rand",
"regex", "regex",
"serde", "serde",
@ -60,6 +61,7 @@ name = "boa_cli"
version = "0.7.0" version = "0.7.0"
dependencies = [ dependencies = [
"Boa", "Boa",
"jemallocator",
"structopt", "structopt",
] ]
@ -96,6 +98,12 @@ dependencies = [
"rustc_version", "rustc_version",
] ]
[[package]]
name = "cc"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "0.1.10" version = "0.1.10"
@ -227,6 +235,12 @@ version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
[[package]]
name = "fs_extra"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
[[package]] [[package]]
name = "gc" name = "gc"
version = "0.3.3" version = "0.3.3"
@ -288,6 +302,27 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
[[package]]
name = "jemalloc-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
dependencies = [
"cc",
"fs_extra",
"libc",
]
[[package]]
name = "jemallocator"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
dependencies = [
"jemalloc-sys",
"libc",
]
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.37" version = "0.3.37"

3
boa/Cargo.toml

@ -28,6 +28,9 @@ serde = { version = "1.0.106", features = ["derive"], optional = true }
[dev-dependencies] [dev-dependencies]
criterion = "0.3.1" criterion = "0.3.1"
[target.x86_64-unknown-linux-gnu.dev-dependencies]
jemallocator = "0.3.2"
[lib] [lib]
crate-type = ["cdylib", "lib"] crate-type = ["cdylib", "lib"]
name = "boa" name = "boa"

7
boa/benches/exec.rs

@ -3,6 +3,13 @@
use boa::{exec, realm::Realm}; use boa::{exec, realm::Realm};
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
static SYMBOL_CREATION: &str = r#" static SYMBOL_CREATION: &str = r#"
let a = Symbol(); let a = Symbol();
let b = Symbol(); let b = Symbol();

7
boa/benches/lexer.rs

@ -3,6 +3,13 @@
use boa::syntax::lexer::Lexer; use boa::syntax::lexer::Lexer;
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
static EXPRESSION: &str = r#" static EXPRESSION: &str = r#"
1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1; 1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1;
"#; "#;

7
boa/benches/parser.rs

@ -3,6 +3,13 @@
use boa::syntax::{lexer::Lexer, parser::Parser}; use boa::syntax::{lexer::Lexer, parser::Parser};
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
static EXPRESSION: &str = r#" static EXPRESSION: &str = r#"
1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1; 1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1;
"#; "#;

3
boa_cli/Cargo.toml

@ -14,6 +14,9 @@ edition = "2018"
Boa = { path = "../boa", features = ["serde-ast"], default-features = false } Boa = { path = "../boa", features = ["serde-ast"], default-features = false }
structopt = "0.3.13" structopt = "0.3.13"
[target.x86_64-unknown-linux-gnu.dependencies]
jemallocator = "0.3.2"
[[bin]] [[bin]]
name = "boa" name = "boa"
path = "src/main.rs" path = "src/main.rs"

60
boa_cli/src/main.rs

@ -1,15 +1,51 @@
#![deny(unused_qualifications, clippy::correctness, clippy::style)] #![deny(
#![warn(clippy::perf)] unused_qualifications,
#![allow(clippy::cognitive_complexity)] clippy::all,
unused_qualifications,
use boa::builtins::console::log; unused_import_braces,
use boa::serde_json; unused_lifetimes,
use boa::syntax::ast::{node::Node, token::Token}; unreachable_pub,
use boa::{exec::Executor, forward_val, realm::Realm}; trivial_numeric_casts,
use std::io::{self, Write}; rustdoc,
use std::{fs::read_to_string, path::PathBuf}; missing_debug_implementations,
use structopt::clap::arg_enum; missing_copy_implementations,
use structopt::StructOpt; deprecated_in_future,
non_ascii_idents,
rust_2018_compatibility,
rust_2018_idioms,
future_incompatible,
nonstandard_style
)]
#![warn(clippy::perf, clippy::single_match_else, clippy::dbg_macro)]
#![allow(
clippy::missing_inline_in_public_items,
clippy::cognitive_complexity,
clippy::must_use_candidate,
clippy::missing_errors_doc,
clippy::as_conversions
)]
use boa::{
builtins::console::log,
exec::Executor,
forward_val,
realm::Realm,
serde_json,
syntax::ast::{node::Node, token::Token},
};
use std::{
fs::read_to_string,
io::{self, Write},
path::PathBuf,
};
use structopt::{clap::arg_enum, StructOpt};
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
/// CLI configuration for Boa. /// CLI configuration for Boa.
// //

Loading…
Cancel
Save