Skip to content

Commit

Permalink
feat(heap): ArrayBuffer (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
aapoalas authored Oct 15, 2023
1 parent 23c0e7f commit a67d4d4
Show file tree
Hide file tree
Showing 6 changed files with 494 additions and 15 deletions.
6 changes: 5 additions & 1 deletion nova_vm/src/heap.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod array;
mod array_buffer;
mod bigint;
mod boolean;
mod date;
Expand All @@ -17,9 +18,9 @@ mod string;
mod symbol;

pub use self::heap_constants::BuiltinObjectIndexes;

use self::{
array::{initialize_array_heap, ArrayHeapData},
array_buffer::{initialize_array_buffer_heap, ArrayBufferHeapData},
bigint::{initialize_bigint_heap, BigIntHeapData},
boolean::initialize_boolean_heap,
date::{initialize_date_heap, DateHeapData},
Expand Down Expand Up @@ -57,6 +58,7 @@ pub struct Heap {
/// a HashMap of possible property descriptors.
pub elements: ElementArrays,
pub arrays: Vec<Option<ArrayHeapData>>,
pub array_buffers: Vec<Option<ArrayBufferHeapData>>,
pub bigints: Vec<Option<BigIntHeapData>>,
pub errors: Vec<Option<ErrorHeapData>>,
pub functions: Vec<Option<FunctionHeapData>>,
Expand Down Expand Up @@ -181,6 +183,7 @@ impl Heap {
e2pow32: ElementArray2Pow32::default(),
},
arrays: Vec::with_capacity(1024),
array_buffers: Vec::with_capacity(1024),
bigints: Vec::with_capacity(1024),
errors: Vec::with_capacity(1024),
functions: Vec::with_capacity(1024),
Expand All @@ -204,6 +207,7 @@ impl Heap {
}
}
initialize_array_heap(&mut heap);
initialize_array_buffer_heap(&mut heap);
initialize_bigint_heap(&mut heap);
initialize_boolean_heap(&mut heap);
initialize_date_heap(&mut heap);
Expand Down
Loading

0 comments on commit a67d4d4

Please sign in to comment.