Skip to content

Commit

Permalink
Merge f67c197 into 456da49
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat authored May 20, 2022
2 parents 456da49 + f67c197 commit cc99501
Show file tree
Hide file tree
Showing 75 changed files with 2,127 additions and 993 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion boa_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct Opt {
#[clap(long, short = 'a', value_name = "FORMAT", ignore_case = true, arg_enum)]
dump_ast: Option<Option<DumpFormat>>,

/// Dump the AST to stdout with the given format.
/// Dump the compiled bytecode and trace the execution stack
#[clap(long = "trace", short = 't')]
trace: bool,

Expand Down
4 changes: 4 additions & 0 deletions boa_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ readme = "../README.md"
[features]
profiler = ["boa_profiler/profiler"]
deser = ["boa_interner/serde"]
nan_boxing = []

# Enable Boa's WHATWG console object implementation.
console = []
Expand Down Expand Up @@ -42,6 +43,9 @@ dyn-clone = "1.0.5"
once_cell = "1.10.0"
tap = "1.0.1"
icu = "0.5.0"
sptr = "0.3.1"
cfg-if = "1.0.0"
num_enum = "0.5.7"

[dev-dependencies]
criterion = "0.3.5"
Expand Down
13 changes: 12 additions & 1 deletion boa_engine/src/bigint.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! This module implements the JavaScript bigint primitive rust type.
use crate::{builtins::Number, Context, JsValue};
use crate::{builtins::Number, value::PointerType, Context, JsValue};
use boa_gc::{unsafe_empty_trace, Finalize, Trace};
use num_integer::Integer;
use num_traits::{pow::Pow, FromPrimitive, One, ToPrimitive, Zero};
use std::{
fmt::{self, Display},
mem::{self, ManuallyDrop},
ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub},
rc::Rc,
};
Expand All @@ -23,6 +24,16 @@ pub struct JsBigInt {
inner: Rc<RawBigInt>,
}

unsafe impl PointerType for JsBigInt {
unsafe fn from_void_ptr(ptr: *mut ()) -> ManuallyDrop<Self> {
ManuallyDrop::new(mem::transmute(ptr))
}

unsafe fn into_void_ptr(bigint: ManuallyDrop<Self>) -> *mut () {
mem::transmute(bigint)
}
}

// Safety: BigInt does not contain any objects which needs to be traced,
// so this is safe.
unsafe impl Trace for JsBigInt {
Expand Down
3 changes: 2 additions & 1 deletion boa_engine/src/builtins/array/array_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ impl ArrayIterator {
///
/// [spec]: https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
pub(crate) fn next(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
let mut array_iterator = this.as_object().map(JsObject::borrow_mut);
let array_iterator = this.as_object();
let mut array_iterator = array_iterator.as_deref().map(JsObject::borrow_mut);
let array_iterator = array_iterator
.as_mut()
.and_then(|obj| obj.as_array_iterator_mut())
Expand Down
Loading

0 comments on commit cc99501

Please sign in to comment.