Skip to content

Commit 423b1fb

Browse files
committed
removed serialized_heap
1 parent 234724d commit 423b1fb

File tree

22 files changed

+47
-660
lines changed

22 files changed

+47
-660
lines changed

Cargo.lock

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ members = [
44
"src/brimstone_icu_collections",
55
"src/brimstone_macros",
66
"src/js",
7-
"src/brimstone_serialized_heap",
87
"tests",
98
"tests/fuzz",
109
"tests/harness",
@@ -22,7 +21,6 @@ brimstone = { path = "src" }
2221
brimstone_core = { path = "src/js" }
2322
brimstone_icu_collections = { path = "src/brimstone_icu_collections" }
2423
brimstone_macros = { path = "src/brimstone_macros" }
25-
brimstone_serialized_heap = { path = "src/brimstone_serialized_heap" }
2624

2725

2826
# External Crates

TODO.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- [ ] no_std support
2+
3+
- [ ] debugger
4+
- [ ] rust native memory allocator
5+
- [ ] oxc's js parser
6+
- [ ] crate rust's future beside js's loop
7+
- [ ] add promise hook
8+
- [ ] add compat to serde_json

src/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ bitflags.workspace = true
1414
clap = { workspace = true, features = ["derive"] }
1515

1616
brimstone_core.workspace = true
17-
brimstone_serialized_heap.workspace = true
1817
parking_lot.workspace = true
1918
once_cell.workspace = true
2019

src/benches/benches.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::{
2+
path::Path,
23
rc::Rc,
34
time::{Duration, Instant},
45
};
56

67
use bitflags::bitflags;
78
use brimstone_core::{
8-
common::{options::OptionsBuilder, serialized_heap::get_default_serialized_heap},
9+
common::{options::OptionsBuilder, wtf_8::Wtf8String},
910
parser::{
1011
analyze::{analyze, AnalyzedProgramResult},
1112
parse_module, parse_script,
@@ -71,8 +72,16 @@ fn setup_step(file: &str, flags: TestFlags) -> (Context, ParseContext) {
7172
.set_options(Rc::new(options))
7273
.build()
7374
.unwrap();
74-
let source = Rc::new(Source::new_from_file(&format!("benches/{file}")).unwrap());
75-
let pcx = ParseContext::new(source);
75+
let file = Path::new(&format!("benches/{file}"))
76+
.canonicalize()
77+
.unwrap();
78+
let file_content_string = std::fs::read_to_string(&file).unwrap();
79+
let source = Source::new_for_string(
80+
file.to_str().unwrap(),
81+
Wtf8String::from_string(file_content_string),
82+
)
83+
.unwrap();
84+
let pcx = ParseContext::new(Rc::new(source));
7685
(cx, pcx)
7786
}
7887

@@ -191,20 +200,14 @@ fn bench_program_all_steps(c: &mut Criterion, file: &str, flags: TestFlags) {
191200
);
192201
}
193202

194-
fn init() {
195-
brimstone_serialized_heap::init();
196-
}
197-
198203
/// Benchmark context creation.
199204
fn context_benches(c: &mut Criterion) {
200-
init();
201-
202205
isolated_test(
203206
c,
204207
"context creation",
205208
|| {},
206209
|_| {
207-
let options = OptionsBuilder::new().serialized_heap(None).build();
210+
let options = OptionsBuilder::new().build();
208211
let cx = ContextBuilder::new()
209212
.set_options(Rc::new(options))
210213
.build()
@@ -219,10 +222,7 @@ fn context_benches(c: &mut Criterion) {
219222
"context deserialization",
220223
|| {},
221224
|_| {
222-
let serialized_heap = get_default_serialized_heap().unwrap();
223-
let options = OptionsBuilder::new()
224-
.serialized_heap(Some(serialized_heap))
225-
.build();
225+
let options = OptionsBuilder::new().build();
226226
let cx = ContextBuilder::new()
227227
.set_options(Rc::new(options))
228228
.build()
@@ -234,8 +234,6 @@ fn context_benches(c: &mut Criterion) {
234234
}
235235

236236
pub fn program_benches(c: &mut Criterion) {
237-
init();
238-
239237
bench_program_all_steps(c, "empty.js", TestFlags::empty());
240238
bench_program_parser(c, "fixtures/acorn.js", TestFlags::empty());
241239
bench_program_parser(c, "fixtures/react.js", TestFlags::empty());

src/brimstone_serialized_heap/Cargo.toml

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/brimstone_serialized_heap/build.rs

Lines changed: 0 additions & 107 deletions
This file was deleted.

src/brimstone_serialized_heap/src/lib.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/js/common/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub mod macros;
77
pub mod math;
88
pub mod memory;
99
pub mod options;
10-
pub mod serialized_heap;
1110
pub mod string;
1211
pub mod string_iterators;
1312
pub mod time;

src/js/common/options.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use alloc::string::String;
22
use parking_lot::{Mutex, MutexGuard};
33

4-
use super::{
5-
constants::DEFAULT_HEAP_SIZE,
6-
serialized_heap::{get_default_serialized_heap, SerializedHeap},
7-
};
4+
use super::constants::DEFAULT_HEAP_SIZE;
85

96
/// Options passed throughout the program.
107
pub struct Options {
@@ -28,9 +25,6 @@ pub struct Options {
2825

2926
/// Whether to use colors when printing to the terminal
3027
pub parse_stats: bool,
31-
32-
/// Create the heap from this SerializedHeap if set, otherwise create heap from scratch.
33-
pub serialized_heap: Option<&'static SerializedHeap<'static>>,
3428
}
3529

3630
impl Options {
@@ -64,7 +58,6 @@ impl OptionsBuilder {
6458
dump_buffer: None,
6559
heap_size: DEFAULT_HEAP_SIZE,
6660
parse_stats: false,
67-
serialized_heap: get_default_serialized_heap(),
6861
})
6962
}
7063

@@ -107,12 +100,4 @@ impl OptionsBuilder {
107100
self.0.parse_stats = parse_stats;
108101
self
109102
}
110-
111-
pub fn serialized_heap(
112-
mut self,
113-
serialized_heap: Option<&'static SerializedHeap<'static>>,
114-
) -> Self {
115-
self.0.serialized_heap = serialized_heap;
116-
self
117-
}
118103
}

0 commit comments

Comments
 (0)