diff --git a/boa_ast/src/expression/access.rs b/boa_ast/src/expression/access.rs index 9a8abe348a..b3b8abd625 100644 --- a/boa_ast/src/expression/access.rs +++ b/boa_ast/src/expression/access.rs @@ -151,7 +151,6 @@ impl SimplePropertyAccess { } /// Creates a `PropertyAccess` AST Expression. - #[inline] pub fn new(target: Expression, field: F) -> Self where F: Into, diff --git a/boa_ast/src/expression/await.rs b/boa_ast/src/expression/await.rs index 079bf831c3..602e93148c 100644 --- a/boa_ast/src/expression/await.rs +++ b/boa_ast/src/expression/await.rs @@ -35,7 +35,6 @@ impl From for Await where T: Into>, { - #[inline] fn from(e: T) -> Self { Self { target: e.into() } } diff --git a/boa_ast/src/expression/literal/array.rs b/boa_ast/src/expression/literal/array.rs index 2f599d12cf..81decbceb9 100644 --- a/boa_ast/src/expression/literal/array.rs +++ b/boa_ast/src/expression/literal/array.rs @@ -165,7 +165,6 @@ impl From for ArrayLiteral where T: Into]>>, { - #[inline] fn from(decl: T) -> Self { Self { arr: decl.into(), diff --git a/boa_ast/src/expression/literal/object.rs b/boa_ast/src/expression/literal/object.rs index 61f023418e..f9356ec0f4 100644 --- a/boa_ast/src/expression/literal/object.rs +++ b/boa_ast/src/expression/literal/object.rs @@ -289,7 +289,6 @@ impl From for ObjectLiteral where T: Into>, { - #[inline] fn from(props: T) -> Self { Self { properties: props.into(), diff --git a/boa_ast/src/expression/operator/assign/mod.rs b/boa_ast/src/expression/operator/assign/mod.rs index 588c844946..095c586ccd 100644 --- a/boa_ast/src/expression/operator/assign/mod.rs +++ b/boa_ast/src/expression/operator/assign/mod.rs @@ -38,6 +38,7 @@ pub struct Assign { impl Assign { /// Creates an `Assign` AST Expression. + #[inline] #[must_use] pub fn new(op: AssignOp, lhs: AssignTarget, rhs: Expression) -> Self { Self { diff --git a/boa_ast/src/expression/operator/binary/mod.rs b/boa_ast/src/expression/operator/binary/mod.rs index c39466056f..a9e91cdc3a 100644 --- a/boa_ast/src/expression/operator/binary/mod.rs +++ b/boa_ast/src/expression/operator/binary/mod.rs @@ -41,6 +41,7 @@ pub struct Binary { impl Binary { /// Creates a `BinOp` AST Expression. + #[inline] #[must_use] pub fn new(op: BinaryOp, lhs: Expression, rhs: Expression) -> Self { Self { diff --git a/boa_ast/src/expression/operator/unary/mod.rs b/boa_ast/src/expression/operator/unary/mod.rs index 9c133e86e7..b2865610d0 100644 --- a/boa_ast/src/expression/operator/unary/mod.rs +++ b/boa_ast/src/expression/operator/unary/mod.rs @@ -39,6 +39,7 @@ pub struct Unary { impl Unary { /// Creates a new `UnaryOp` AST Expression. + #[inline] #[must_use] pub fn new(op: UnaryOp, target: Expression) -> Self { Self { diff --git a/boa_ast/src/function/async_arrow_function.rs b/boa_ast/src/function/async_arrow_function.rs index 378dbfe8c0..e47baf696b 100644 --- a/boa_ast/src/function/async_arrow_function.rs +++ b/boa_ast/src/function/async_arrow_function.rs @@ -51,11 +51,10 @@ impl AsyncArrowFunction { } /// Sets the name of the function declaration. - //#[inline] - //#[must_use] - //pub fn set_name(&mut self, name: Option) { - // self.name = name; - //} + #[inline] + pub fn set_name(&mut self, name: Option) { + self.name = name; + } /// Gets the list of parameters of the arrow function. #[inline] diff --git a/boa_ast/src/operations.rs b/boa_ast/src/operations.rs index 0a95273fc8..e2aa9141ce 100644 --- a/boa_ast/src/operations.rs +++ b/boa_ast/src/operations.rs @@ -55,7 +55,6 @@ pub enum ContainsSymbol { /// /// [spec]: https://tc39.es/ecma262/#sec-static-semantics-contains #[must_use] -#[inline] pub fn contains(node: &N, symbol: ContainsSymbol) -> bool where N: VisitWith, @@ -67,27 +66,22 @@ where impl<'ast> Visitor<'ast> for ContainsVisitor { type BreakTy = (); - #[inline] fn visit_function(&mut self, _: &'ast Function) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_async_function(&mut self, _: &'ast AsyncFunction) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_generator(&mut self, _: &'ast Generator) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_async_generator(&mut self, _: &'ast AsyncGenerator) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_class(&mut self, node: &'ast Class) -> ControlFlow { if !node.elements().is_empty() && self.0 == ContainsSymbol::ClassBody { return ControlFlow::Break(()); @@ -101,7 +95,6 @@ where } // `ComputedPropertyContains`: https://tc39.es/ecma262/#sec-static-semantics-computedpropertycontains - #[inline] fn visit_class_element(&mut self, node: &'ast ClassElement) -> ControlFlow { match node { ClassElement::MethodDefinition(name, _) @@ -112,7 +105,6 @@ where } } - #[inline] fn visit_property_definition( &mut self, node: &'ast PropertyDefinition, @@ -127,7 +119,6 @@ where node.visit_with(self) } - #[inline] fn visit_arrow_function( &mut self, node: &'ast ArrowFunction, @@ -147,7 +138,6 @@ where node.visit_with(self) } - #[inline] fn visit_async_arrow_function( &mut self, node: &'ast AsyncArrowFunction, @@ -167,7 +157,6 @@ where node.visit_with(self) } - #[inline] fn visit_super_property_access( &mut self, node: &'ast SuperPropertyAccess, @@ -178,7 +167,6 @@ where node.visit_with(self) } - #[inline] fn visit_super_call(&mut self, node: &'ast SuperCall) -> ControlFlow { if [ContainsSymbol::SuperCall, ContainsSymbol::Super].contains(&self.0) { return ControlFlow::Break(()); @@ -186,7 +174,6 @@ where node.visit_with(self) } - #[inline] fn visit_yield(&mut self, node: &'ast Yield) -> ControlFlow { if self.0 == ContainsSymbol::YieldExpression { return ControlFlow::Break(()); @@ -195,7 +182,6 @@ where node.visit_with(self) } - #[inline] fn visit_await(&mut self, node: &'ast Await) -> ControlFlow { if self.0 == ContainsSymbol::AwaitExpression { return ControlFlow::Break(()); @@ -204,7 +190,6 @@ where node.visit_with(self) } - #[inline] fn visit_expression(&mut self, node: &'ast Expression) -> ControlFlow { if node == &Expression::This && self.0 == ContainsSymbol::This { return ControlFlow::Break(()); @@ -236,7 +221,6 @@ where impl<'ast> Visitor<'ast> for ContainsArgsVisitor { type BreakTy = (); - #[inline] fn visit_identifier(&mut self, node: &'ast Identifier) -> ControlFlow { if node.sym() == Sym::ARGUMENTS { ControlFlow::Break(()) @@ -245,27 +229,22 @@ where } } - #[inline] fn visit_function(&mut self, _: &'ast Function) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_async_function(&mut self, _: &'ast AsyncFunction) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_generator(&mut self, _: &'ast Generator) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_async_generator(&mut self, _: &'ast AsyncGenerator) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_class_element(&mut self, node: &'ast ClassElement) -> ControlFlow { match node { ClassElement::MethodDefinition(name, _) @@ -275,7 +254,6 @@ where node.visit_with(self) } - #[inline] fn visit_property_definition( &mut self, node: &'ast PropertyDefinition, @@ -314,21 +292,18 @@ trait IdentList { } impl IdentList for Vec { - #[inline] fn add(&mut self, value: Identifier, _function: bool) { self.push(value); } } impl IdentList for Vec<(Identifier, bool)> { - #[inline] fn add(&mut self, value: Identifier, function: bool) { self.push((value, function)); } } impl IdentList for FxHashSet { - #[inline] fn add(&mut self, value: Identifier, _function: bool) { self.insert(value); } @@ -341,45 +316,44 @@ struct BoundNamesVisitor<'a, T: IdentList>(&'a mut T); impl<'ast, T: IdentList> Visitor<'ast> for BoundNamesVisitor<'_, T> { type BreakTy = Infallible; - #[inline] fn visit_identifier(&mut self, node: &'ast Identifier) -> ControlFlow { self.0.add(*node, false); ControlFlow::Continue(()) } - #[inline] + fn visit_expression(&mut self, _: &'ast Expression) -> ControlFlow { ControlFlow::Continue(()) } + // TODO: add "*default" for module default functions without name - #[inline] fn visit_function(&mut self, node: &'ast Function) -> ControlFlow { if let Some(ident) = node.name() { self.0.add(ident, true); } ControlFlow::Continue(()) } - #[inline] + fn visit_generator(&mut self, node: &'ast Generator) -> ControlFlow { if let Some(ident) = node.name() { self.0.add(ident, false); } ControlFlow::Continue(()) } - #[inline] + fn visit_async_function(&mut self, node: &'ast AsyncFunction) -> ControlFlow { if let Some(ident) = node.name() { self.0.add(ident, false); } ControlFlow::Continue(()) } - #[inline] + fn visit_async_generator(&mut self, node: &'ast AsyncGenerator) -> ControlFlow { if let Some(ident) = node.name() { self.0.add(ident, false); } ControlFlow::Continue(()) } - #[inline] + fn visit_class(&mut self, node: &'ast Class) -> ControlFlow { if let Some(ident) = node.name() { self.0.add(ident, false); @@ -394,7 +368,6 @@ impl<'ast, T: IdentList> Visitor<'ast> for BoundNamesVisitor<'_, T> { /// /// [spec]: https://tc39.es/ecma262/#sec-static-semantics-boundnames #[must_use] -#[inline] pub fn bound_names<'a, N>(node: &'a N) -> Vec where &'a N: Into>, @@ -411,54 +384,45 @@ struct LexicallyDeclaredNamesVisitor<'a, T: IdentList>(&'a mut T); impl<'ast, T: IdentList> Visitor<'ast> for LexicallyDeclaredNamesVisitor<'_, T> { type BreakTy = Infallible; - #[inline] + fn visit_expression(&mut self, _: &'ast Expression) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] fn visit_statement(&mut self, node: &'ast Statement) -> ControlFlow { if let Statement::Labelled(labelled) = node { return self.visit_labelled(labelled); } ControlFlow::Continue(()) } - #[inline] fn visit_declaration(&mut self, node: &'ast Declaration) -> ControlFlow { BoundNamesVisitor(self.0).visit_declaration(node) } - #[inline] fn visit_labelled_item(&mut self, node: &'ast LabelledItem) -> ControlFlow { match node { LabelledItem::Function(f) => BoundNamesVisitor(self.0).visit_function(f), LabelledItem::Statement(_) => ControlFlow::Continue(()), } } - #[inline] fn visit_function(&mut self, node: &'ast Function) -> ControlFlow { top_level_lexicals(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] fn visit_async_function(&mut self, node: &'ast AsyncFunction) -> ControlFlow { top_level_lexicals(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] fn visit_generator(&mut self, node: &'ast Generator) -> ControlFlow { top_level_lexicals(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] fn visit_async_generator(&mut self, node: &'ast AsyncGenerator) -> ControlFlow { top_level_lexicals(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] fn visit_arrow_function(&mut self, node: &'ast ArrowFunction) -> ControlFlow { top_level_lexicals(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] fn visit_async_arrow_function( &mut self, node: &'ast AsyncArrowFunction, @@ -466,7 +430,6 @@ impl<'ast, T: IdentList> Visitor<'ast> for LexicallyDeclaredNamesVisitor<'_, T> top_level_lexicals(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] fn visit_class_element(&mut self, node: &'ast ClassElement) -> ControlFlow { if let ClassElement::StaticBlock(stmts) = node { top_level_lexicals(stmts, self.0); @@ -485,7 +448,6 @@ impl<'ast, T: IdentList> Visitor<'ast> for LexicallyDeclaredNamesVisitor<'_, T> /// /// [spec]: https://tc39.es/ecma262/#sec-static-semantics-lexicallydeclarednames #[must_use] -#[inline] pub fn lexically_declared_names<'a, N>(node: &'a N) -> Vec where &'a N: Into>, @@ -503,7 +465,6 @@ where /// [spec]: https://tc39.es/ecma262/#sec-static-semantics-lexicallydeclarednames /// [changes]: https://tc39.es/ecma262/#sec-block-duplicates-allowed-static-semantics #[must_use] -#[inline] pub fn lexically_declared_names_legacy<'a, N>(node: &'a N) -> Vec<(Identifier, bool)> where &'a N: Into>, @@ -519,51 +480,51 @@ struct VarDeclaredNamesVisitor<'a>(&'a mut FxHashSet); impl<'ast> Visitor<'ast> for VarDeclaredNamesVisitor<'_> { type BreakTy = Infallible; - #[inline] + fn visit_expression(&mut self, _: &'ast Expression) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] + fn visit_declaration(&mut self, _: &'ast Declaration) -> ControlFlow { ControlFlow::Continue(()) } - #[inline] + fn visit_var_declaration(&mut self, node: &'ast VarDeclaration) -> ControlFlow { BoundNamesVisitor(self.0).visit_var_declaration(node) } - #[inline] + fn visit_labelled_item(&mut self, node: &'ast LabelledItem) -> ControlFlow { match node { LabelledItem::Function(_) => ControlFlow::Continue(()), LabelledItem::Statement(stmt) => stmt.visit_with(self), } } - #[inline] + fn visit_function(&mut self, node: &'ast Function) -> ControlFlow { top_level_vars(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] + fn visit_async_function(&mut self, node: &'ast AsyncFunction) -> ControlFlow { top_level_vars(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] + fn visit_generator(&mut self, node: &'ast Generator) -> ControlFlow { top_level_vars(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] + fn visit_async_generator(&mut self, node: &'ast AsyncGenerator) -> ControlFlow { top_level_vars(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] + fn visit_arrow_function(&mut self, node: &'ast ArrowFunction) -> ControlFlow { top_level_vars(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] + fn visit_async_arrow_function( &mut self, node: &'ast AsyncArrowFunction, @@ -571,7 +532,7 @@ impl<'ast> Visitor<'ast> for VarDeclaredNamesVisitor<'_> { top_level_vars(node.body(), self.0); ControlFlow::Continue(()) } - #[inline] + fn visit_class_element(&mut self, node: &'ast ClassElement) -> ControlFlow { if let ClassElement::StaticBlock(stmts) = node { top_level_vars(stmts, self.0); @@ -590,7 +551,6 @@ impl<'ast> Visitor<'ast> for VarDeclaredNamesVisitor<'_> { /// /// [spec]: https://tc39.es/ecma262/#sec-static-semantics-vardeclarednames #[must_use] -#[inline] pub fn var_declared_names<'a, N>(node: &'a N) -> FxHashSet where &'a N: Into>, @@ -601,7 +561,6 @@ where } /// Utility function that collects the top level lexicals of a statement list into `names`. -#[inline] fn top_level_lexicals(stmts: &StatementList, names: &mut T) { for stmt in stmts.statements() { if let StatementListItem::Declaration(decl) = stmt { @@ -638,7 +597,6 @@ pub fn top_level_lexically_declared_names(stmts: &StatementList) -> Vec) { for stmt in stmts.statements() { match stmt { diff --git a/boa_ast/src/position.rs b/boa_ast/src/position.rs index 36cd621358..9286474327 100644 --- a/boa_ast/src/position.rs +++ b/boa_ast/src/position.rs @@ -91,7 +91,6 @@ impl Span { } /// Checks if this span inclusively contains another span or position. - #[inline] pub fn contains(self, other: S) -> bool where S: Into, diff --git a/boa_ast/src/statement/block.rs b/boa_ast/src/statement/block.rs index beeea6fb3c..5f926d6284 100644 --- a/boa_ast/src/statement/block.rs +++ b/boa_ast/src/statement/block.rs @@ -43,7 +43,6 @@ impl From for Block where T: Into, { - #[inline] fn from(list: T) -> Self { Self { statements: list.into(), diff --git a/boa_ast/src/statement/if.rs b/boa_ast/src/statement/if.rs index 0a9445ac74..141bfb5637 100644 --- a/boa_ast/src/statement/if.rs +++ b/boa_ast/src/statement/if.rs @@ -56,6 +56,7 @@ impl If { } /// Creates an `If` AST node. + #[inline] #[must_use] pub fn new(condition: Expression, body: Statement, else_node: Option) -> Self { Self { diff --git a/boa_ast/src/statement/labelled.rs b/boa_ast/src/statement/labelled.rs index 1fb5cdd3c4..9f9c46c507 100644 --- a/boa_ast/src/statement/labelled.rs +++ b/boa_ast/src/statement/labelled.rs @@ -91,6 +91,7 @@ pub struct Labelled { impl Labelled { /// Creates a new `Labelled` statement. + #[inline] #[must_use] pub fn new(item: LabelledItem, label: Sym) -> Self { Self { @@ -100,12 +101,14 @@ impl Labelled { } /// Gets the labelled item. + #[inline] #[must_use] pub const fn item(&self) -> &LabelledItem { &self.item } /// Gets the label name. + #[inline] #[must_use] pub const fn label(&self) -> Sym { self.label diff --git a/boa_cli/src/helper.rs b/boa_cli/src/helper.rs index cd4f723e0c..b86707317f 100644 --- a/boa_cli/src/helper.rs +++ b/boa_cli/src/helper.rs @@ -41,7 +41,6 @@ pub(crate) struct RLHelper { } impl RLHelper { - #[inline] pub(crate) fn new() -> Self { Self { highlighter: LineHighlighter, diff --git a/boa_engine/src/bigint.rs b/boa_engine/src/bigint.rs index 41e4a0be2f..a4531c3483 100644 --- a/boa_engine/src/bigint.rs +++ b/boa_engine/src/bigint.rs @@ -24,7 +24,6 @@ pub struct JsBigInt { impl JsBigInt { /// Create a new [`JsBigInt`]. - #[inline] #[must_use] pub fn new>(value: T) -> Self { value.into() @@ -289,7 +288,6 @@ impl JsBigInt { Self::new(!x.as_inner()) } - #[inline] pub(crate) fn as_inner(&self) -> &RawBigInt { &self.inner } diff --git a/boa_engine/src/builtins/array/mod.rs b/boa_engine/src/builtins/array/mod.rs index d98c3aff26..f311e5cd64 100644 --- a/boa_engine/src/builtins/array/mod.rs +++ b/boa_engine/src/builtins/array/mod.rs @@ -166,7 +166,7 @@ impl Array { let int_len = if !len.is_number() { // i. Perform ! CreateDataPropertyOrThrow(array, "0", len). array - .create_data_property_or_throw(0, len, context) + .create_data_property_or_throw(0, len.clone(), context) .expect("this CreateDataPropertyOrThrow call must not fail"); // ii. Let intLen be 1๐”ฝ. 1 @@ -595,7 +595,7 @@ impl Array { // a. Let kValue be items[k]. // b. Let Pk be ! ToString(๐”ฝ(k)). // c. Perform ? CreateDataPropertyOrThrow(A, Pk, kValue). - a.create_data_property_or_throw(k, value, context)?; + a.create_data_property_or_throw(k, value.clone(), context)?; // d. Set k to k + 1. } @@ -714,7 +714,7 @@ impl Array { .into()); } // iii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(๐”ฝ(n)), E). - arr.create_data_property_or_throw(n, item, context)?; + arr.create_data_property_or_throw(n, item.clone(), context)?; // iv. Set n to n + 1. n += 1; } @@ -1137,7 +1137,7 @@ impl Array { // e. For each element E of items, do for (j, e) in args.iter().enumerate() { // i. Perform ? Set(O, ! ToString(j), E, true). - o.set(j, e, true, context)?; + o.set(j, e.clone(), true, context)?; // ii. Set j to j + 1๐”ฝ. } } @@ -2189,7 +2189,7 @@ impl Array { .map(|(i, val)| (i as u64 + actual_start, val)) { // a. Perform ? Set(O, ! ToString(๐”ฝ(k)), E, true). - o.set(k, item, true, context)?; + o.set(k, item.clone(), true, context)?; // b. Set k to k + 1. } } diff --git a/boa_engine/src/builtins/bigint/mod.rs b/boa_engine/src/builtins/bigint/mod.rs index e4c45e163f..d7314c811e 100644 --- a/boa_engine/src/builtins/bigint/mod.rs +++ b/boa_engine/src/builtins/bigint/mod.rs @@ -110,7 +110,6 @@ impl BigInt { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-numbertobigint - #[inline] fn number_to_bigint(number: f64) -> JsResult { // 1. If IsIntegralNumber(number) is false, throw a RangeError exception. if number.is_nan() || number.is_infinite() || number.fract() != 0.0 { @@ -133,7 +132,6 @@ impl BigInt { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-thisbigintvalue - #[inline] fn this_bigint_value(value: &JsValue) -> JsResult { value // 1. If Type(value) is BigInt, return value. diff --git a/boa_engine/src/builtins/boolean/mod.rs b/boa_engine/src/builtins/boolean/mod.rs index 8f23ec18cc..1428c0d279 100644 --- a/boa_engine/src/builtins/boolean/mod.rs +++ b/boa_engine/src/builtins/boolean/mod.rs @@ -113,7 +113,6 @@ impl Boolean { /// /// [spec]: https://tc39.es/ecma262/#sec-boolean.prototype.valueof /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/valueOf - #[inline] pub(crate) fn value_of(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { Ok(JsValue::new(Self::this_boolean_value(this)?)) } diff --git a/boa_engine/src/builtins/date/mod.rs b/boa_engine/src/builtins/date/mod.rs index 4671b13646..84df5a77b2 100644 --- a/boa_engine/src/builtins/date/mod.rs +++ b/boa_engine/src/builtins/date/mod.rs @@ -59,7 +59,6 @@ macro_rules! get_mut_date { /// Abstract operation [`thisTimeValue`][spec]. /// /// [spec]: https://tc39.es/ecma262/#sec-thistimevalue -#[inline] pub(super) fn this_time_value(value: &JsValue) -> JsResult> { Ok(value .as_object() @@ -74,14 +73,12 @@ pub struct Date(Option); impl Date { /// Creates a new `Date`. - #[inline] pub(crate) const fn new(dt: Option) -> Self { Self(dt) } /// Converts the `Date` into a `JsValue`, mapping `None` to `NaN` and `Some(datetime)` to /// `JsValue::from(datetime.timestamp_millis())`. - #[inline] fn as_value(&self) -> JsValue { self.0 .map_or_else(|| f64::NAN.into(), |dt| dt.timestamp_millis().into()) @@ -664,7 +661,6 @@ impl Date { /// /// [spec]: https://tc39.es/ecma262/#sec-date.prototype.gettimezoneoffset /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset - #[inline] pub(crate) fn get_timezone_offset( this: &JsValue, _: &[JsValue], @@ -1470,7 +1466,6 @@ impl Date { /// Converts the `Date` to a local `DateTime`. /// /// If the `Date` is invalid (i.e. NAN), this function will return `None`. - #[inline] pub(crate) fn to_local(self) -> Option> { self.0.map(|utc| Local.from_utc_datetime(&utc)) } diff --git a/boa_engine/src/builtins/date/utils.rs b/boa_engine/src/builtins/date/utils.rs index 8c1ae9a174..9cd142cfe6 100644 --- a/boa_engine/src/builtins/date/utils.rs +++ b/boa_engine/src/builtins/date/utils.rs @@ -114,7 +114,6 @@ pub(super) fn make_date(day: i64, time: i64) -> Option { /// Otherwise, returns `None`. /// /// [spec]: https://tc39.es/ecma262/#sec-timeclip -#[inline] pub(super) fn time_clip(time: i64) -> Option { // 1. If time is not finite, return NaN. // 2. If abs(โ„(time)) > 8.64 ร— 10^15, return NaN. diff --git a/boa_engine/src/builtins/generator/mod.rs b/boa_engine/src/builtins/generator/mod.rs index 0a19d24db9..3303939539 100644 --- a/boa_engine/src/builtins/generator/mod.rs +++ b/boa_engine/src/builtins/generator/mod.rs @@ -265,7 +265,7 @@ impl Generator { std::mem::swap(&mut context.vm.stack, &mut generator_context.stack); context.vm.push_frame(generator_context.call_frame.clone()); if !first_execution { - context.vm.push(value); + context.vm.push(value.clone()); } context.vm.frame_mut().generator_resume_kind = GeneratorResumeKind::Normal; diff --git a/boa_engine/src/builtins/iterable/mod.rs b/boa_engine/src/builtins/iterable/mod.rs index 6bb4a0f239..6b2be2ccb8 100644 --- a/boa_engine/src/builtins/iterable/mod.rs +++ b/boa_engine/src/builtins/iterable/mod.rs @@ -131,7 +131,6 @@ impl IteratorPrototypes { /// `CreateIterResultObject( value, done )` /// /// Generates an object supporting the `IteratorResult` interface. -#[inline] pub fn create_iter_result_object(value: JsValue, done: bool, context: &mut Context) -> JsValue { let _timer = Profiler::global().start_event("create_iter_result_object", "init"); @@ -166,7 +165,6 @@ impl JsValue { /// - [ECMA reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-getiterator - #[inline] pub fn get_iterator( &self, context: &mut Context, @@ -235,7 +233,6 @@ impl JsValue { /// - [ECMA reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-%iteratorprototype%-object -#[inline] fn create_iterator_prototype(context: &mut Context) -> JsObject { let _timer = Profiler::global().start_event("Iterator Prototype", "init"); @@ -333,25 +330,21 @@ impl IteratorRecord { } /// Get the `[[Iterator]]` field of the `IteratorRecord`. - #[inline] pub(crate) const fn iterator(&self) -> &JsObject { &self.iterator } /// Get the `[[NextMethod]]` field of the `IteratorRecord`. - #[inline] pub(crate) const fn next_method(&self) -> &JsValue { &self.next_method } /// Get the `[[Done]]` field of the `IteratorRecord`. - #[inline] pub(crate) const fn done(&self) -> bool { self.done } /// Sets the `[[Done]]` field of the `IteratorRecord`. - #[inline] pub(crate) fn set_done(&mut self, done: bool) { self.done = done; } @@ -366,7 +359,6 @@ impl IteratorRecord { /// - [ECMA reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-iteratornext - #[inline] pub(crate) fn next( &self, value: Option, @@ -443,7 +435,6 @@ impl IteratorRecord { /// - [ECMA reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-iteratorclose - #[inline] pub(crate) fn close( &self, completion: JsResult, @@ -571,7 +562,6 @@ pub(crate) use if_abrupt_close_iterator; /// - [ECMA reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-asynciteratorprototype -#[inline] fn create_async_iterator_prototype(context: &mut Context) -> JsObject { let _timer = Profiler::global().start_event("AsyncIteratorPrototype", "init"); diff --git a/boa_engine/src/builtins/json/mod.rs b/boa_engine/src/builtins/json/mod.rs index 83036b2f89..f0da88dc87 100644 --- a/boa_engine/src/builtins/json/mod.rs +++ b/boa_engine/src/builtins/json/mod.rs @@ -67,7 +67,6 @@ where I::Item: Clone, { type Item = I::Item; - #[inline] fn next(&mut self) -> Option { if self.peek.is_some() { self.peek.take() diff --git a/boa_engine/src/builtins/mod.rs b/boa_engine/src/builtins/mod.rs index 5c1c215cdb..e8f9ff32ba 100644 --- a/boa_engine/src/builtins/mod.rs +++ b/boa_engine/src/builtins/mod.rs @@ -121,7 +121,6 @@ pub(crate) trait BuiltIn { /// Utility function that checks if a type implements `BuiltIn` before initializing it as a global /// built-in. -#[inline] fn init_builtin(context: &mut Context) { if let Some(value) = B::init(context) { let property = PropertyDescriptor::builder() @@ -137,7 +136,6 @@ fn init_builtin(context: &mut Context) { } /// Initializes built-in objects and functions -#[inline] pub fn init(context: &mut Context) { macro_rules! globals { ($( $builtin:ty ),*) => { diff --git a/boa_engine/src/builtins/number/conversions.rs b/boa_engine/src/builtins/number/conversions.rs index f4280c03c0..b81a8539d6 100644 --- a/boa_engine/src/builtins/number/conversions.rs +++ b/boa_engine/src/builtins/number/conversions.rs @@ -1,7 +1,6 @@ /// Converts a 64-bit floating point number to an `i32` according to the [`ToInt32`][ToInt32] algorithm. /// /// [ToInt32]: https://tc39.es/ecma262/#sec-toint32 -#[inline] #[allow(clippy::float_cmp)] pub(crate) fn f64_to_int32(number: f64) -> i32 { const SIGN_MASK: u64 = 0x8000_0000_0000_0000; @@ -14,12 +13,10 @@ pub(crate) fn f64_to_int32(number: f64) -> i32 { const EXPONENT_BIAS: i32 = 0x3FF + PHYSICAL_SIGNIFICAND_SIZE; const DENORMAL_EXPONENT: i32 = -EXPONENT_BIAS + 1; - #[inline] fn is_denormal(number: f64) -> bool { (number.to_bits() & EXPONENT_MASK) == 0 } - #[inline] fn exponent(number: f64) -> i32 { if is_denormal(number) { return DENORMAL_EXPONENT; @@ -31,7 +28,6 @@ pub(crate) fn f64_to_int32(number: f64) -> i32 { biased_e - EXPONENT_BIAS } - #[inline] fn significand(number: f64) -> u64 { let d64 = number.to_bits(); let significand = d64 & SIGNIFICAND_MASK; @@ -43,7 +39,6 @@ pub(crate) fn f64_to_int32(number: f64) -> i32 { } } - #[inline] fn sign(number: f64) -> i64 { if (number.to_bits() & SIGN_MASK) == 0 { 1 @@ -80,7 +75,6 @@ pub(crate) fn f64_to_int32(number: f64) -> i32 { /// Converts a 64-bit floating point number to an `u32` according to the [`ToUint32`][ToUint32] algorithm. /// /// [ToUint32]: https://tc39.es/ecma262/#sec-touint32 -#[inline] pub(crate) fn f64_to_uint32(number: f64) -> u32 { f64_to_int32(number) as u32 } diff --git a/boa_engine/src/builtins/number/mod.rs b/boa_engine/src/builtins/number/mod.rs index 290c6b7bbf..7118ef855a 100644 --- a/boa_engine/src/builtins/number/mod.rs +++ b/boa_engine/src/builtins/number/mod.rs @@ -530,7 +530,6 @@ impl Number { } // https://golang.org/src/math/nextafter.go - #[inline] fn next_after(x: f64, y: f64) -> f64 { if x.is_nan() || y.is_nan() { f64::NAN @@ -1085,7 +1084,6 @@ impl Number { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-isinteger - #[inline] pub(crate) fn is_integer(val: &JsValue) -> bool { match val { JsValue::Integer(_) => true, @@ -1095,7 +1093,6 @@ impl Number { } /// Checks if the float argument is an integer. - #[inline] #[allow(clippy::float_cmp)] pub(crate) fn is_float_integer(number: f64) -> bool { number.is_finite() && number.abs().floor() == number.abs() @@ -1105,7 +1102,6 @@ impl Number { /// x (a Number) and y (a Number). It performs the following steps when called: /// /// - #[inline] #[allow(clippy::float_cmp)] pub(crate) fn equal(x: f64, y: f64) -> bool { x == y @@ -1127,7 +1123,6 @@ impl Number { /// x (a Number) and y (a Number). It performs the following steps when called: /// /// - #[inline] #[allow(clippy::float_cmp)] pub(crate) fn same_value_zero(x: f64, y: f64) -> bool { if x.is_nan() && y.is_nan() { @@ -1137,7 +1132,6 @@ impl Number { x == y } - #[inline] #[allow(clippy::float_cmp)] pub(crate) fn less_than(x: f64, y: f64) -> AbstractRelation { if x.is_nan() || y.is_nan() { @@ -1161,7 +1155,6 @@ impl Number { (x < y).into() } - #[inline] pub(crate) fn not(x: f64) -> i32 { let x = f64_to_int32(x); !x diff --git a/boa_engine/src/builtins/object/mod.rs b/boa_engine/src/builtins/object/mod.rs index e3205b5645..bbc64f8d64 100644 --- a/boa_engine/src/builtins/object/mod.rs +++ b/boa_engine/src/builtins/object/mod.rs @@ -238,7 +238,7 @@ impl Object { // 3. Let desc be PropertyDescriptor { [[Get]]: getter, [[Enumerable]]: true, [[Configurable]]: true }. let desc = PropertyDescriptor::builder() - .get(getter) + .get(getter.clone()) .enumerable(true) .configurable(true); @@ -281,7 +281,7 @@ impl Object { // 3. Let desc be PropertyDescriptor { [[Set]]: setter, [[Enumerable]]: true, [[Configurable]]: true }. let desc = PropertyDescriptor::builder() - .set(setter) + .set(setter.clone()) .enumerable(true) .configurable(true); @@ -325,7 +325,7 @@ impl Object { if let Some(current_desc) = desc { // i. If IsAccessorDescriptor(desc) is true, return desc.[[Get]]. return if current_desc.is_accessor_descriptor() { - Ok(current_desc.expect_get().into()) + Ok(current_desc.expect_get().clone()) } else { // ii. Return undefined. Ok(JsValue::undefined()) @@ -369,7 +369,7 @@ impl Object { if let Some(current_desc) = desc { // i. If IsAccessorDescriptor(desc) is true, return desc.[[Set]]. return if current_desc.is_accessor_descriptor() { - Ok(current_desc.expect_set().into()) + Ok(current_desc.expect_set().clone()) } else { // ii. Return undefined. Ok(JsValue::undefined()) @@ -517,7 +517,7 @@ impl Object { // 4. If Desc has a [[Value]] field, then if let Some(value) = desc.value() { // a. Perform ! CreateDataPropertyOrThrow(obj, "value", Desc.[[Value]]). - obj.create_data_property_or_throw("value", value, context) + obj.create_data_property_or_throw("value", value.clone(), context) .expect("CreateDataPropertyOrThrow cannot fail here"); } @@ -531,14 +531,14 @@ impl Object { // 6. If Desc has a [[Get]] field, then if let Some(get) = desc.get() { // a. Perform ! CreateDataPropertyOrThrow(obj, "get", Desc.[[Get]]). - obj.create_data_property_or_throw("get", get, context) + obj.create_data_property_or_throw("get", get.clone(), context) .expect("CreateDataPropertyOrThrow cannot fail here"); } // 7. If Desc has a [[Set]] field, then if let Some(set) = desc.set() { // a. Perform ! CreateDataPropertyOrThrow(obj, "set", Desc.[[Set]]). - obj.create_data_property_or_throw("set", set, context) + obj.create_data_property_or_throw("set", set.clone(), context) .expect("CreateDataPropertyOrThrow cannot fail here"); } @@ -1256,7 +1256,7 @@ impl Object { let property_key = key.to_property_key(context)?; // b. Perform ! CreateDataPropertyOrThrow(obj, propertyKey, value). - obj.create_data_property_or_throw(property_key, value, context)?; + obj.create_data_property_or_throw(property_key, value.clone(), context)?; // c. Return undefined. Ok(JsValue::undefined()) @@ -1278,7 +1278,6 @@ impl Object { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-object.defineproperties -#[inline] fn object_define_properties( object: &JsObject, props: &JsValue, diff --git a/boa_engine/src/builtins/promise/mod.rs b/boa_engine/src/builtins/promise/mod.rs index 222ab55833..ce82c47fa4 100644 --- a/boa_engine/src/builtins/promise/mod.rs +++ b/boa_engine/src/builtins/promise/mod.rs @@ -816,8 +816,12 @@ impl Promise { .expect("cannot fail per spec"); // 11. Perform ! CreateDataPropertyOrThrow(obj, "value", x). - obj.create_data_property_or_throw("value", args.get_or_undefined(0), context) - .expect("cannot fail per spec"); + obj.create_data_property_or_throw( + "value", + args.get_or_undefined(0).clone(), + context, + ) + .expect("cannot fail per spec"); // 12. Set values[index] to obj. captures.values.borrow_mut()[captures.index] = obj.into(); @@ -896,8 +900,12 @@ impl Promise { .expect("cannot fail per spec"); // 11. Perform ! CreateDataPropertyOrThrow(obj, "reason", x). - obj.create_data_property_or_throw("reason", args.get_or_undefined(0), context) - .expect("cannot fail per spec"); + obj.create_data_property_or_throw( + "reason", + args.get_or_undefined(0).clone(), + context, + ) + .expect("cannot fail per spec"); // 12. Set values[index] to obj. captures.values.borrow_mut()[captures.index] = obj.into(); diff --git a/boa_engine/src/builtins/regexp/mod.rs b/boa_engine/src/builtins/regexp/mod.rs index d1e34cca8c..0e25211b62 100644 --- a/boa_engine/src/builtins/regexp/mod.rs +++ b/boa_engine/src/builtins/regexp/mod.rs @@ -358,7 +358,6 @@ impl RegExp { Ok(this.clone()) } - #[inline] fn regexp_has_flag(this: &JsValue, flag: u8, context: &mut Context) -> JsResult { if let Some(object) = this.as_object() { if let Some(regexp) = object.borrow().as_regexp() { diff --git a/boa_engine/src/builtins/string/mod.rs b/boa_engine/src/builtins/string/mod.rs index 9535168983..b910c6f556 100644 --- a/boa_engine/src/builtins/string/mod.rs +++ b/boa_engine/src/builtins/string/mod.rs @@ -40,7 +40,6 @@ pub(crate) enum Placement { } /// Helper function to check if a `char` is trimmable. -#[inline] pub(crate) const fn is_trimmable_whitespace(c: char) -> bool { // The rust implementation of `trim` does not regard the same characters whitespace as ecma standard does // @@ -383,7 +382,6 @@ impl String { /// /// [spec]: https://tc39.es/ecma262/#sec-string.prototype.tostring #[allow(clippy::wrong_self_convention)] - #[inline] pub(crate) fn to_string(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult { // 1. Return ? thisStringValue(this value). Ok(Self::this_string_value(this)?.into()) @@ -1050,7 +1048,7 @@ impl String { // d. If replacer is not undefined, then if let Some(replacer) = replacer { // i. Return ? Call(replacer, searchValue, ยซ O, replaceValue ยป). - return replacer.call(search_value, &[o.into(), replace_value.clone()], context); + return replacer.call(search_value, &[o.clone(), replace_value.clone()], context); } } diff --git a/boa_engine/src/builtins/typed_array/mod.rs b/boa_engine/src/builtins/typed_array/mod.rs index ba4c12f857..1b055013c7 100644 --- a/boa_engine/src/builtins/typed_array/mod.rs +++ b/boa_engine/src/builtins/typed_array/mod.rs @@ -529,7 +529,7 @@ impl TypedArray { // a. Let kValue be items[k]. // b. Let Pk be ! ToString(๐”ฝ(k)). // c. Perform ? Set(newObj, Pk, kValue, true). - new_obj.set(k, k_value, true, context)?; + new_obj.set(k, k_value.clone(), true, context)?; } // 7. Return newObj. @@ -3502,7 +3502,6 @@ impl TypedArrayKind { /// Gets the element size of the given typed array name, as per the [spec]. /// /// [spec]: https://tc39.es/ecma262/#table-the-typedarray-constructors - #[inline] pub(crate) const fn element_size(self) -> u64 { match self { Self::Int8 | Self::Uint8 | Self::Uint8Clamped => 1, @@ -3513,7 +3512,6 @@ impl TypedArrayKind { } /// Gets the content type of this typed array name. - #[inline] pub(crate) const fn content_type(self) -> ContentType { match self { Self::BigInt64 | Self::BigUint64 => ContentType::BigInt, @@ -3522,7 +3520,6 @@ impl TypedArrayKind { } /// Gets the name of this typed array name. - #[inline] pub(crate) const fn name(&self) -> &str { match self { Self::Int8 => "Int8Array", diff --git a/boa_engine/src/builtins/uri/consts.rs b/boa_engine/src/builtins/uri/consts.rs index 22ad56f527..d06f1388b8 100644 --- a/boa_engine/src/builtins/uri/consts.rs +++ b/boa_engine/src/builtins/uri/consts.rs @@ -77,7 +77,6 @@ const NUMBER_SIGN: u16 = b'#' as u16; /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#prod-uriUnescaped -#[inline] pub(super) fn is_uri_unescaped(code_point: u16) -> bool { URI_ALPHA_LOWER.contains(&code_point) || URI_ALPHA_UPPER.contains(&code_point) @@ -91,7 +90,6 @@ pub(super) fn is_uri_unescaped(code_point: u16) -> bool { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#prod-uriReserved -#[inline] pub(super) fn is_uri_reserved_or_number_sign(code_point: u16) -> bool { code_point == NUMBER_SIGN || URI_RESERVED.contains(&code_point) } @@ -104,7 +102,6 @@ pub(super) fn is_uri_reserved_or_number_sign(code_point: u16) -> bool { /// /// [uri_reserved]: https://tc39.es/ecma262/#prod-uriReserved /// [uri_unescaped]: https://tc39.es/ecma262/#prod-uriUnescaped -#[inline] pub(super) fn is_uri_reserved_or_uri_unescaped_or_number_sign(code_point: u16) -> bool { code_point == NUMBER_SIGN || is_uri_unescaped(code_point) || URI_RESERVED.contains(&code_point) } diff --git a/boa_engine/src/bytecompiler/function.rs b/boa_engine/src/bytecompiler/function.rs index 1b248eaee3..1490d8f7f2 100644 --- a/boa_engine/src/bytecompiler/function.rs +++ b/boa_engine/src/bytecompiler/function.rs @@ -25,7 +25,6 @@ pub(crate) struct FunctionCompiler { impl FunctionCompiler { /// Create a new `FunctionCompiler`. - #[inline] pub(crate) const fn new() -> Self { Self { name: Sym::EMPTY_STRING, @@ -38,7 +37,6 @@ impl FunctionCompiler { } /// Set the name of the function. - #[inline] pub(crate) fn name(mut self, name: N) -> Self where N: Into>, @@ -51,34 +49,29 @@ impl FunctionCompiler { } /// Indicate if the function is an arrow function. - #[inline] pub(crate) const fn arrow(mut self, arrow: bool) -> Self { self.arrow = arrow; self } /// Indicate if the function is a generator function. - #[inline] pub(crate) const fn generator(mut self, generator: bool) -> Self { self.generator = generator; self } /// Indicate if the function is an async function. - #[inline] pub(crate) const fn r#async(mut self, r#async: bool) -> Self { self.r#async = r#async; self } /// Indicate if the function is in a strict context. - #[inline] pub(crate) const fn strict(mut self, strict: bool) -> Self { self.strict = strict; self } /// Indicate if the function has a binding identifier. - #[inline] pub(crate) const fn has_binding_identifier(mut self, has_binding_identifier: bool) -> Self { self.has_binding_identifier = has_binding_identifier; self diff --git a/boa_engine/src/bytecompiler/mod.rs b/boa_engine/src/bytecompiler/mod.rs index 34c32648a5..362bf79871 100644 --- a/boa_engine/src/bytecompiler/mod.rs +++ b/boa_engine/src/bytecompiler/mod.rs @@ -63,12 +63,10 @@ struct FunctionSpec<'a> { } impl FunctionSpec<'_> { - #[inline] const fn is_arrow(&self) -> bool { matches!(self.kind, FunctionKind::Arrow | FunctionKind::AsyncArrow) } - #[inline] const fn is_async(&self) -> bool { matches!( self.kind, @@ -76,7 +74,6 @@ impl FunctionSpec<'_> { ) } - #[inline] const fn is_generator(&self) -> bool { matches!( self.kind, @@ -255,13 +252,11 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn interner(&self) -> &Interner { self.context.interner() } /// Push a compile time environment to the current `CodeBlock` and return it's index. - #[inline] fn push_compile_environment( &mut self, environment: Gc>, @@ -271,7 +266,6 @@ impl<'b> ByteCompiler<'b> { index } - #[inline] fn get_or_insert_literal(&mut self, literal: Literal) -> u32 { if let Some(index) = self.literals_map.get(&literal) { return *index; @@ -288,7 +282,6 @@ impl<'b> ByteCompiler<'b> { index } - #[inline] fn get_or_insert_name(&mut self, name: Identifier) -> u32 { if let Some(index) = self.names_map.get(&name) { return *index; @@ -300,7 +293,6 @@ impl<'b> ByteCompiler<'b> { index } - #[inline] fn get_or_insert_binding(&mut self, binding: BindingLocator) -> u32 { if let Some(index) = self.bindings_map.get(&binding) { return *index; @@ -312,7 +304,6 @@ impl<'b> ByteCompiler<'b> { index } - #[inline] fn emit_binding(&mut self, opcode: BindingOpcode, name: Identifier) { match opcode { BindingOpcode::Var => { @@ -357,13 +348,11 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn next_opcode_location(&mut self) -> u32 { assert!(self.code_block.code.len() < u32::MAX as usize); self.code_block.code.len() as u32 } - #[inline] fn emit(&mut self, opcode: Opcode, operands: &[u32]) { self.emit_opcode(opcode); for operand in operands { @@ -371,32 +360,26 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn emit_u64(&mut self, value: u64) { self.code_block.code.extend(value.to_ne_bytes()); } - #[inline] fn emit_u32(&mut self, value: u32) { self.code_block.code.extend(value.to_ne_bytes()); } - #[inline] fn emit_u16(&mut self, value: u16) { self.code_block.code.extend(value.to_ne_bytes()); } - #[inline] fn emit_opcode(&mut self, opcode: Opcode) { self.emit_u8(opcode as u8); } - #[inline] fn emit_u8(&mut self, value: u8) { self.code_block.code.push(value); } - #[inline] fn emit_push_integer(&mut self, value: i32) { match value { 0 => self.emit_opcode(Opcode::PushZero), @@ -413,13 +396,11 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn emit_push_literal(&mut self, literal: Literal) { let index = self.get_or_insert_literal(literal); self.emit(Opcode::PushLiteral, &[index]); } - #[inline] fn emit_push_rational(&mut self, value: f64) { if value.is_nan() { return self.emit_opcode(Opcode::PushNaN); @@ -442,14 +423,12 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn jump(&mut self) -> Label { let index = self.next_opcode_location(); self.emit(Opcode::Jump, &[Self::DUMMY_ADDRESS]); Label { index } } - #[inline] fn jump_if_false(&mut self) -> Label { let index = self.next_opcode_location(); self.emit(Opcode::JumpIfFalse, &[Self::DUMMY_ADDRESS]); @@ -457,7 +436,6 @@ impl<'b> ByteCompiler<'b> { Label { index } } - #[inline] fn jump_if_null_or_undefined(&mut self) -> Label { let index = self.next_opcode_location(); self.emit(Opcode::JumpIfNullOrUndefined, &[Self::DUMMY_ADDRESS]); @@ -467,7 +445,6 @@ impl<'b> ByteCompiler<'b> { /// Emit an opcode with a dummy operand. /// Return the `Label` of the operand. - #[inline] fn emit_opcode_with_operand(&mut self, opcode: Opcode) -> Label { let index = self.next_opcode_location(); self.emit(opcode, &[Self::DUMMY_ADDRESS]); @@ -476,14 +453,12 @@ impl<'b> ByteCompiler<'b> { /// Emit an opcode with two dummy operands. /// Return the `Label`s of the two operands. - #[inline] fn emit_opcode_with_two_operands(&mut self, opcode: Opcode) -> (Label, Label) { let index = self.next_opcode_location(); self.emit(opcode, &[Self::DUMMY_ADDRESS, Self::DUMMY_ADDRESS]); (Label { index }, Label { index: index + 4 }) } - #[inline] fn patch_jump_with_target(&mut self, label: Label, target: u32) { let Label { index } = label; @@ -496,13 +471,11 @@ impl<'b> ByteCompiler<'b> { self.code_block.code[index + 4] = bytes[3]; } - #[inline] fn patch_jump(&mut self, label: Label) { let target = self.next_opcode_location(); self.patch_jump_with_target(label, target); } - #[inline] fn push_loop_control_info(&mut self, label: Option, start_address: u32) { self.jump_info.push(JumpControlInfo { label, @@ -517,7 +490,6 @@ impl<'b> ByteCompiler<'b> { }); } - #[inline] fn push_loop_control_info_for_of_in_loop(&mut self, label: Option, start_address: u32) { self.jump_info.push(JumpControlInfo { label, @@ -532,7 +504,6 @@ impl<'b> ByteCompiler<'b> { }); } - #[inline] fn pop_loop_control_info(&mut self) { let loop_info = self.jump_info.pop().expect("no jump information found"); @@ -547,7 +518,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn push_switch_control_info(&mut self, label: Option, start_address: u32) { self.jump_info.push(JumpControlInfo { label, @@ -562,7 +532,6 @@ impl<'b> ByteCompiler<'b> { }); } - #[inline] fn pop_switch_control_info(&mut self) { let info = self.jump_info.pop().expect("no jump information found"); @@ -573,7 +542,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn push_try_control_info(&mut self, has_finally: bool) { if !self.jump_info.is_empty() { let start_address = self @@ -596,7 +564,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn push_try_control_info_catch_start(&mut self) { if !self.jump_info.is_empty() { let mut info = self @@ -608,7 +575,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn push_try_control_info_finally_start(&mut self, start: Label) { if !self.jump_info.is_empty() { let mut info = self @@ -620,7 +586,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn pop_try_control_info(&mut self, finally_start_address: Option) { if !self.jump_info.is_empty() { let mut info = self.jump_info.pop().expect("no jump information found"); @@ -659,7 +624,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn push_labelled_block_control_info(&mut self, label: Sym, start_address: u32) { self.jump_info.push(JumpControlInfo { label: Some(label), @@ -674,7 +638,6 @@ impl<'b> ByteCompiler<'b> { }); } - #[inline] fn pop_labelled_block_control_info(&mut self) { let info = self.jump_info.pop().expect("no jump information found"); @@ -689,7 +652,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn access_get(&mut self, access: Access<'_>, use_expr: bool) -> JsResult<()> { match access { Access::Variable { name } => { @@ -753,7 +715,6 @@ impl<'b> ByteCompiler<'b> { Ok(()) } - #[inline] fn access_set(&mut self, access: Access<'_>, use_expr: bool, expr_fn: F) -> JsResult where F: FnOnce(&mut ByteCompiler<'_>, u8) -> JsResult, @@ -830,7 +791,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] fn access_delete(&mut self, access: Access<'_>) -> JsResult<()> { match access { Access::Property { access } => match access { @@ -865,7 +825,6 @@ impl<'b> ByteCompiler<'b> { } /// Compile a [`StatementList`]. - #[inline] pub fn compile_statement_list( &mut self, list: &StatementList, @@ -882,7 +841,6 @@ impl<'b> ByteCompiler<'b> { } /// Compile a statement list in a new declarative environment. - #[inline] pub(crate) fn compile_statement_list_with_new_declarative( &mut self, list: &StatementList, @@ -1174,7 +1132,6 @@ impl<'b> ByteCompiler<'b> { } /// Compile a [`StatementListItem`]. - #[inline] fn compile_stmt_list_item( &mut self, item: &StatementListItem, @@ -1190,7 +1147,6 @@ impl<'b> ByteCompiler<'b> { } /// Compile a [`Declaration`]. - #[inline] pub fn compile_decl(&mut self, decl: &Declaration) -> JsResult<()> { match decl { Declaration::Function(function) => { @@ -1211,7 +1167,6 @@ impl<'b> ByteCompiler<'b> { } /// Compiles a [`Statement`] - #[inline] pub fn compile_stmt( &mut self, node: &Statement, @@ -1407,7 +1362,6 @@ impl<'b> ByteCompiler<'b> { self.code_block } - #[inline] fn compile_declaration_pattern( &mut self, pattern: &Pattern, @@ -1501,7 +1455,6 @@ impl<'b> ByteCompiler<'b> { has_identifier_argument } - #[inline] pub(crate) fn create_decls_from_decl( &mut self, declaration: &Declaration, @@ -1547,7 +1500,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] pub(crate) fn create_decls_from_stmt( &mut self, statement: &Statement, @@ -1577,7 +1529,6 @@ impl<'b> ByteCompiler<'b> { } } - #[inline] pub(crate) fn create_decls_from_stmt_list_item( &mut self, item: &StatementListItem, diff --git a/boa_engine/src/class.rs b/boa_engine/src/class.rs index 69a5184a50..f8525cb880 100644 --- a/boa_engine/src/class.rs +++ b/boa_engine/src/class.rs @@ -158,7 +158,6 @@ pub struct ClassBuilder<'context> { } impl<'context> ClassBuilder<'context> { - #[inline] pub(crate) fn new(context: &'context mut Context) -> Self where T: ClassConstructor, @@ -169,7 +168,6 @@ impl<'context> ClassBuilder<'context> { Self { builder } } - #[inline] pub(crate) fn build(mut self) -> JsFunction { JsFunction::from_object_unchecked(self.builder.build().into()) } @@ -177,7 +175,6 @@ impl<'context> ClassBuilder<'context> { /// Add a method to the class. /// /// It is added to `prototype`. - #[inline] pub fn method( &mut self, name: N, @@ -194,7 +191,6 @@ impl<'context> ClassBuilder<'context> { /// Add a static method to the class. /// /// It is added to class object itself. - #[inline] pub fn static_method( &mut self, name: N, @@ -211,7 +207,6 @@ impl<'context> ClassBuilder<'context> { /// Add a data property to the class, with the specified attribute. /// /// It is added to `prototype`. - #[inline] pub fn property(&mut self, key: K, value: V, attribute: Attribute) -> &mut Self where K: Into, @@ -224,7 +219,6 @@ impl<'context> ClassBuilder<'context> { /// Add a static data property to the class, with the specified attribute. /// /// It is added to class object itself. - #[inline] pub fn static_property(&mut self, key: K, value: V, attribute: Attribute) -> &mut Self where K: Into, @@ -237,7 +231,6 @@ impl<'context> ClassBuilder<'context> { /// Add an accessor property to the class, with the specified attribute. /// /// It is added to `prototype`. - #[inline] pub fn accessor( &mut self, key: K, @@ -255,7 +248,6 @@ impl<'context> ClassBuilder<'context> { /// Add a static accessor property to the class, with the specified attribute. /// /// It is added to class object itself. - #[inline] pub fn static_accessor( &mut self, key: K, @@ -273,7 +265,6 @@ impl<'context> ClassBuilder<'context> { /// Add a property descriptor to the class, with the specified attribute. /// /// It is added to `prototype`. - #[inline] pub fn property_descriptor(&mut self, key: K, property: P) -> &mut Self where K: Into, @@ -286,7 +277,6 @@ impl<'context> ClassBuilder<'context> { /// Add a static property descriptor to the class, with the specified attribute. /// /// It is added to class object itself. - #[inline] pub fn static_property_descriptor(&mut self, key: K, property: P) -> &mut Self where K: Into, diff --git a/boa_engine/src/context/mod.rs b/boa_engine/src/context/mod.rs index 41de6029ef..ca21953f1a 100644 --- a/boa_engine/src/context/mod.rs +++ b/boa_engine/src/context/mod.rs @@ -142,13 +142,11 @@ impl Context { /// A helper function for getting a mutable reference to the `console` object. #[cfg(feature = "console")] - #[inline] pub(crate) fn console_mut(&mut self) -> &mut Console { &mut self.console } /// Sets up the default global objects within Global - #[inline] fn create_intrinsics(&mut self) { let _timer = Profiler::global().start_event("create_intrinsics", "interpreter"); // Create intrinsics, add global objects here @@ -188,7 +186,6 @@ impl Context { /// - [ECMA reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-call - #[inline] pub(crate) fn call( &mut self, f: &JsValue, @@ -214,13 +211,11 @@ impl Context { } /// Return a mutable reference to the global object string bindings. - #[inline] pub(crate) fn global_bindings_mut(&mut self) -> &mut GlobalPropertyMap { self.realm.global_bindings_mut() } /// Constructs a `Error` with the specified message. - #[inline] pub fn construct_error(&mut self, message: M) -> JsValue where M: Into, @@ -256,7 +251,6 @@ impl Context { /// [`FunctionBuilder`](crate::object::FunctionBuilder::native). And bind it to the global /// object with [`Context::register_global_property`](Context::register_global_property) /// method. - #[inline] pub fn register_global_function( &mut self, name: &str, @@ -293,7 +287,6 @@ impl Context { /// The difference to [`Context::register_global_function`](Context::register_global_function) is, /// that the function will not be `constructable`. /// Usage of the function as a constructor will produce a `TypeError`. - #[inline] pub fn register_global_builtin_function( &mut self, name: &str, @@ -340,7 +333,6 @@ impl Context { /// /// See for an explanation on /// why we need to restrict the set of accepted closures. - #[inline] pub fn register_global_closure(&mut self, name: &str, length: usize, body: F) -> JsResult<()> where F: Fn(&JsValue, &[JsValue], &mut Self) -> JsResult + Copy + 'static, @@ -364,7 +356,6 @@ impl Context { } /// - #[inline] pub(crate) fn has_property(&mut self, obj: &JsValue, key: &PropertyKey) -> JsResult { obj.as_object() .map_or(Ok(false), |obj| obj.__has_property__(key, self)) @@ -383,7 +374,6 @@ impl Context { /// /// context.register_global_class::(); /// ``` - #[inline] pub fn register_global_class(&mut self) -> JsResult<()> where T: Class, @@ -423,7 +413,6 @@ impl Context { /// .build(); /// context.register_global_property("myObjectProperty", object, Attribute::all()); /// ``` - #[inline] pub fn register_global_property(&mut self, key: K, value: V, attribute: Attribute) where K: Into, @@ -472,7 +461,6 @@ impl Context { } /// Compile the AST into a `CodeBlock` ready to be executed by the VM. - #[inline] pub fn compile(&mut self, statement_list: &StatementList) -> JsResult> { let _timer = Profiler::global().start_event("Compilation", "Main"); let mut compiler = ByteCompiler::new(Sym::MAIN, statement_list.strict(), false, self); @@ -482,7 +470,6 @@ impl Context { } /// Compile the AST into a `CodeBlock` ready to be executed by the VM in a `JSON.parse` context. - #[inline] pub fn compile_json_parse( &mut self, statement_list: &StatementList, @@ -495,7 +482,6 @@ impl Context { } /// Compile the AST into a `CodeBlock` with an additional declarative environment. - #[inline] pub(crate) fn compile_with_new_declarative( &mut self, statement_list: &StatementList, @@ -513,7 +499,6 @@ impl Context { /// just a pointer copy. Therefore, if you'd like to execute the same `CodeBlock` multiple /// times, there is no need to re-compile it, and you can just call `clone()` on the /// `Gc` returned by the [`Self::compile()`] function. - #[inline] pub fn execute(&mut self, code_block: Gc) -> JsResult { let _timer = Profiler::global().start_event("Execution", "Main"); @@ -566,7 +551,6 @@ impl Context { } #[cfg(feature = "intl")] - #[inline] /// Get the ICU related utilities pub(crate) const fn icu(&self) -> &icu::Icu { &self.icu diff --git a/boa_engine/src/environments/compile.rs b/boa_engine/src/environments/compile.rs index 571d010f11..0d4bd15d24 100644 --- a/boa_engine/src/environments/compile.rs +++ b/boa_engine/src/environments/compile.rs @@ -31,7 +31,6 @@ pub(crate) struct CompileTimeEnvironment { impl CompileTimeEnvironment { /// Crate a new global compile time environment. - #[inline] pub(crate) fn new_global() -> Self { Self { outer: None, @@ -42,7 +41,6 @@ impl CompileTimeEnvironment { } /// Check if environment has a lexical binding with the given name. - #[inline] pub(crate) fn has_lex_binding(&self, name: Identifier) -> bool { self.bindings .get(&name) @@ -50,19 +48,16 @@ impl CompileTimeEnvironment { } /// Returns the number of bindings in this environment. - #[inline] pub(crate) fn num_bindings(&self) -> usize { self.bindings.len() } /// Check if the environment is a function environment. - #[inline] pub(crate) const fn is_function(&self) -> bool { self.function_scope } /// Get the locator for a binding name. - #[inline] pub(crate) fn get_binding(&self, name: Identifier) -> Option { self.bindings .get(&name) @@ -70,7 +65,6 @@ impl CompileTimeEnvironment { } /// Get the locator for a binding name in this and all outer environments. - #[inline] pub(crate) fn get_binding_recursive(&self, name: Identifier) -> BindingLocator { if let Some(binding) = self.bindings.get(&name) { BindingLocator::declarative(name, self.environment_index, binding.index) @@ -82,7 +76,6 @@ impl CompileTimeEnvironment { } /// Check if a binding name exists in this and all outer environments. - #[inline] pub(crate) fn has_binding_recursive(&self, name: Identifier) -> bool { if self.bindings.contains_key(&name) { true @@ -96,7 +89,6 @@ impl CompileTimeEnvironment { /// Create a mutable binding. /// /// If the binding is a function scope binding and this is a declarative environment, try the outer environment. - #[inline] pub(crate) fn create_mutable_binding( &mut self, name: Identifier, @@ -142,7 +134,6 @@ impl CompileTimeEnvironment { } /// Crate an immutable binding. - #[inline] pub(crate) fn create_immutable_binding(&mut self, name: Identifier, strict: bool) { let binding_index = self.bindings.len(); self.bindings.insert( @@ -157,7 +148,6 @@ impl CompileTimeEnvironment { } /// Return the binding locator for a mutable binding with the given binding name and scope. - #[inline] pub(crate) fn initialize_mutable_binding( &self, name: Identifier, @@ -189,14 +179,12 @@ impl CompileTimeEnvironment { /// # Panics /// /// Panics if the binding is not in the current environment. - #[inline] pub(crate) fn initialize_immutable_binding(&self, name: Identifier) -> BindingLocator { let binding = self.bindings.get(&name).expect("binding must exist"); BindingLocator::declarative(name, self.environment_index, binding.index) } /// Return the binding locator for a mutable binding. - #[inline] pub(crate) fn set_mutable_binding_recursive(&self, name: Identifier) -> BindingLocator { match self.bindings.get(&name) { Some(binding) if binding.mutable => { @@ -216,7 +204,6 @@ impl Context { /// Push either a new declarative or function environment on the compile time environment stack. /// /// Note: This function only works at bytecode compile time! - #[inline] pub(crate) fn push_compile_time_environment(&mut self, function_scope: bool) { let environment_index = self.realm.compile_env.borrow().environment_index + 1; let outer = self.realm.compile_env.clone(); @@ -236,7 +223,6 @@ impl Context { /// # Panics /// /// Panics if there are no more environments that can be pop'ed. - #[inline] pub(crate) fn pop_compile_time_environment( &mut self, ) -> (usize, Gc>) { @@ -260,7 +246,6 @@ impl Context { /// # Panics /// /// Panics if there are no environments on the compile time environment stack. - #[inline] pub(crate) fn get_binding_number(&self) -> usize { self.realm.compile_env.borrow().num_bindings() } @@ -268,7 +253,6 @@ impl Context { /// Get the binding locator of the binding at bytecode compile time. /// /// Note: This function only works at bytecode compile time! - #[inline] pub(crate) fn get_binding_value(&self, name: Identifier) -> BindingLocator { self.realm.compile_env.borrow().get_binding_recursive(name) } @@ -277,7 +261,6 @@ impl Context { /// This does not include bindings on the global object. /// /// Note: This function only works at bytecode compile time! - #[inline] pub(crate) fn has_binding(&self, name: Identifier) -> bool { self.realm.compile_env.borrow().has_binding_recursive(name) } @@ -290,7 +273,6 @@ impl Context { /// # Panics /// /// Panics if the global environment is not function scoped. - #[inline] pub(crate) fn create_mutable_binding( &mut self, name: Identifier, @@ -329,7 +311,6 @@ impl Context { /// Initialize a mutable binding at bytecode compile time and return it's binding locator. /// /// Note: This function only works at bytecode compile time! - #[inline] pub(crate) fn initialize_mutable_binding( &self, name: Identifier, @@ -349,7 +330,6 @@ impl Context { /// # Panics /// /// Panics if the global environment does not exist. - #[inline] pub(crate) fn create_immutable_binding(&mut self, name: Identifier, strict: bool) { self.realm .compile_env @@ -364,7 +344,6 @@ impl Context { /// # Panics /// /// Panics if the global environment does not exist or a the binding was not created on the current environment. - #[inline] pub(crate) fn initialize_immutable_binding(&self, name: Identifier) -> BindingLocator { self.realm .compile_env @@ -375,7 +354,6 @@ impl Context { /// Return the binding locator for a set operation on an existing binding. /// /// Note: This function only works at bytecode compile time! - #[inline] pub(crate) fn set_mutable_binding(&self, name: Identifier) -> BindingLocator { self.realm .compile_env diff --git a/boa_engine/src/environments/runtime.rs b/boa_engine/src/environments/runtime.rs index c6744d3869..00ea581497 100644 --- a/boa_engine/src/environments/runtime.rs +++ b/boa_engine/src/environments/runtime.rs @@ -190,7 +190,6 @@ impl DeclarativeEnvironment { /// # Panics /// /// Panics if the binding value is out of range or not initialized. - #[inline] pub(crate) fn get(&self, index: usize) -> JsValue { self.bindings .borrow() @@ -205,7 +204,6 @@ impl DeclarativeEnvironment { /// # Panics /// /// Panics if the binding value is out of range or not initialized. - #[inline] pub(crate) fn set(&self, index: usize, value: JsValue) { let mut bindings = self.bindings.borrow_mut(); let binding = bindings @@ -227,7 +225,6 @@ pub struct DeclarativeEnvironmentStack { impl DeclarativeEnvironmentStack { /// Create a new environment stack with the most outer declarative environment. - #[inline] pub(crate) fn new(global_compile_environment: Gc>) -> Self { Self { stack: vec![Gc::new(DeclarativeEnvironment { @@ -304,7 +301,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn set_global_binding_number(&mut self, binding_number: usize) { let environment = self .stack @@ -328,7 +324,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn get_this_environment(&self) -> &EnvironmentSlots { for env in self.stack.iter().rev() { if let Some(slots) = &env.slots { @@ -351,7 +346,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn push_declarative( &mut self, num_bindings: usize, @@ -381,7 +375,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn push_function( &mut self, num_bindings: usize, @@ -448,7 +441,6 @@ impl DeclarativeEnvironmentStack { } /// Pop environment from the environments stack. - #[inline] pub(crate) fn pop(&mut self) -> Gc { debug_assert!(self.stack.len() > 1); self.stack @@ -461,7 +453,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn current_function_slots(&self) -> &EnvironmentSlots { for env in self.stack.iter().rev() { if let Some(slots) = &env.slots { @@ -477,7 +468,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn current(&mut self) -> Gc { self.stack .last() @@ -503,7 +493,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if no environment exists on the stack. - #[inline] pub(crate) fn poison_current(&mut self) { self.stack .last() @@ -513,7 +502,6 @@ impl DeclarativeEnvironmentStack { } /// Mark that there may be added binding in all environments. - #[inline] pub(crate) fn poison_all(&mut self) { for env in &mut self.stack { if env.poisoned.get() { @@ -528,7 +516,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if the environment or binding index are out of range. - #[inline] pub(crate) fn get_value_optional( &self, mut environment_index: usize, @@ -569,7 +556,6 @@ impl DeclarativeEnvironmentStack { /// /// This only considers function environments that are poisoned. /// All other bindings are accessed via indices. - #[inline] pub(crate) fn get_value_if_global_poisoned(&self, name: Identifier) -> Option { for env in self.stack.iter().rev() { if !env.poisoned.get() { @@ -598,7 +584,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if the environment or binding index are out of range. - #[inline] pub(crate) fn put_value( &mut self, environment_index: usize, @@ -623,7 +608,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if the environment or binding index are out of range. - #[inline] pub(crate) fn put_value_if_initialized( &mut self, mut environment_index: usize, @@ -673,7 +657,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if the environment or binding index are out of range. - #[inline] pub(crate) fn put_value_if_uninitialized( &mut self, environment_index: usize, @@ -702,7 +685,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if the environment or binding index are out of range. - #[inline] pub(crate) fn put_value_if_global_poisoned( &mut self, name: Identifier, @@ -742,7 +724,6 @@ impl DeclarativeEnvironmentStack { /// # Panics /// /// Panics if the environment or binding index are out of range. - #[inline] pub(crate) fn is_only_global_property(&mut self, name: Identifier) -> bool { for env in self .stack @@ -779,7 +760,6 @@ pub(crate) struct BindingLocator { impl BindingLocator { /// Creates a new declarative binding locator that has knows indices. - #[inline] pub(in crate::environments) const fn declarative( name: Identifier, environment_index: usize, @@ -796,7 +776,6 @@ impl BindingLocator { } /// Creates a binding locator that indicates that the binding is on the global object. - #[inline] pub(in crate::environments) const fn global(name: Identifier) -> Self { Self { name, @@ -810,7 +789,6 @@ impl BindingLocator { /// Creates a binding locator that indicates that it was attempted to mutate an immutable binding. /// At runtime this should always produce a type error. - #[inline] pub(in crate::environments) const fn mutate_immutable(name: Identifier) -> Self { Self { name, @@ -823,7 +801,6 @@ impl BindingLocator { } /// Creates a binding locator that indicates that any action is silently ignored. - #[inline] pub(in crate::environments) const fn silent(name: Identifier) -> Self { Self { name, @@ -836,37 +813,31 @@ impl BindingLocator { } /// Returns the name of the binding. - #[inline] pub(crate) const fn name(&self) -> Identifier { self.name } /// Returns if the binding is located on the global object. - #[inline] pub(crate) const fn is_global(&self) -> bool { self.global } /// Returns the environment index of the binding. - #[inline] pub(crate) const fn environment_index(&self) -> usize { self.environment_index } /// Returns the binding index of the binding. - #[inline] pub(crate) const fn binding_index(&self) -> usize { self.binding_index } /// Returns if the binding is a silent operation. - #[inline] pub(crate) const fn is_silent(&self) -> bool { self.silent } /// Helper method to throws an error if the binding access is illegal. - #[inline] pub(crate) fn throw_mutate_immutable( &self, context: &mut Context, diff --git a/boa_engine/src/object/builtins/jsarray.rs b/boa_engine/src/object/builtins/jsarray.rs index 3bb71ee9dd..fcc762a9aa 100644 --- a/boa_engine/src/object/builtins/jsarray.rs +++ b/boa_engine/src/object/builtins/jsarray.rs @@ -26,7 +26,6 @@ impl JsArray { } /// Create an array from a `IntoIterator` convertible object. - #[inline] pub fn from_iter(elements: I, context: &mut Context) -> Self where I: IntoIterator, @@ -65,7 +64,6 @@ impl JsArray { } /// Push an element to the array. - #[inline] pub fn push(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -86,7 +84,6 @@ impl JsArray { } /// Calls `Array.prototype.at()`. - #[inline] pub fn at(&self, index: T, context: &mut Context) -> JsResult where T: Into, @@ -140,7 +137,6 @@ impl JsArray { } /// Calls `Array.prototype.fill()`. - #[inline] pub fn fill( &self, value: T, @@ -164,7 +160,6 @@ impl JsArray { } /// Calls `Array.prototype.indexOf()`. - #[inline] pub fn index_of( &self, search_element: T, @@ -191,7 +186,6 @@ impl JsArray { } /// Calls `Array.prototype.lastIndexOf()`. - #[inline] pub fn last_index_of( &self, search_element: T, diff --git a/boa_engine/src/object/builtins/jsarraybuffer.rs b/boa_engine/src/object/builtins/jsarraybuffer.rs index 832439b3a8..ec1a577d00 100644 --- a/boa_engine/src/object/builtins/jsarraybuffer.rs +++ b/boa_engine/src/object/builtins/jsarraybuffer.rs @@ -75,7 +75,6 @@ impl JsArrayBuffer { /// # Ok(()) /// # } /// ``` - #[inline] pub fn from_byte_block(byte_block: Vec, context: &mut Context) -> JsResult { let byte_length = byte_block.len(); diff --git a/boa_engine/src/object/builtins/jsdataview.rs b/boa_engine/src/object/builtins/jsdataview.rs index 0956835324..bb7510d14f 100644 --- a/boa_engine/src/object/builtins/jsdataview.rs +++ b/boa_engine/src/object/builtins/jsdataview.rs @@ -38,7 +38,6 @@ pub struct JsDataView { impl JsDataView { /// Create a new `JsDataView` object from an existing `JsArrayBuffer`. - #[inline] pub fn from_js_array_buffer( array_buffer: &JsArrayBuffer, offset: Option, diff --git a/boa_engine/src/object/builtins/jsdate.rs b/boa_engine/src/object/builtins/jsdate.rs index 37bca0ac91..e19981569c 100644 --- a/boa_engine/src/object/builtins/jsdate.rs +++ b/boa_engine/src/object/builtins/jsdate.rs @@ -241,7 +241,6 @@ impl JsDate { /// the UNIX epoch and the given date. /// /// Same as JavaScript's `Date.prototype.setDate()`. - #[inline] pub fn set_date(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -278,7 +277,6 @@ impl JsDate { /// the UNIX epoch and updated date. /// /// Same as JavaScript's `Date.prototype.setMilliseconds()`. - #[inline] pub fn set_milliseconds(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -327,7 +325,6 @@ impl JsDate { /// the UNIX epoch and the updated date. /// /// Same as JavaScript's `Date.prototype.setTime()`. - #[inline] pub fn set_time(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -342,7 +339,6 @@ impl JsDate { /// the UNIX epoch and the updated date. /// /// Same as JavaScript's `Date.prototype.setUTCDate()`. - #[inline] pub fn set_utc_date(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -383,7 +379,6 @@ impl JsDate { /// the UNIX epoch and the updated date. /// /// Same as JavaScript's `Date.prototype.setUTCMilliseconds()`. - #[inline] pub fn set_utc_milliseconds(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -528,7 +523,6 @@ impl JsDate { } /// Utility create a `Date` object from RFC3339 string - #[inline] pub fn new_from_parse(value: &JsValue, context: &mut Context) -> JsResult { let prototype = context.intrinsics().constructors().date().prototype(); let string = value diff --git a/boa_engine/src/object/builtins/jsfunction.rs b/boa_engine/src/object/builtins/jsfunction.rs index aaadebcea5..db7effee07 100644 --- a/boa_engine/src/object/builtins/jsfunction.rs +++ b/boa_engine/src/object/builtins/jsfunction.rs @@ -13,7 +13,6 @@ pub struct JsFunction { } impl JsFunction { - #[inline] pub(crate) fn from_object_unchecked(object: JsObject) -> Self { Self { inner: object } } diff --git a/boa_engine/src/object/builtins/jsgenerator.rs b/boa_engine/src/object/builtins/jsgenerator.rs index 4645f4b31d..3dccffbb2d 100644 --- a/boa_engine/src/object/builtins/jsgenerator.rs +++ b/boa_engine/src/object/builtins/jsgenerator.rs @@ -46,7 +46,6 @@ impl JsGenerator { /// Calls `Generator.prototype.next()` /// /// This method returns an object with the properties `done` and `value` - #[inline] pub fn next(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -57,7 +56,6 @@ impl JsGenerator { /// Calls `Generator.prototype.return()` /// /// This method returns the given value and finishes the generator - #[inline] pub fn r#return(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -69,7 +67,6 @@ impl JsGenerator { /// /// This method resumes the execution of a generator by throwing an error and returning an /// an object with the properties `done` and `value` - #[inline] pub fn throw(&self, value: T, context: &mut Context) -> JsResult where T: Into, diff --git a/boa_engine/src/object/builtins/jsmap.rs b/boa_engine/src/object/builtins/jsmap.rs index 5ae954452c..a799ca2030 100644 --- a/boa_engine/src/object/builtins/jsmap.rs +++ b/boa_engine/src/object/builtins/jsmap.rs @@ -115,7 +115,6 @@ impl JsMap { /// # Ok(()) /// # } /// ``` - #[inline] pub fn from_js_iterable(iterable: &JsValue, context: &mut Context) -> JsResult { // Create a new map object. let map = Self::create_map(context); @@ -226,7 +225,6 @@ impl JsMap { /// # Ok(()) /// # } /// ``` - #[inline] pub fn set(&self, key: K, value: V, context: &mut Context) -> JsResult where K: Into, @@ -287,7 +285,6 @@ impl JsMap { /// # Ok(()) /// # } /// ``` - #[inline] pub fn delete(&self, key: T, context: &mut Context) -> JsResult where T: Into, @@ -315,7 +312,6 @@ impl JsMap { /// # Ok(()) /// # } /// ``` - #[inline] pub fn get(&self, key: T, context: &mut Context) -> JsResult where T: Into, @@ -369,7 +365,6 @@ impl JsMap { /// # Ok(()) /// # } /// ``` - #[inline] pub fn has(&self, key: T, context: &mut Context) -> JsResult where T: Into, diff --git a/boa_engine/src/object/builtins/jsproxy.rs b/boa_engine/src/object/builtins/jsproxy.rs index 28fd04603a..79f6d6d280 100644 --- a/boa_engine/src/object/builtins/jsproxy.rs +++ b/boa_engine/src/object/builtins/jsproxy.rs @@ -79,6 +79,7 @@ pub struct JsRevocableProxy { impl JsRevocableProxy { /// Disables the traps of the internal `proxy` object, essentially /// making it unusable and throwing `TypeError`s for all the traps. + #[inline] pub fn revoke(self, context: &mut Context) -> JsResult<()> { self.revoker.call(&JsValue::undefined(), &[], context)?; Ok(()) @@ -161,6 +162,7 @@ impl std::fmt::Debug for JsProxyBuilder { impl JsProxyBuilder { /// Create a new `ProxyBuilder` with every trap set to `undefined`. + #[inline] pub fn new(target: JsObject) -> Self { Self { target, @@ -192,6 +194,7 @@ impl JsProxyBuilder { /// when trying to call the proxy, which will throw a type error. /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/apply + #[inline] pub fn apply(mut self, apply: NativeFunctionSignature) -> Self { self.apply = Some(apply); self @@ -209,6 +212,7 @@ impl JsProxyBuilder { /// when trying to construct an object using the proxy, which will throw a type error. /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/construct + #[inline] pub fn construct(mut self, construct: NativeFunctionSignature) -> Self { self.construct = Some(construct); self @@ -221,6 +225,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/defineProperty + #[inline] pub fn define_property(mut self, define_property: NativeFunctionSignature) -> Self { self.define_property = Some(define_property); self @@ -233,6 +238,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/deleteProperty + #[inline] pub fn delete_property(mut self, delete_property: NativeFunctionSignature) -> Self { self.delete_property = Some(delete_property); self @@ -245,6 +251,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/get + #[inline] pub fn get(mut self, get: NativeFunctionSignature) -> Self { self.get = Some(get); self @@ -257,6 +264,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor + #[inline] pub fn get_own_property_descriptor( mut self, get_own_property_descriptor: NativeFunctionSignature, @@ -272,6 +280,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getPrototypeOf + #[inline] pub fn get_prototype_of(mut self, get_prototype_of: NativeFunctionSignature) -> Self { self.get_prototype_of = Some(get_prototype_of); self @@ -284,6 +293,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/has + #[inline] pub fn has(mut self, has: NativeFunctionSignature) -> Self { self.has = Some(has); self @@ -296,6 +306,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/isExtensible + #[inline] pub fn is_extensible(mut self, is_extensible: NativeFunctionSignature) -> Self { self.is_extensible = Some(is_extensible); self @@ -308,6 +319,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/ownKeys + #[inline] pub fn own_keys(mut self, own_keys: NativeFunctionSignature) -> Self { self.own_keys = Some(own_keys); self @@ -320,6 +332,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/preventExtensions + #[inline] pub fn prevent_extensions(mut self, prevent_extensions: NativeFunctionSignature) -> Self { self.prevent_extensions = Some(prevent_extensions); self @@ -332,6 +345,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/set + #[inline] pub fn set(mut self, set: NativeFunctionSignature) -> Self { self.set = Some(set); self @@ -344,6 +358,7 @@ impl JsProxyBuilder { /// - [MDN documentation][mdn] /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/setPrototypeOf + #[inline] pub fn set_prototype_of(mut self, set_prototype_of: NativeFunctionSignature) -> Self { self.set_prototype_of = Some(set_prototype_of); self diff --git a/boa_engine/src/object/builtins/jsregexp.rs b/boa_engine/src/object/builtins/jsregexp.rs index 4c1c617b05..7dba11d06c 100644 --- a/boa_engine/src/object/builtins/jsregexp.rs +++ b/boa_engine/src/object/builtins/jsregexp.rs @@ -56,7 +56,6 @@ impl JsRegExp { /// # Ok(()) /// # } /// ``` - #[inline] pub fn new(pattern: S, flags: S, context: &mut Context) -> JsResult where S: Into, @@ -203,7 +202,6 @@ impl JsRegExp { /// # Ok(()) /// # } /// ``` - #[inline] pub fn test(&self, search_string: S, context: &mut Context) -> JsResult where S: Into, @@ -215,7 +213,6 @@ impl JsRegExp { /// Executes a search for a match in a specified string /// /// Returns a `JsArray` containing matched value and updates the `lastIndex` property, or `None` - #[inline] pub fn exec(&self, search_string: S, context: &mut Context) -> JsResult> where S: Into, diff --git a/boa_engine/src/object/builtins/jsset.rs b/boa_engine/src/object/builtins/jsset.rs index d22399b7d6..3aab11cd62 100644 --- a/boa_engine/src/object/builtins/jsset.rs +++ b/boa_engine/src/object/builtins/jsset.rs @@ -40,7 +40,6 @@ impl JsSet { /// Returns the Set object with added value. /// /// Same as JavaScript's `set.add(value)`. - #[inline] pub fn add(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -71,7 +70,6 @@ impl JsSet { /// successfully removed or not. /// /// Same as JavaScript's `set.delete(value)`. - #[inline] pub fn delete(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -87,7 +85,6 @@ impl JsSet { /// with the given value in the Set object or not. /// /// Same as JavaScript's `set.has(value)`. - #[inline] pub fn has(&self, value: T, context: &mut Context) -> JsResult where T: Into, @@ -156,7 +153,6 @@ impl JsSet { } /// Utility: Creates a `JsSet` from a `` convertible object. - #[inline] pub fn from_iter(elements: I, context: &mut Context) -> Self where I: IntoIterator, diff --git a/boa_engine/src/object/builtins/jstypedarray.rs b/boa_engine/src/object/builtins/jstypedarray.rs index 757e3b0774..c847cca437 100644 --- a/boa_engine/src/object/builtins/jstypedarray.rs +++ b/boa_engine/src/object/builtins/jstypedarray.rs @@ -50,7 +50,6 @@ impl JsTypedArray { } /// Calls `TypedArray.prototype.at()`. - #[inline] pub fn at(&self, index: T, context: &mut Context) -> JsResult where T: Into, @@ -77,7 +76,6 @@ impl JsTypedArray { } /// Calls `TypedArray.prototype.fill()`. - #[inline] pub fn fill( &self, value: T, @@ -249,7 +247,6 @@ impl JsTypedArray { } /// Calls `TypedArray.prototype.indexOf()`. - #[inline] pub fn index_of( &self, search_element: T, @@ -276,7 +273,6 @@ impl JsTypedArray { } /// Calls `TypedArray.prototype.lastIndexOf()`. - #[inline] pub fn last_index_of( &self, search_element: T, @@ -351,7 +347,6 @@ macro_rules! JsTypedArrayType { impl $name { /// Create the typed array from a [`JsArrayBuffer`]. - #[inline] pub fn from_array_buffer( array_buffer: JsArrayBuffer, context: &mut Context, @@ -379,7 +374,6 @@ macro_rules! JsTypedArrayType { } /// Create the typed array from an iterator. - #[inline] pub fn from_iter(elements: I, context: &mut Context) -> JsResult where I: IntoIterator, diff --git a/boa_engine/src/object/internal_methods/arguments.rs b/boa_engine/src/object/internal_methods/arguments.rs index abbe446083..b1e56f4072 100644 --- a/boa_engine/src/object/internal_methods/arguments.rs +++ b/boa_engine/src/object/internal_methods/arguments.rs @@ -22,7 +22,6 @@ pub(crate) static ARGUMENTS_EXOTIC_INTERNAL_METHODS: InternalObjectMethods = /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-arguments-exotic-objects-getownproperty-p -#[inline] pub(crate) fn arguments_exotic_get_own_property( obj: &JsObject, key: &PropertyKey, @@ -98,7 +97,7 @@ pub(crate) fn arguments_exotic_define_own_property( { if let Some((_, value)) = &mapped { PropertyDescriptor::builder() - .value(value) + .value(value.clone()) .writable(false) .maybe_enumerable(desc.enumerable()) .maybe_configurable(desc.configurable()) diff --git a/boa_engine/src/object/internal_methods/bound_function.rs b/boa_engine/src/object/internal_methods/bound_function.rs index 7675e7272a..e4780b7197 100644 --- a/boa_engine/src/object/internal_methods/bound_function.rs +++ b/boa_engine/src/object/internal_methods/bound_function.rs @@ -28,7 +28,6 @@ pub(crate) static BOUND_CONSTRUCTOR_EXOTIC_INTERNAL_METHODS: InternalObjectMetho /// /// [spec]: https://tc39.es/ecma262/#sec-bound-function-exotic-objects-call-thisargument-argumentslist #[track_caller] -#[inline] fn bound_function_exotic_call( obj: &JsObject, _: &JsValue, @@ -64,7 +63,6 @@ fn bound_function_exotic_call( /// /// [spec]: https://tc39.es/ecma262/#sec-bound-function-exotic-objects-construct-argumentslist-newtarget #[track_caller] -#[inline] fn bound_function_exotic_construct( obj: &JsObject, arguments_list: &[JsValue], diff --git a/boa_engine/src/object/internal_methods/function.rs b/boa_engine/src/object/internal_methods/function.rs index 26dcc86b87..ea566e1525 100644 --- a/boa_engine/src/object/internal_methods/function.rs +++ b/boa_engine/src/object/internal_methods/function.rs @@ -32,7 +32,6 @@ pub(crate) static CONSTRUCTOR_INTERNAL_METHODS: InternalObjectMethods = Internal // // #[track_caller] -#[inline] fn function_call( obj: &JsObject, this: &JsValue, @@ -49,7 +48,6 @@ fn function_call( /// Panics if the object is currently mutably borrowed. // #[track_caller] -#[inline] fn function_construct( obj: &JsObject, args: &[JsValue], diff --git a/boa_engine/src/object/internal_methods/global.rs b/boa_engine/src/object/internal_methods/global.rs index b8a9cf6b8a..dc3325c2bd 100644 --- a/boa_engine/src/object/internal_methods/global.rs +++ b/boa_engine/src/object/internal_methods/global.rs @@ -36,7 +36,6 @@ pub(crate) static GLOBAL_INTERNAL_METHODS: InternalObjectMethods = InternalObjec /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarygetprototypeof -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_get_prototype_of( _: &JsObject, @@ -52,7 +51,6 @@ pub(crate) fn global_get_prototype_of( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarysetprototypeof -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_set_prototype_of( _: &JsObject, @@ -112,7 +110,6 @@ pub(crate) fn global_set_prototype_of( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarygetownproperty -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_get_own_property( _obj: &JsObject, @@ -143,7 +140,6 @@ pub(crate) fn global_get_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryisextensible -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_is_extensible(_obj: &JsObject, context: &mut Context) -> JsResult { // 1. Return O.[[Extensible]]. @@ -156,7 +152,6 @@ pub(crate) fn global_is_extensible(_obj: &JsObject, context: &mut Context) -> Js /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarypreventextensions -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_prevent_extensions(_obj: &JsObject, context: &mut Context) -> JsResult { // 1. Set O.[[Extensible]] to false. @@ -172,7 +167,6 @@ pub(crate) fn global_prevent_extensions(_obj: &JsObject, context: &mut Context) /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarydefineownproperty -#[inline] #[allow(clippy::needless_pass_by_value)] pub(crate) fn global_define_own_property( obj: &JsObject, @@ -199,7 +193,6 @@ pub(crate) fn global_define_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryhasproperty -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_has_property( _obj: &JsObject, @@ -229,7 +222,6 @@ pub(crate) fn global_has_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryget -#[inline] #[allow(clippy::needless_pass_by_value)] pub(crate) fn global_get( obj: &JsObject, @@ -276,7 +268,6 @@ pub(crate) fn global_get( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryset -#[inline] #[allow(clippy::needless_pass_by_value)] pub(crate) fn global_set( _obj: &JsObject, @@ -288,7 +279,6 @@ pub(crate) fn global_set( global_set_no_receiver(&key, value, context) } -#[inline] pub(crate) fn global_set_no_receiver( key: &PropertyKey, value: JsValue, @@ -386,7 +376,6 @@ pub(crate) fn global_set_no_receiver( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarydelete -#[inline] #[allow(clippy::unnecessary_wraps, clippy::needless_pass_by_value)] pub(crate) fn global_delete( _obj: &JsObject, @@ -402,7 +391,6 @@ pub(crate) fn global_delete( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarydelete -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_delete_no_receiver( key: &PropertyKey, @@ -432,7 +420,6 @@ pub(crate) fn global_delete_no_receiver( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn global_own_property_keys( _: &JsObject, @@ -487,7 +474,6 @@ pub(crate) fn global_own_property_keys( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor -#[inline] pub(crate) fn validate_and_apply_property_descriptor( key: &PropertyKey, extensible: bool, diff --git a/boa_engine/src/object/internal_methods/integer_indexed.rs b/boa_engine/src/object/internal_methods/integer_indexed.rs index 5110b68e07..5d6bd0e227 100644 --- a/boa_engine/src/object/internal_methods/integer_indexed.rs +++ b/boa_engine/src/object/internal_methods/integer_indexed.rs @@ -31,7 +31,6 @@ pub(crate) static INTEGER_INDEXED_EXOTIC_INTERNAL_METHODS: InternalObjectMethods /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-getownproperty-p -#[inline] pub(crate) fn integer_indexed_exotic_get_own_property( obj: &JsObject, key: &PropertyKey, @@ -66,7 +65,6 @@ pub(crate) fn integer_indexed_exotic_get_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-hasproperty-p -#[inline] pub(crate) fn integer_indexed_exotic_has_property( obj: &JsObject, key: &PropertyKey, @@ -89,7 +87,6 @@ pub(crate) fn integer_indexed_exotic_has_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-defineownproperty-p-desc -#[inline] pub(crate) fn integer_indexed_exotic_define_own_property( obj: &JsObject, key: PropertyKey, @@ -135,7 +132,6 @@ pub(crate) fn integer_indexed_exotic_define_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-get-p-receiver -#[inline] pub(crate) fn integer_indexed_exotic_get( obj: &JsObject, key: &PropertyKey, @@ -160,7 +156,6 @@ pub(crate) fn integer_indexed_exotic_get( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-set-p-v-receiver -#[inline] pub(crate) fn integer_indexed_exotic_set( obj: &JsObject, key: PropertyKey, @@ -189,7 +184,6 @@ pub(crate) fn integer_indexed_exotic_set( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-delete-p -#[inline] pub(crate) fn integer_indexed_exotic_delete( obj: &JsObject, key: &PropertyKey, @@ -213,7 +207,6 @@ pub(crate) fn integer_indexed_exotic_delete( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-ownpropertykeys -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn integer_indexed_exotic_own_property_keys( obj: &JsObject, diff --git a/boa_engine/src/object/internal_methods/mod.rs b/boa_engine/src/object/internal_methods/mod.rs index 470e9d5d0c..5694bb10f8 100644 --- a/boa_engine/src/object/internal_methods/mod.rs +++ b/boa_engine/src/object/internal_methods/mod.rs @@ -33,7 +33,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-getprototypeof - #[inline] #[track_caller] pub(crate) fn __get_prototype_of__(&self, context: &mut Context) -> JsResult { let _timer = Profiler::global().start_event("Object::__get_prototype_of__", "object"); @@ -49,7 +48,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-setprototypeof-v - #[inline] pub(crate) fn __set_prototype_of__( &self, val: JsPrototype, @@ -68,7 +66,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-isextensible - #[inline] pub(crate) fn __is_extensible__(&self, context: &mut Context) -> JsResult { let _timer = Profiler::global().start_event("Object::__is_extensible__", "object"); let func = self.borrow().data.internal_methods.__is_extensible__; @@ -83,7 +80,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-preventextensions - #[inline] pub(crate) fn __prevent_extensions__(&self, context: &mut Context) -> JsResult { let _timer = Profiler::global().start_event("Object::__prevent_extensions__", "object"); let func = self.borrow().data.internal_methods.__prevent_extensions__; @@ -98,7 +94,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p - #[inline] pub(crate) fn __get_own_property__( &self, key: &PropertyKey, @@ -117,7 +112,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc - #[inline] pub(crate) fn __define_own_property__( &self, key: PropertyKey, @@ -137,7 +131,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p - #[inline] pub(crate) fn __has_property__( &self, key: &PropertyKey, @@ -156,7 +149,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver - #[inline] pub(crate) fn __get__( &self, key: &PropertyKey, @@ -176,7 +168,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver - #[inline] pub(crate) fn __set__( &self, key: PropertyKey, @@ -197,7 +188,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-delete-p - #[inline] pub(crate) fn __delete__(&self, key: &PropertyKey, context: &mut Context) -> JsResult { let _timer = Profiler::global().start_event("Object::__delete__", "object"); let func = self.borrow().data.internal_methods.__delete__; @@ -212,7 +202,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys - #[inline] #[track_caller] pub(crate) fn __own_property_keys__( &self, @@ -231,7 +220,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist - #[inline] #[track_caller] pub(crate) fn __call__( &self, @@ -254,7 +242,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ecmascript-function-objects-construct-argumentslist-newtarget - #[inline] #[track_caller] pub(crate) fn __construct__( &self, @@ -333,7 +320,6 @@ pub(crate) struct InternalObjectMethods { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarygetprototypeof -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn ordinary_get_prototype_of( obj: &JsObject, @@ -351,7 +337,6 @@ pub(crate) fn ordinary_get_prototype_of( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarysetprototypeof -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn ordinary_set_prototype_of( obj: &JsObject, @@ -411,7 +396,6 @@ pub(crate) fn ordinary_set_prototype_of( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryisextensible -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn ordinary_is_extensible(obj: &JsObject, _context: &mut Context) -> JsResult { // 1. Return O.[[Extensible]]. @@ -424,7 +408,6 @@ pub(crate) fn ordinary_is_extensible(obj: &JsObject, _context: &mut Context) -> /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarypreventextensions -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn ordinary_prevent_extensions( obj: &JsObject, @@ -443,7 +426,6 @@ pub(crate) fn ordinary_prevent_extensions( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarygetownproperty -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn ordinary_get_own_property( obj: &JsObject, @@ -474,7 +456,6 @@ pub(crate) fn ordinary_get_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarydefineownproperty -#[inline] pub(crate) fn ordinary_define_own_property( obj: &JsObject, key: PropertyKey, @@ -503,7 +484,6 @@ pub(crate) fn ordinary_define_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryhasproperty -#[inline] pub(crate) fn ordinary_has_property( obj: &JsObject, key: &PropertyKey, @@ -533,7 +513,6 @@ pub(crate) fn ordinary_has_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryget -#[inline] pub(crate) fn ordinary_get( obj: &JsObject, key: &PropertyKey, @@ -579,7 +558,6 @@ pub(crate) fn ordinary_get( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryset -#[inline] pub(crate) fn ordinary_set( obj: &JsObject, key: PropertyKey, @@ -682,7 +660,6 @@ pub(crate) fn ordinary_set( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinarydelete -#[inline] pub(crate) fn ordinary_delete( obj: &JsObject, key: &PropertyKey, @@ -714,7 +691,6 @@ pub(crate) fn ordinary_delete( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn ordinary_own_property_keys( obj: &JsObject, @@ -764,7 +740,6 @@ pub(crate) fn ordinary_own_property_keys( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-iscompatiblepropertydescriptor -#[inline] pub(crate) fn is_compatible_property_descriptor( extensible: bool, desc: PropertyDescriptor, @@ -783,7 +758,6 @@ pub(crate) fn is_compatible_property_descriptor( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor -#[inline] pub(crate) fn validate_and_apply_property_descriptor( obj_and_key: Option<(&JsObject, PropertyKey)>, extensible: bool, @@ -935,7 +909,6 @@ pub(crate) fn validate_and_apply_property_descriptor( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-getprototypefromconstructor -#[inline] #[track_caller] pub(crate) fn get_prototype_from_constructor( constructor: &JsValue, diff --git a/boa_engine/src/object/internal_methods/proxy.rs b/boa_engine/src/object/internal_methods/proxy.rs index 26630084c4..fb7ee9eabc 100644 --- a/boa_engine/src/object/internal_methods/proxy.rs +++ b/boa_engine/src/object/internal_methods/proxy.rs @@ -111,7 +111,6 @@ pub(crate) fn proxy_exotic_get_prototype_of( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v -#[inline] pub(crate) fn proxy_exotic_set_prototype_of( obj: &JsObject, val: JsPrototype, @@ -176,7 +175,6 @@ pub(crate) fn proxy_exotic_set_prototype_of( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-isextensible -#[inline] pub(crate) fn proxy_exotic_is_extensible(obj: &JsObject, context: &mut Context) -> JsResult { // 1. Let handler be O.[[ProxyHandler]]. // 2. If handler is null, throw a TypeError exception. @@ -220,7 +218,6 @@ pub(crate) fn proxy_exotic_is_extensible(obj: &JsObject, context: &mut Context) /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-preventextensions -#[inline] pub(crate) fn proxy_exotic_prevent_extensions( obj: &JsObject, context: &mut Context, @@ -266,7 +263,6 @@ pub(crate) fn proxy_exotic_prevent_extensions( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p -#[inline] pub(crate) fn proxy_exotic_get_own_property( obj: &JsObject, key: &PropertyKey, @@ -390,7 +386,6 @@ pub(crate) fn proxy_exotic_get_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc -#[inline] pub(crate) fn proxy_exotic_define_own_property( obj: &JsObject, key: PropertyKey, @@ -503,7 +498,6 @@ pub(crate) fn proxy_exotic_define_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p -#[inline] pub(crate) fn proxy_exotic_has_property( obj: &JsObject, key: &PropertyKey, @@ -569,7 +563,6 @@ pub(crate) fn proxy_exotic_has_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver -#[inline] pub(crate) fn proxy_exotic_get( obj: &JsObject, key: &PropertyKey, @@ -638,7 +631,6 @@ pub(crate) fn proxy_exotic_get( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver -#[inline] pub(crate) fn proxy_exotic_set( obj: &JsObject, key: PropertyKey, @@ -722,7 +714,6 @@ pub(crate) fn proxy_exotic_set( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-delete-p -#[inline] pub(crate) fn proxy_exotic_delete( obj: &JsObject, key: &PropertyKey, @@ -790,7 +781,6 @@ pub(crate) fn proxy_exotic_delete( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys -#[inline] pub(crate) fn proxy_exotic_own_property_keys( obj: &JsObject, context: &mut Context, diff --git a/boa_engine/src/object/internal_methods/string.rs b/boa_engine/src/object/internal_methods/string.rs index 650b01eee2..a9ca2c96d6 100644 --- a/boa_engine/src/object/internal_methods/string.rs +++ b/boa_engine/src/object/internal_methods/string.rs @@ -26,7 +26,6 @@ pub(crate) static STRING_EXOTIC_INTERNAL_METHODS: InternalObjectMethods = Intern /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-string-exotic-objects-getownproperty-p -#[inline] pub(crate) fn string_exotic_get_own_property( obj: &JsObject, key: &PropertyKey, @@ -51,7 +50,6 @@ pub(crate) fn string_exotic_get_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-string-exotic-objects-defineownproperty-p-desc -#[inline] pub(crate) fn string_exotic_define_own_property( obj: &JsObject, key: PropertyKey, @@ -84,7 +82,6 @@ pub(crate) fn string_exotic_define_own_property( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-string-exotic-objects-ownpropertykeys -#[inline] #[allow(clippy::unnecessary_wraps)] pub(crate) fn string_exotic_own_property_keys( obj: &JsObject, @@ -149,7 +146,6 @@ pub(crate) fn string_exotic_own_property_keys( /// /// [spec]: https://tc39.es/ecma262/#sec-stringgetownproperty #[allow(clippy::float_cmp)] -#[inline] fn string_get_own_property(obj: &JsObject, key: &PropertyKey) -> Option { // 1. Assert: S is an Object that has a [[StringData]] internal slot. // 2. Assert: IsPropertyKey(P) is true. diff --git a/boa_engine/src/object/jsobject.rs b/boa_engine/src/object/jsobject.rs index bb602661b5..5fa4cdf2e8 100644 --- a/boa_engine/src/object/jsobject.rs +++ b/boa_engine/src/object/jsobject.rs @@ -34,7 +34,6 @@ pub struct JsObject { impl JsObject { /// Create a new `JsObject` from an internal `Object`. - #[inline] fn from_object(object: Object) -> Self { Self { inner: Gc::new(GcCell::new(object)), @@ -52,7 +51,6 @@ impl JsObject { /// /// Create a `JsObject` and automatically set its internal methods and /// internal slots from the `data` provided. - #[inline] pub fn from_proto_and_data>>(prototype: O, data: ObjectData) -> Self { Self::from_object(Object { data, @@ -198,7 +196,6 @@ impl JsObject { /// # Panics /// /// Panics if the object is currently mutably borrowed. - #[inline] #[track_caller] pub fn is(&self) -> bool where @@ -213,7 +210,6 @@ impl JsObject { /// # Panics /// /// Panics if the object is currently mutably borrowed. - #[inline] #[track_caller] pub fn downcast_ref(&self) -> Option> where @@ -235,7 +231,6 @@ impl JsObject { /// # Panics /// /// Panics if the object is currently borrowed. - #[inline] #[track_caller] pub fn downcast_mut(&mut self) -> Option> where @@ -268,7 +263,6 @@ impl JsObject { /// # Panics /// /// Panics if the object is currently mutably borrowed. - #[inline] pub(crate) fn extensible(&self) -> bool { self.borrow().extensible } @@ -607,7 +601,6 @@ Cannot both specify accessors and a value or writable attribute", /// - [ECMAScript][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-copydataproperties - #[inline] pub fn copy_data_properties( &self, source: &JsValue, @@ -672,7 +665,6 @@ Cannot both specify accessors and a value or writable attribute", Ok(()) } - #[inline] pub(crate) fn get_property(&self, key: &PropertyKey) -> Option { let mut obj = Some(self.clone()); @@ -686,7 +678,6 @@ Cannot both specify accessors and a value or writable attribute", } /// Helper function for property insertion. - #[inline] #[track_caller] pub(crate) fn insert(&self, key: K, property: P) -> Option where @@ -700,7 +691,6 @@ Cannot both specify accessors and a value or writable attribute", /// /// If a field was already in the object with the same name that a `Some` is returned /// with that field, otherwise None is returned. - #[inline] pub fn insert_property(&self, key: K, property: P) -> Option where K: Into, diff --git a/boa_engine/src/object/mod.rs b/boa_engine/src/object/mod.rs index 6971516d47..713f01e103 100644 --- a/boa_engine/src/object/mod.rs +++ b/boa_engine/src/object/mod.rs @@ -104,12 +104,10 @@ pub trait NativeObject: Debug + Any + Trace { } impl NativeObject for T { - #[inline] fn as_any(&self) -> &dyn Any { self } - #[inline] fn as_mut_any(&mut self) -> &mut dyn Any { self } @@ -1501,7 +1499,6 @@ impl Object { /// [More information][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-invariants-of-the-essential-internal-methods - #[inline] #[track_caller] pub fn set_prototype>(&mut self, prototype: O) -> bool { let prototype = prototype.into(); @@ -1588,7 +1585,6 @@ impl Object { } /// Return `true` if it is a native object and the native type is `T`. - #[inline] pub fn is(&self) -> bool where T: NativeObject, @@ -1604,7 +1600,6 @@ impl Object { /// Downcast a reference to the object, /// if the object is type native object type `T`. - #[inline] pub fn downcast_ref(&self) -> Option<&T> where T: NativeObject, @@ -1620,7 +1615,6 @@ impl Object { /// Downcast a mutable reference to the object, /// if the object is type native object type `T`. - #[inline] pub fn downcast_mut(&mut self) -> Option<&mut T> where T: NativeObject, @@ -1649,7 +1643,6 @@ impl Object { /// /// If a field was already in the object with the same name, then a `Some` is returned /// with that field's value, otherwise, `None` is returned. - #[inline] pub(crate) fn insert(&mut self, key: K, property: P) -> Option where K: Into, @@ -1677,7 +1670,6 @@ impl Object { } /// Set a private setter. - #[inline] pub(crate) fn set_private_element_setter(&mut self, name: Sym, setter: JsObject) { match self.private_elements.get_mut(&name) { Some(PrivateElement::Accessor { @@ -1699,7 +1691,6 @@ impl Object { } /// Set a private getter. - #[inline] pub(crate) fn set_private_element_getter(&mut self, name: Sym, getter: JsObject) { match self.private_elements.get_mut(&name) { Some(PrivateElement::Accessor { @@ -1779,7 +1770,6 @@ where B: Into, N: AsRef, { - #[inline] fn from((binding, name): (B, N)) -> Self { Self { binding: binding.into(), @@ -1813,7 +1803,6 @@ impl<'context> FunctionBuilder<'context> { } /// Create a new `FunctionBuilder` for creating a closure function. - #[inline] pub fn closure(context: &'context mut Context, function: F) -> Self where F: Fn(&JsValue, &[JsValue], &mut Context) -> JsResult + Copy + 'static, @@ -1836,7 +1825,6 @@ impl<'context> FunctionBuilder<'context> { /// /// You can only move variables that implement `Debug + Any + Trace + Clone`. /// In other words, only `NativeObject + Clone` objects are movable. - #[inline] pub fn closure_with_captures( context: &'context mut Context, function: F, @@ -1868,7 +1856,6 @@ impl<'context> FunctionBuilder<'context> { /// Specify the name property of object function object. /// /// The default is `""` (empty string). - #[inline] #[must_use] pub fn name(mut self, name: N) -> Self where @@ -1893,7 +1880,6 @@ impl<'context> FunctionBuilder<'context> { /// Specify whether the object function object can be called with `new` keyword. /// /// The default is `false`. - #[inline] #[must_use] pub fn constructor(mut self, yes: bool) -> Self { match self.function { @@ -1918,7 +1904,6 @@ impl<'context> FunctionBuilder<'context> { } /// Build the function object. - #[inline] pub fn build(self) -> JsFunction { let function = JsObject::from_proto_and_data( self.context @@ -1996,7 +1981,6 @@ impl<'context> ObjectInitializer<'context> { } /// Add a function to the object. - #[inline] pub fn function( &mut self, function: NativeFunctionSignature, @@ -2025,7 +2009,6 @@ impl<'context> ObjectInitializer<'context> { } /// Add a property to the object. - #[inline] pub fn property(&mut self, key: K, value: V, attribute: Attribute) -> &mut Self where K: Into, @@ -2096,7 +2079,6 @@ impl<'context> ConstructorBuilder<'context> { } } - #[inline] pub(crate) fn with_standard_constructor( context: &'context mut Context, function: NativeFunctionSignature, @@ -2118,7 +2100,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new method to the constructors prototype. - #[inline] pub fn method( &mut self, function: NativeFunctionSignature, @@ -2147,7 +2128,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new static method to the constructors object itself. - #[inline] pub fn static_method( &mut self, function: NativeFunctionSignature, @@ -2176,7 +2156,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new data property to the constructor's prototype. - #[inline] pub fn property(&mut self, key: K, value: V, attribute: Attribute) -> &mut Self where K: Into, @@ -2192,7 +2171,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new static data property to the constructor object itself. - #[inline] pub fn static_property(&mut self, key: K, value: V, attribute: Attribute) -> &mut Self where K: Into, @@ -2208,7 +2186,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new accessor property to the constructor's prototype. - #[inline] pub fn accessor( &mut self, key: K, @@ -2229,7 +2206,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new static accessor property to the constructor object itself. - #[inline] pub fn static_accessor( &mut self, key: K, @@ -2250,7 +2226,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new property to the constructor's prototype. - #[inline] pub fn property_descriptor(&mut self, key: K, property: P) -> &mut Self where K: Into, @@ -2262,7 +2237,6 @@ impl<'context> ConstructorBuilder<'context> { } /// Add new static property to the constructor object itself. - #[inline] pub fn static_property_descriptor(&mut self, key: K, property: P) -> &mut Self where K: Into, @@ -2285,7 +2259,6 @@ impl<'context> ConstructorBuilder<'context> { /// Specify the name of the constructor function. /// /// Default is `"[object]"` - #[inline] pub fn name(&mut self, name: N) -> &mut Self where N: AsRef, @@ -2316,7 +2289,6 @@ impl<'context> ConstructorBuilder<'context> { /// inherit from. /// /// Default is `Object.prototype` - #[inline] pub fn inherit>(&mut self, prototype: O) -> &mut Self { self.inherit = Some(prototype.into()); self @@ -2325,7 +2297,6 @@ impl<'context> ConstructorBuilder<'context> { /// Specify the `[[Prototype]]` internal field of this constructor. /// /// Default is `Function.prototype` - #[inline] pub fn custom_prototype>(&mut self, prototype: O) -> &mut Self { self.custom_prototype = Some(prototype.into()); self diff --git a/boa_engine/src/object/operations.rs b/boa_engine/src/object/operations.rs index cced664067..4e80931b34 100644 --- a/boa_engine/src/object/operations.rs +++ b/boa_engine/src/object/operations.rs @@ -63,7 +63,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-get-o-p - #[inline] pub fn get(&self, key: K, context: &mut Context) -> JsResult where K: Into, @@ -80,7 +79,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-set-o-p-v-throw - #[inline] pub fn set(&self, key: K, value: V, throw: bool, context: &mut Context) -> JsResult where K: Into, @@ -206,7 +204,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-definepropertyorthrow - #[inline] pub fn define_property_or_throw( &self, key: K, @@ -238,7 +235,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-deletepropertyorthrow - #[inline] pub fn delete_property_or_throw(&self, key: K, context: &mut Context) -> JsResult where K: Into, @@ -264,7 +260,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-hasproperty - #[inline] pub fn has_property(&self, key: K, context: &mut Context) -> JsResult where K: Into, @@ -281,7 +276,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-hasownproperty - #[inline] pub fn has_own_property(&self, key: K, context: &mut Context) -> JsResult where K: Into, @@ -353,7 +347,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-setintegritylevel - #[inline] pub fn set_integrity_level( &self, level: IntegrityLevel, @@ -423,7 +416,6 @@ impl JsObject { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-testintegritylevel - #[inline] pub fn test_integrity_level( &self, level: IntegrityLevel, @@ -467,7 +459,6 @@ impl JsObject { Ok(true) } - #[inline] pub(crate) fn length_of_array_like(&self, context: &mut Context) -> JsResult { // 1. Assert: Type(obj) is Object. // 2. Return โ„(? ToLength(? Get(obj, "length"))). @@ -680,7 +671,6 @@ impl JsValue { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-getv - #[inline] pub(crate) fn get_v(&self, key: K, context: &mut Context) -> JsResult where K: Into, @@ -700,7 +690,6 @@ impl JsValue { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-getmethod - #[inline] pub(crate) fn get_method(&self, key: K, context: &mut Context) -> JsResult> where K: Into, diff --git a/boa_engine/src/object/property_map.rs b/boa_engine/src/object/property_map.rs index 63f26667c8..67b2ec08de 100644 --- a/boa_engine/src/object/property_map.rs +++ b/boa_engine/src/object/property_map.rs @@ -63,7 +63,6 @@ impl Default for IndexedProperties { impl IndexedProperties { /// Get a property descriptor if it exists. - #[inline] fn get(&self, key: u32) -> Option { match self { Self::Sparse(ref map) => map.get(&key).cloned(), @@ -79,7 +78,6 @@ impl IndexedProperties { } /// Helper function for converting from a dense storage type to sparse storage type. - #[inline] fn convert_dense_to_sparse(vec: &mut Vec) -> FxHashMap { let data = std::mem::take(vec); @@ -100,7 +98,6 @@ impl IndexedProperties { } /// Inserts a property descriptor with the specified key. - #[inline] fn insert(&mut self, key: u32, property: PropertyDescriptor) -> Option { let vec = match self { Self::Sparse(map) => return map.insert(key, property), @@ -152,7 +149,6 @@ impl IndexedProperties { } /// Inserts a property descriptor with the specified key. - #[inline] fn remove(&mut self, key: u32) -> Option { let vec = match self { Self::Sparse(map) => return map.remove(&key), @@ -418,12 +414,10 @@ impl PropertyMap { } } - #[inline] pub(crate) const fn string_property_map(&self) -> &GlobalPropertyMap { &self.string_properties.0 } - #[inline] pub(crate) fn string_property_map_mut(&mut self) -> &mut GlobalPropertyMap { &mut self.string_properties.0 } @@ -596,7 +590,6 @@ pub enum IndexProperties<'a> { impl Iterator for IndexProperties<'_> { type Item = (u32, PropertyDescriptor); - #[inline] fn next(&mut self) -> Option { match self { Self::Dense(vec) => vec.next().map(|(index, value)| { @@ -690,7 +683,6 @@ pub enum IndexPropertyValues<'a> { impl Iterator for IndexPropertyValues<'_> { type Item = PropertyDescriptor; - #[inline] fn next(&mut self) -> Option { match self { Self::Dense(vec) => vec.next().map(|value| { diff --git a/boa_engine/src/realm.rs b/boa_engine/src/realm.rs index ed8a205797..7f7df1824e 100644 --- a/boa_engine/src/realm.rs +++ b/boa_engine/src/realm.rs @@ -48,18 +48,15 @@ impl Realm { } } - #[inline] pub(crate) const fn global_object(&self) -> &JsObject { &self.global_object } - #[inline] pub(crate) fn global_bindings_mut(&mut self) -> &mut GlobalPropertyMap { self.global_property_map.string_property_map_mut() } /// Set the number of bindings on the global environment. - #[inline] pub(crate) fn set_global_binding_number(&mut self) { let binding_number = self.compile_env.borrow().num_bindings(); self.environments.set_global_binding_number(binding_number); diff --git a/boa_engine/src/string/mod.rs b/boa_engine/src/string/mod.rs index 1dd888a1b5..e8b9cdfd72 100644 --- a/boa_engine/src/string/mod.rs +++ b/boa_engine/src/string/mod.rs @@ -215,7 +215,6 @@ impl TaggedJsString { /// /// `inner` must point to a valid instance of [`RawJsString`], which should be deallocated only /// by [`JsString`]. - #[inline] const unsafe fn new_heap(inner: NonNull) -> Self { Self(inner) } @@ -226,7 +225,6 @@ impl TaggedJsString { /// # Safety /// /// `idx` must be a valid index on [`COMMON_STRINGS`]. - #[inline] const unsafe fn new_static(idx: usize) -> Self { // SAFETY: // The operation `(idx << 1) | 1` sets the least significant bit to 1, meaning any pointer @@ -235,7 +233,6 @@ impl TaggedJsString { } /// Checks if [`TaggedJsString`] contains an index for [`COMMON_STRINGS`]. - #[inline] fn is_static(self) -> bool { (self.0.as_ptr() as usize) & 1 == 1 } @@ -246,7 +243,6 @@ impl TaggedJsString { /// # Safety /// /// `self` must be a heap allocated [`RawJsString`]. - #[inline] const unsafe fn get_heap_unchecked(self) -> NonNull { self.0 } @@ -258,7 +254,6 @@ impl TaggedJsString { /// /// `self` must not be a pointer to a heap allocated [`RawJsString`], and it must be a valid /// index inside [`COMMON_STRINGS`]. - #[inline] unsafe fn get_static_unchecked(self) -> &'static [u16] { // SAFETY: // The caller must ensure `self` is a valid index inside `COMMON_STRINGS`. @@ -546,7 +541,6 @@ impl JsString { /// Returns the inner pointer data, unwrapping its tagged data if the pointer contains a static /// index for [`COMMON_STRINGS`]. - #[inline] fn ptr(&self) -> JsStringPtrKind { // Check the first bit to 1. if self.ptr.is_static() { @@ -693,7 +687,6 @@ impl Default for JsString { } impl Drop for JsString { - #[inline] fn drop(&mut self) { if let JsStringPtrKind::Heap(raw) = self.ptr() { // SAFETY: The reference count of `JsString` guarantees that `raw` is always valid. @@ -799,7 +792,6 @@ impl From for JsString { } impl From<&[u16; N]> for JsString { - #[inline] fn from(s: &[u16; N]) -> Self { Self::from(&s[..]) } @@ -953,7 +945,6 @@ mod tests { impl JsString { /// Gets the number of `JsString`s which point to this allocation. - #[inline] fn refcount(&self) -> Option { match self.ptr() { JsStringPtrKind::Heap(inner) => { diff --git a/boa_engine/src/symbol.rs b/boa_engine/src/symbol.rs index 18228c3e71..20192c2b92 100644 --- a/boa_engine/src/symbol.rs +++ b/boa_engine/src/symbol.rs @@ -360,7 +360,6 @@ impl Ord for JsSymbol { } impl Hash for JsSymbol { - #[inline] fn hash(&self, state: &mut H) { self.inner.hash.hash(state); } diff --git a/boa_engine/src/value/conversions.rs b/boa_engine/src/value/conversions.rs index 20324908b2..8a8335cec5 100644 --- a/boa_engine/src/value/conversions.rs +++ b/boa_engine/src/value/conversions.rs @@ -1,17 +1,9 @@ use super::{JsBigInt, JsObject, JsString, JsSymbol, JsValue, Profiler}; -impl From<&Self> for JsValue { - #[inline] - fn from(value: &Self) -> Self { - value.clone() - } -} - impl From for JsValue where T: Into, { - #[inline] fn from(value: T) -> Self { let _timer = Profiler::global().start_event("From", "value"); diff --git a/boa_engine/src/value/hash.rs b/boa_engine/src/value/hash.rs index 4498eca035..6536b1a77a 100644 --- a/boa_engine/src/value/hash.rs +++ b/boa_engine/src/value/hash.rs @@ -29,7 +29,6 @@ impl PartialEq for RationalHashable { impl Eq for RationalHashable {} impl Hash for RationalHashable { - #[inline] fn hash(&self, state: &mut H) { self.0.to_bits().hash(state); } diff --git a/boa_engine/src/value/mod.rs b/boa_engine/src/value/mod.rs index 2b10940fbd..018b21eabf 100644 --- a/boa_engine/src/value/mod.rs +++ b/boa_engine/src/value/mod.rs @@ -91,7 +91,6 @@ unsafe impl Trace for JsValue { impl JsValue { /// Create a new [`JsValue`]. - #[inline] pub fn new(value: T) -> Self where T: Into, @@ -197,6 +196,7 @@ impl JsValue { } /// Returns the symbol if the value is a symbol, otherwise `None`. + #[inline] pub fn as_symbol(&self) -> Option { match self { Self::Symbol(symbol) => Some(symbol.clone()), @@ -229,7 +229,6 @@ impl JsValue { } /// Returns true if the value is integer. - #[inline] #[allow(clippy::float_cmp)] pub fn is_integer(&self) -> bool { // If it can fit in a i32 and the truncated version is diff --git a/boa_engine/src/value/operations.rs b/boa_engine/src/value/operations.rs index f4b693acc6..c60e993e8d 100644 --- a/boa_engine/src/value/operations.rs +++ b/boa_engine/src/value/operations.rs @@ -11,7 +11,6 @@ use crate::{ impl JsValue { /// Perform the binary `+` operator on the value and return the result. - #[inline] pub fn add(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -52,7 +51,6 @@ impl JsValue { } /// Perform the binary `-` operator on the value and return the result. - #[inline] pub fn sub(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -79,7 +77,6 @@ impl JsValue { } /// Perform the binary `*` operator on the value and return the result. - #[inline] pub fn mul(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -106,7 +103,6 @@ impl JsValue { } /// Perform the binary `/` operator on the value and return the result. - #[inline] pub fn div(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -148,7 +144,6 @@ impl JsValue { } /// Perform the binary `%` operator on the value and return the result. - #[inline] pub fn rem(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -200,7 +195,6 @@ impl JsValue { } /// Perform the binary `**` operator on the value and return the result. - #[inline] pub fn pow(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -228,7 +222,6 @@ impl JsValue { } /// Perform the binary `&` operator on the value and return the result. - #[inline] pub fn bitand(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -259,7 +252,6 @@ impl JsValue { } /// Perform the binary `|` operator on the value and return the result. - #[inline] pub fn bitor(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -290,7 +282,6 @@ impl JsValue { } /// Perform the binary `^` operator on the value and return the result. - #[inline] pub fn bitxor(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -321,7 +312,6 @@ impl JsValue { } /// Perform the binary `<<` operator on the value and return the result. - #[inline] pub fn shl(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -354,7 +344,6 @@ impl JsValue { } /// Perform the binary `>>` operator on the value and return the result. - #[inline] pub fn shr(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -387,7 +376,6 @@ impl JsValue { } /// Perform the binary `>>>` operator on the value and return the result. - #[inline] pub fn ushr(&self, other: &Self, context: &mut Context) -> JsResult { Ok(match (self, other) { // Fast path: @@ -427,7 +415,6 @@ impl JsValue { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-instanceofoperator - #[inline] pub fn instance_of(&self, target: &Self, context: &mut Context) -> JsResult { // 1. If Type(target) is not Object, throw a TypeError exception. if !target.is_object() { @@ -462,7 +449,6 @@ impl JsValue { } /// Returns the negated value. - #[inline] pub fn neg(&self, context: &mut Context) -> JsResult { Ok(match *self { Self::Symbol(_) | Self::Undefined => Self::new(f64::NAN), diff --git a/boa_engine/src/vm/code_block.rs b/boa_engine/src/vm/code_block.rs index ec31f629c1..b94c040453 100644 --- a/boa_engine/src/vm/code_block.rs +++ b/boa_engine/src/vm/code_block.rs @@ -814,7 +814,7 @@ impl JsObject { }; for arg in args.iter().rev() { - context.vm.push(arg); + context.vm.push(arg.clone()); } let param_count = code.params.as_ref().len(); @@ -934,7 +934,7 @@ impl JsObject { }; for arg in args.iter().rev() { - context.vm.push(arg); + context.vm.push(arg.clone()); } let param_count = code.params.as_ref().len(); @@ -1427,7 +1427,7 @@ impl JsObject { }; for arg in args.iter().rev() { - context.vm.push(arg); + context.vm.push(arg.clone()); } let param_count = code.params.as_ref().len(); diff --git a/boa_engine/src/vm/flowgraph/color.rs b/boa_engine/src/vm/flowgraph/color.rs index 1caee94486..cf86ee3110 100644 --- a/boa_engine/src/vm/flowgraph/color.rs +++ b/boa_engine/src/vm/flowgraph/color.rs @@ -29,7 +29,6 @@ pub enum Color { impl Color { /// Function for converting HSV to RGB color format. #[allow(clippy::many_single_char_names)] - #[inline] #[must_use] pub fn hsv_to_rgb(h: f64, s: f64, v: f64) -> Self { let h_i = (h * 6.0) as i64; @@ -76,7 +75,6 @@ impl Color { } impl Display for Color { - #[inline] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Color::None => f.write_str(""), diff --git a/boa_engine/src/vm/flowgraph/edge.rs b/boa_engine/src/vm/flowgraph/edge.rs index cd1a6cdae6..b61b837ec4 100644 --- a/boa_engine/src/vm/flowgraph/edge.rs +++ b/boa_engine/src/vm/flowgraph/edge.rs @@ -39,7 +39,6 @@ pub struct Edge { impl Edge { /// Construct a new edge. - #[inline] pub(super) const fn new( from: usize, to: usize, diff --git a/boa_engine/src/vm/flowgraph/graph.rs b/boa_engine/src/vm/flowgraph/graph.rs index 78374f83be..137114fc58 100644 --- a/boa_engine/src/vm/flowgraph/graph.rs +++ b/boa_engine/src/vm/flowgraph/graph.rs @@ -94,7 +94,6 @@ impl SubGraph { } /// Format into the graphviz format. - #[inline] fn graphviz_format(&self, result: &mut String, prefix: &str) { result.push_str(&format!("\tsubgraph cluster_{prefix}_{} {{\n", self.label)); result.push_str("\t\tstyle = filled;\n"); @@ -158,7 +157,6 @@ impl SubGraph { } /// Format into the mermaid format. - #[inline] fn mermaid_format(&self, result: &mut String, prefix: &str) { let rankdir = match self.direction { Direction::TopToBottom => "TB", @@ -269,7 +267,6 @@ impl Graph { } /// Output the graph into the graphviz format. - #[inline] #[must_use] pub fn to_graphviz_format(&self) -> String { let mut result = String::new(); @@ -292,7 +289,6 @@ impl Graph { } /// Output the graph into the mermaid format. - #[inline] #[must_use] pub fn to_mermaid_format(&self) -> String { let mut result = String::new(); diff --git a/boa_engine/src/vm/flowgraph/mod.rs b/boa_engine/src/vm/flowgraph/mod.rs index 5b2de3d2a9..c9364234b8 100644 --- a/boa_engine/src/vm/flowgraph/mod.rs +++ b/boa_engine/src/vm/flowgraph/mod.rs @@ -16,7 +16,6 @@ pub use node::*; impl CodeBlock { /// Output the [`CodeBlock`] VM instructions into a [`Graph`]. - #[inline] pub fn to_graph(&self, interner: &Interner, graph: &mut SubGraph) { // Have to remove any invalid graph chars like `<` or `>`. let name = if self.name == Sym::MAIN { diff --git a/boa_engine/src/vm/flowgraph/node.rs b/boa_engine/src/vm/flowgraph/node.rs index 36a8fb16ea..7fef406fd2 100644 --- a/boa_engine/src/vm/flowgraph/node.rs +++ b/boa_engine/src/vm/flowgraph/node.rs @@ -26,7 +26,6 @@ pub struct Node { impl Node { /// Construct a new node. - #[inline] pub(super) fn new(location: usize, shape: NodeShape, label: Box, color: Color) -> Self { Self { location, diff --git a/boa_engine/src/vm/mod.rs b/boa_engine/src/vm/mod.rs index dabb08162d..ef30346fb3 100644 --- a/boa_engine/src/vm/mod.rs +++ b/boa_engine/src/vm/mod.rs @@ -43,7 +43,6 @@ pub struct Vm { impl Vm { /// Push a value on the stack. - #[inline] pub(crate) fn push(&mut self, value: T) where T: Into, @@ -56,14 +55,12 @@ impl Vm { /// # Panics /// /// If there is nothing to pop, then this will panic. - #[inline] #[track_caller] pub(crate) fn pop(&mut self) -> JsValue { self.stack.pop().expect("stack was empty") } #[track_caller] - #[inline] pub(crate) fn read(&mut self) -> T { let value = self.frame().code.read::(self.frame().pc); self.frame_mut().pc += size_of::(); @@ -75,7 +72,6 @@ impl Vm { /// # Panics /// /// If there is no frame, then this will panic. - #[inline] pub(crate) fn frame(&self) -> &CallFrame { self.frames.last().expect("no frame found") } @@ -85,17 +81,14 @@ impl Vm { /// # Panics /// /// If there is no frame, then this will panic. - #[inline] pub(crate) fn frame_mut(&mut self) -> &mut CallFrame { self.frames.last_mut().expect("no frame found") } - #[inline] pub(crate) fn push_frame(&mut self, frame: CallFrame) { self.frames.push(frame); } - #[inline] pub(crate) fn pop_frame(&mut self) -> Option { self.frames.pop() } diff --git a/boa_engine/src/vm/opcode/await_stm/mod.rs b/boa_engine/src/vm/opcode/await_stm/mod.rs index c9e6abb1bd..df99de7987 100644 --- a/boa_engine/src/vm/opcode/await_stm/mod.rs +++ b/boa_engine/src/vm/opcode/await_stm/mod.rs @@ -43,7 +43,7 @@ impl Operation for Await { context.vm.push_frame(frame.clone()); context.vm.frame_mut().generator_resume_kind = GeneratorResumeKind::Normal; - context.vm.push(args.get_or_undefined(0)); + context.vm.push(args.get_or_undefined(0).clone()); context.run()?; *frame = context @@ -82,7 +82,7 @@ impl Operation for Await { context.vm.push_frame(frame.clone()); context.vm.frame_mut().generator_resume_kind = GeneratorResumeKind::Throw; - context.vm.push(args.get_or_undefined(0)); + context.vm.push(args.get_or_undefined(0).clone()); context.run()?; *frame = context diff --git a/boa_engine/src/vm/opcode/environment/mod.rs b/boa_engine/src/vm/opcode/environment/mod.rs index df6b80c3bb..28ed0578de 100644 --- a/boa_engine/src/vm/opcode/environment/mod.rs +++ b/boa_engine/src/vm/opcode/environment/mod.rs @@ -19,7 +19,9 @@ impl Operation for This { fn execute(context: &mut Context) -> JsResult { let env = context.realm.environments.get_this_environment(); match env { - EnvironmentSlots::Function(env) => context.vm.push(env.borrow().get_this_binding()?), + EnvironmentSlots::Function(env) => { + context.vm.push(env.borrow().get_this_binding()?.clone()); + } EnvironmentSlots::Global => { let this = context.realm.global_object(); context.vm.push(this.clone()); diff --git a/boa_engine/src/vm/opcode/get/private.rs b/boa_engine/src/vm/opcode/get/private.rs index eb0e75cf82..199aac9337 100644 --- a/boa_engine/src/vm/opcode/get/private.rs +++ b/boa_engine/src/vm/opcode/get/private.rs @@ -24,7 +24,7 @@ impl Operation for GetPrivateField { let object_borrow_mut = object.borrow(); if let Some(element) = object_borrow_mut.get_private_element(name.sym()) { match element { - PrivateElement::Field(value) => context.vm.push(value), + PrivateElement::Field(value) => context.vm.push(value.clone()), PrivateElement::Method(method) => context.vm.push(method.clone()), PrivateElement::Accessor { getter: Some(getter), diff --git a/boa_engine/src/vm/opcode/require/mod.rs b/boa_engine/src/vm/opcode/require/mod.rs index 4ebdaa258d..484c6d4ea6 100644 --- a/boa_engine/src/vm/opcode/require/mod.rs +++ b/boa_engine/src/vm/opcode/require/mod.rs @@ -17,7 +17,7 @@ impl Operation for RequireObjectCoercible { fn execute(context: &mut Context) -> JsResult { let value = context.vm.pop(); let value = value.require_object_coercible()?; - context.vm.push(value); + context.vm.push(value.clone()); Ok(ShouldExit::False) } } diff --git a/boa_gc/src/cell.rs b/boa_gc/src/cell.rs index 953f0e4edf..2c6dccea99 100644 --- a/boa_gc/src/cell.rs +++ b/boa_gc/src/cell.rs @@ -35,7 +35,6 @@ pub(crate) const BORROWFLAG_INIT: BorrowFlag = BorrowFlag(ROOT); impl BorrowFlag { /// Check the current `BorrowState` of `BorrowFlag`. - #[inline] pub(crate) const fn borrowed(self) -> BorrowState { match self.0 & !ROOT { UNUSED => BorrowState::Unused, @@ -45,20 +44,17 @@ impl BorrowFlag { } /// Check whether the borrow bit is flagged. - #[inline] pub(crate) const fn rooted(self) -> bool { self.0 & ROOT > 0 } /// Set the `BorrowFlag`'s state to writing. - #[inline] pub(crate) const fn set_writing(self) -> Self { // Set every bit other than the root bit, which is preserved Self(self.0 | WRITING) } /// Remove the root flag on `BorrowFlag` - #[inline] pub(crate) const fn set_unused(self) -> Self { // Clear every bit other than the root bit, which is preserved Self(self.0 & ROOT) @@ -69,7 +65,6 @@ impl BorrowFlag { /// # Panic /// - This method will panic if the current `BorrowState` is writing. /// - This method will panic after incrementing if the borrow count overflows. - #[inline] pub(crate) fn add_reading(self) -> Self { assert!(self.borrowed() != BorrowState::Writing); // Add 1 to the integer starting at the second binary digit. As our @@ -91,7 +86,6 @@ impl BorrowFlag { /// /// # Panic /// - This method will panic if the current `BorrowState` is not reading. - #[inline] pub(crate) fn sub_reading(self) -> Self { assert!(self.borrowed() == BorrowState::Reading); // Subtract 1 from the integer starting at the second binary digit. As @@ -104,7 +98,6 @@ impl BorrowFlag { } /// Set the root flag on the `BorrowFlag`. - #[inline] pub(crate) fn set_rooted(self, rooted: bool) -> Self { // Preserve the non-root bits Self((self.0 & !ROOT) | (usize::from(rooted))) @@ -131,7 +124,6 @@ pub struct GcCell { impl GcCell { /// Creates a new `GcCell` containing `value`. - #[inline] pub const fn new(value: T) -> Self { Self { flags: Cell::new(BORROWFLAG_INIT), @@ -140,7 +132,6 @@ impl GcCell { } /// Consumes the `GcCell`, returning the wrapped value. - #[inline] pub fn into_inner(self) -> T { self.cell.into_inner() } @@ -155,7 +146,6 @@ impl GcCell { /// # Panics /// /// Panics if the value is currently mutably borrowed. - #[inline] pub fn borrow(&self) -> GcCellRef<'_, T> { match self.try_borrow() { Ok(value) => value, @@ -171,7 +161,6 @@ impl GcCell { /// # Panics /// /// Panics if the value is currently borrowed. - #[inline] pub fn borrow_mut(&self) -> GcCellRefMut<'_, T> { match self.try_borrow_mut() { Ok(value) => value, @@ -265,7 +254,6 @@ impl Finalize for GcCell {} // Implementing a Trace while the cell is being written to or incorrectly implementing Trace // on GcCell's value may cause Undefined Behavior unsafe impl Trace for GcCell { - #[inline] unsafe fn trace(&self) { match self.flags.get().borrowed() { BorrowState::Writing => (), @@ -274,7 +262,6 @@ unsafe impl Trace for GcCell { } } - #[inline] unsafe fn weak_trace(&self) { match self.flags.get().borrowed() { BorrowState::Writing => (), @@ -294,7 +281,6 @@ unsafe impl Trace for GcCell { } } - #[inline] unsafe fn unroot(&self) { assert!(self.flags.get().rooted(), "Can't unroot a GcCell twice!"); self.flags.set(self.flags.get().set_rooted(false)); @@ -306,7 +292,6 @@ unsafe impl Trace for GcCell { } } - #[inline] fn run_finalizer(&self) { Finalize::finalize(self); match self.flags.get().borrowed() { @@ -332,7 +317,6 @@ impl<'a, T: ?Sized> GcCellRef<'a, T> { /// `GcCellRef::clone(...)`. A `Clone` implementation or a method /// would interfere with the use of `c.borrow().clone()` to clone /// the contents of a `GcCell`. - #[inline] #[allow(clippy::should_implement_trait)] #[must_use] pub fn clone(orig: &GcCellRef<'a, T>) -> GcCellRef<'a, T> { @@ -350,7 +334,6 @@ impl<'a, T: ?Sized> GcCellRef<'a, T> { /// This is an associated function that needs to be used as `GcCellRef::map(...)`. /// A method would interfere with methods of the same name on the contents /// of a `GcCellRef` used through `Deref`. - #[inline] pub fn map(orig: Self, f: F) -> GcCellRef<'a, U> where U: ?Sized, @@ -374,7 +357,6 @@ impl<'a, T: ?Sized> GcCellRef<'a, T> { /// /// This is an associated function that needs to be used as `GcCellRef::map_split(...)`. /// A method would interfere with methods of the same name on the contents of a `GcCellRef` used through `Deref`. - #[inline] pub fn map_split(orig: Self, f: F) -> (GcCellRef<'a, U>, GcCellRef<'a, V>) where U: ?Sized, @@ -407,7 +389,6 @@ impl<'a, T: ?Sized> GcCellRef<'a, T> { impl Deref for GcCellRef<'_, T> { type Target = T; - #[inline] fn deref(&self) -> &T { self.value } @@ -447,7 +428,6 @@ impl<'a, T: Trace + ?Sized, U: ?Sized> GcCellRefMut<'a, T, U> { /// This is an associated function that needs to be used as /// `GcCellRefMut::map(...)`. A method would interfere with methods of the same /// name on the contents of a `GcCell` used through `Deref`. - #[inline] pub fn map(orig: Self, f: F) -> GcCellRefMut<'a, T, V> where V: ?Sized, @@ -473,21 +453,18 @@ impl<'a, T: Trace + ?Sized, U: ?Sized> GcCellRefMut<'a, T, U> { impl Deref for GcCellRefMut<'_, T, U> { type Target = U; - #[inline] fn deref(&self) -> &U { self.value } } impl DerefMut for GcCellRefMut<'_, T, U> { - #[inline] fn deref_mut(&mut self) -> &mut U { self.value } } impl Drop for GcCellRefMut<'_, T, U> { - #[inline] fn drop(&mut self) { debug_assert!(self.gc_cell.flags.get().borrowed() == BorrowState::Writing); // Restore the rooted state of the GcCell's contents to the state of the GcCell. @@ -521,14 +498,12 @@ impl Display for GcCellRefMut<'_, T, U> unsafe impl Send for GcCell {} impl Clone for GcCell { - #[inline] fn clone(&self) -> Self { Self::new(self.borrow().clone()) } } impl Default for GcCell { - #[inline] fn default() -> Self { Self::new(Default::default()) } @@ -573,7 +548,6 @@ impl PartialOrd for GcCell { } impl Ord for GcCell { - #[inline] fn cmp(&self, other: &Self) -> Ordering { (*self.borrow()).cmp(&*other.borrow()) } diff --git a/boa_gc/src/internals/ephemeron_box.rs b/boa_gc/src/internals/ephemeron_box.rs index 0056736eef..d5577ecfd4 100644 --- a/boa_gc/src/internals/ephemeron_box.rs +++ b/boa_gc/src/internals/ephemeron_box.rs @@ -18,7 +18,6 @@ impl EphemeronBox { impl EphemeronBox { /// Checks if the key pointer is marked by Trace - #[inline] pub(crate) fn is_marked(&self) -> bool { self.inner_key().map_or(false, GcBox::is_marked) } @@ -26,14 +25,12 @@ impl EphemeronBox { /// Returns some pointer to the `key`'s `GcBox` or None /// # Panics /// This method will panic if called while the garbage collector is dropping. - #[inline] pub(crate) fn inner_key_ptr(&self) -> Option<*mut GcBox> { assert!(finalizer_safe()); self.key.get().map(NonNull::as_ptr) } /// Returns some reference to `key`'s `GcBox` or None - #[inline] pub(crate) fn inner_key(&self) -> Option<&GcBox> { // SAFETY: This is safe as `EphemeronBox::inner_key_ptr()` will // fetch either a live `GcBox` or None. The value of `key` is set @@ -43,19 +40,16 @@ impl EphemeronBox { } /// Returns a reference to the value of `key`'s `GcBox` - #[inline] pub(crate) fn key(&self) -> Option<&K> { self.inner_key().map(GcBox::value) } /// Returns a reference to `value` - #[inline] pub(crate) const fn value(&self) -> &V { &self.value } /// Calls [`Trace::weak_trace()`][crate::Trace] on key - #[inline] fn weak_trace_key(&self) { if let Some(key) = self.inner_key() { key.weak_trace_inner(); @@ -63,7 +57,6 @@ impl EphemeronBox { } /// Calls [`Trace::weak_trace()`][crate::Trace] on value - #[inline] fn weak_trace_value(&self) { // SAFETY: Value is a sized element that must implement trace. The // operation is safe as EphemeronBox owns value and `Trace::weak_trace` @@ -78,7 +71,6 @@ impl EphemeronBox { // and therefore so has the `GcBox` that `key`stores the pointer to, then we set `key` // to None to guarantee that we do not access freed memory. impl Finalize for EphemeronBox { - #[inline] fn finalize(&self) { self.key.set(None); } @@ -88,20 +80,17 @@ impl Finalize for EphemeronBox { // to determine whether the key field is stored and `Trace::weak_trace` which continues the `Trace::weak_trace()` // into `key` and `value`. unsafe impl Trace for EphemeronBox { - #[inline] unsafe fn trace(&self) { /* An ephemeron is never traced with Phase One Trace */ } /// Checks if the `key`'s `GcBox` has been marked by `Trace::trace()` or `Trace::weak_trace`. - #[inline] fn is_marked_ephemeron(&self) -> bool { self.is_marked() } /// Checks if this `EphemeronBox` has already been determined reachable. If so, continue to trace /// value in `key` and `value`. - #[inline] unsafe fn weak_trace(&self) { if self.is_marked() { self.weak_trace_key(); @@ -110,11 +99,9 @@ unsafe impl Trace for EphemeronBox { } // EphemeronBox does not implement root. - #[inline] unsafe fn root(&self) {} // EphemeronBox does not implement unroot - #[inline] unsafe fn unroot(&self) {} // An `EphemeronBox`'s key is set to None once it has been finalized. @@ -122,7 +109,6 @@ unsafe impl Trace for EphemeronBox { // NOTE: while it is possible for the `key`'s pointer value to be // resurrected, we should still consider the finalize the ephemeron // box and set the `key` to None. - #[inline] fn run_finalizer(&self) { Finalize::finalize(self); } diff --git a/boa_gc/src/internals/gc_box.rs b/boa_gc/src/internals/gc_box.rs index 8ce48182ec..9c31eae27b 100644 --- a/boa_gc/src/internals/gc_box.rs +++ b/boa_gc/src/internals/gc_box.rs @@ -28,7 +28,6 @@ pub(crate) struct GcBoxHeader { impl GcBoxHeader { /// Creates a new `GcBoxHeader` with a root of 1 and next set to None. - #[inline] pub(crate) fn new() -> Self { Self { roots: Cell::new(1), @@ -37,7 +36,6 @@ impl GcBoxHeader { } /// Creates a new `GcBoxHeader` with the Weak bit at 1 and roots of 1. - #[inline] pub(crate) fn new_weak() -> Self { // Set weak_flag Self { @@ -47,13 +45,11 @@ impl GcBoxHeader { } /// Returns the `GcBoxHeader`'s current root count - #[inline] pub(crate) fn roots(&self) -> usize { self.roots.get() & ROOTS_MASK } /// Increments `GcBoxHeader`'s root count. - #[inline] pub(crate) fn inc_roots(&self) { let roots = self.roots.get(); @@ -66,7 +62,6 @@ impl GcBoxHeader { } /// Decreases `GcBoxHeader`'s current root count. - #[inline] pub(crate) fn dec_roots(&self) { // Underflow check as a stop gap for current issue when dropping. if self.roots.get() > 0 { @@ -75,25 +70,21 @@ impl GcBoxHeader { } /// Returns a bool for whether `GcBoxHeader`'s mark bit is 1. - #[inline] pub(crate) fn is_marked(&self) -> bool { self.roots.get() & MARK_MASK != 0 } /// Sets `GcBoxHeader`'s mark bit to 1. - #[inline] pub(crate) fn mark(&self) { self.roots.set(self.roots.get() | MARK_MASK); } /// Sets `GcBoxHeader`'s mark bit to 0. - #[inline] pub(crate) fn unmark(&self) { self.roots.set(self.roots.get() & !MARK_MASK); } /// Returns a bool for whether the `GcBoxHeader`'s weak bit is 1. - #[inline] pub(crate) fn is_ephemeron(&self) -> bool { self.roots.get() & WEAK_MASK != 0 } @@ -143,7 +134,6 @@ impl GcBox { } /// Marks this `GcBox` and marks through its data. - #[inline] pub(crate) unsafe fn trace_inner(&self) { if !self.header.is_marked() && !self.header.is_ephemeron() { self.header.mark(); @@ -158,7 +148,6 @@ impl GcBox { } /// Trace inner data and search for ephemerons to add to the ephemeron queue. - #[inline] pub(crate) fn weak_trace_inner(&self) { if !self.header.is_marked() && !self.header.is_ephemeron() { self.header.mark(); @@ -173,7 +162,6 @@ impl GcBox { /// Increases the root count on this `GcBox`. /// /// Roots prevent the `GcBox` from being destroyed by the garbage collector. - #[inline] pub(crate) fn root_inner(&self) { self.header.inc_roots(); } @@ -181,19 +169,16 @@ impl GcBox { /// Decreases the root count on this `GcBox`. /// /// Roots prevent the `GcBox` from being destroyed by the garbage collector. - #[inline] pub(crate) fn unroot_inner(&self) { self.header.dec_roots(); } /// Returns a reference to the `GcBox`'s value. - #[inline] pub(crate) const fn value(&self) -> &T { &self.value } /// Returns a bool for whether the header is marked. - #[inline] pub(crate) fn is_marked(&self) -> bool { self.header.is_marked() } diff --git a/boa_gc/src/pointers/ephemeron.rs b/boa_gc/src/pointers/ephemeron.rs index db21d28c53..c8890b6cb6 100644 --- a/boa_gc/src/pointers/ephemeron.rs +++ b/boa_gc/src/pointers/ephemeron.rs @@ -31,31 +31,26 @@ impl Ephemeron { } impl Ephemeron { - #[inline] fn inner_ptr(&self) -> NonNull>> { self.inner_ptr.get() } - #[inline] fn inner(&self) -> &GcBox> { // SAFETY: GcBox> must live until it is unrooted by Drop unsafe { &*self.inner_ptr().as_ptr() } } - #[inline] /// Gets the weak key of this `Ephemeron`, or `None` if the key was already garbage /// collected. pub fn key(&self) -> Option<&K> { self.inner().value().key() } - #[inline] /// Gets the stored value of this `Ephemeron`. pub fn value(&self) -> &V { self.inner().value().value() } - #[inline] /// Gets a `Gc` for the stored key of this `Ephemeron`. pub fn upgrade_key(&self) -> Option> { // SAFETY: ptr must be a valid pointer or None would have been returned. @@ -71,11 +66,9 @@ impl Finalize for Ephemeron {} // SAFETY: Ephemerons trace implementation is standard for everything except `Trace::weak_trace()`, // which pushes the GcBox> onto the EphemeronQueue unsafe impl Trace for Ephemeron { - #[inline] unsafe fn trace(&self) {} // Push this Ephemeron's pointer onto the EphemeronQueue - #[inline] unsafe fn weak_trace(&self) { EPHEMERON_QUEUE.with(|q| { let mut queue = q.take().expect("queue is initialized by weak_trace"); @@ -83,20 +76,16 @@ unsafe impl Trace for Ephemeron { }); } - #[inline] unsafe fn root(&self) {} - #[inline] unsafe fn unroot(&self) {} - #[inline] fn run_finalizer(&self) { Finalize::finalize(self); } } impl Clone for Ephemeron { - #[inline] fn clone(&self) -> Self { // SAFETY: This is safe because the inner_ptr must live as long as it's roots. // Mismanagement of roots can cause inner_ptr to use after free or Undefined @@ -113,7 +102,6 @@ impl Clone for Ephemeron { } impl Drop for Ephemeron { - #[inline] fn drop(&mut self) { // NOTE: We assert that this drop call is not a // drop from `Collector::dump` or `Collector::sweep` diff --git a/boa_gc/src/pointers/gc.rs b/boa_gc/src/pointers/gc.rs index 2dc9f275fa..01c06e7a2e 100644 --- a/boa_gc/src/pointers/gc.rs +++ b/boa_gc/src/pointers/gc.rs @@ -105,7 +105,6 @@ impl Gc { } } - #[inline] pub(crate) fn inner_ptr(&self) -> NonNull> { assert!(finalizer_safe()); // SAFETY: inner_ptr must be a live GcBox. Calling this on a dropped GcBox @@ -113,7 +112,6 @@ impl Gc { unsafe { clear_root_bit(self.inner_ptr.get()) } } - #[inline] fn inner(&self) -> &GcBox { // SAFETY: Please see Gc::inner_ptr() unsafe { self.inner_ptr().as_ref() } @@ -125,7 +123,6 @@ impl Finalize for Gc {} // SAFETY: `Gc` maintains it's own rootedness and implements all methods of // Trace. It is not possible to root an already rooted `Gc` and vice versa. unsafe impl Trace for Gc { - #[inline] unsafe fn trace(&self) { // SAFETY: Inner must be live and allocated GcBox. unsafe { @@ -133,12 +130,10 @@ unsafe impl Trace for Gc { } } - #[inline] unsafe fn weak_trace(&self) { self.inner().weak_trace_inner(); } - #[inline] unsafe fn root(&self) { assert!(!self.rooted(), "Can't double-root a Gc"); // Try to get inner before modifying our state. Inner may be @@ -148,7 +143,6 @@ unsafe impl Trace for Gc { self.set_root(); } - #[inline] unsafe fn unroot(&self) { assert!(self.rooted(), "Can't double-unroot a Gc"); // Try to get inner before modifying our state. Inner may be @@ -158,14 +152,12 @@ unsafe impl Trace for Gc { self.clear_root(); } - #[inline] fn run_finalizer(&self) { Finalize::finalize(self); } } impl Clone for Gc { - #[inline] fn clone(&self) -> Self { Self::from_ptr(self.inner_ptr()) } @@ -174,14 +166,12 @@ impl Clone for Gc { impl Deref for Gc { type Target = T; - #[inline] fn deref(&self) -> &T { self.inner().value() } } impl Drop for Gc { - #[inline] fn drop(&mut self) { // If this pointer was a root, we should unroot it. if self.rooted() { @@ -191,7 +181,6 @@ impl Drop for Gc { } impl Default for Gc { - #[inline] fn default() -> Self { Self::new(Default::default()) } @@ -236,7 +225,6 @@ impl PartialOrd for Gc { } impl Ord for Gc { - #[inline] fn cmp(&self, other: &Self) -> Ordering { (**self).cmp(&**other) } diff --git a/boa_gc/src/pointers/weak.rs b/boa_gc/src/pointers/weak.rs index 26a1945efa..ffed6c72eb 100644 --- a/boa_gc/src/pointers/weak.rs +++ b/boa_gc/src/pointers/weak.rs @@ -20,13 +20,11 @@ impl WeakGc { } impl WeakGc { - #[inline] /// Gets the value of this weak pointer, or `None` if the value was already garbage collected. pub fn value(&self) -> Option<&T> { self.inner.key() } - #[inline] /// Upgrade returns a `Gc` pointer for the internal value if valid, or None if the value was already garbage collected. pub fn upgrade(&self) -> Option> { self.inner.upgrade_key() @@ -34,7 +32,6 @@ impl WeakGc { } impl Clone for WeakGc { - #[inline] fn clone(&self) -> Self { Self { inner: self.inner.clone(), diff --git a/boa_gc/src/trace.rs b/boa_gc/src/trace.rs index 06512fcaa7..ec6ddfab13 100644 --- a/boa_gc/src/trace.rs +++ b/boa_gc/src/trace.rs @@ -105,7 +105,6 @@ macro_rules! custom_trace { ($this:ident, $body:expr) => { #[inline] unsafe fn trace(&self) { - #[inline] fn mark(it: &T) { // SAFETY: The implementor must ensure that `trace` is correctly implemented. unsafe { @@ -117,7 +116,6 @@ macro_rules! custom_trace { } #[inline] unsafe fn weak_trace(&self) { - #[inline] fn mark(it: &T) { // SAFETY: The implementor must ensure that `weak_trace` is correctly implemented. unsafe { @@ -129,7 +127,6 @@ macro_rules! custom_trace { } #[inline] unsafe fn root(&self) { - #[inline] fn mark(it: &T) { // SAFETY: The implementor must ensure that `root` is correctly implemented. unsafe { @@ -141,7 +138,6 @@ macro_rules! custom_trace { } #[inline] unsafe fn unroot(&self) { - #[inline] fn mark(it: &T) { // SAFETY: The implementor must ensure that `unroot` is correctly implemented. unsafe { @@ -153,7 +149,6 @@ macro_rules! custom_trace { } #[inline] fn run_finalizer(&self) { - #[inline] fn mark(it: &T) { $crate::Trace::run_finalizer(it); } diff --git a/boa_interner/src/interned_str.rs b/boa_interner/src/interned_str.rs index e534914ff5..c6833771c9 100644 --- a/boa_interner/src/interned_str.rs +++ b/boa_interner/src/interned_str.rs @@ -26,7 +26,6 @@ impl InternedStr { /// /// Not maintaining the invariants specified on the struct definition /// could cause Undefined Behaviour. - #[inline] pub(super) const unsafe fn new(ptr: NonNull<[Char]>) -> Self { Self { ptr } } @@ -37,7 +36,6 @@ impl InternedStr { /// /// Not maintaining the invariants specified on the struct definition /// could cause Undefined Behaviour. - #[inline] pub(super) unsafe fn as_ref(&self) -> &[Char] { // SAFETY: // The caller must ensure `ptr` is still valid throughout the diff --git a/boa_interner/src/lib.rs b/boa_interner/src/lib.rs index dbbad51bc2..ef15bdac58 100644 --- a/boa_interner/src/lib.rs +++ b/boa_interner/src/lib.rs @@ -371,7 +371,6 @@ impl Interner { } /// Returns the string for the given symbol if any. - #[inline] #[must_use] pub fn resolve(&self, symbol: Sym) -> Option> { let index = symbol.get() - 1; diff --git a/boa_interner/src/raw.rs b/boa_interner/src/raw.rs index 2fed0be399..2428ae1d51 100644 --- a/boa_interner/src/raw.rs +++ b/boa_interner/src/raw.rs @@ -36,7 +36,6 @@ impl Default for RawInterner { impl RawInterner { /// Creates a new `RawInterner` with the specified capacity. - #[inline] pub(super) fn with_capacity(capacity: usize) -> Self { Self { symbol_cache: FxHashMap::default(), @@ -47,13 +46,11 @@ impl RawInterner { } /// Returns the number of strings interned by the interner. - #[inline] pub(super) fn len(&self) -> usize { self.spans.len() } /// Returns `true` if the interner contains no interned strings. - #[inline] pub(super) fn is_empty(&self) -> bool { self.spans.is_empty() } @@ -105,7 +102,6 @@ where } /// Returns the string for the given index if any. - #[inline] pub(super) fn index(&self, index: usize) -> Option<&[Char]> { self.spans.get(index).map(|ptr| // SAFETY: We always ensure the stored `InternedStr`s always diff --git a/boa_interner/src/sym.rs b/boa_interner/src/sym.rs index b7b381a9ec..a2f32cb60b 100644 --- a/boa_interner/src/sym.rs +++ b/boa_interner/src/sym.rs @@ -111,7 +111,6 @@ impl Sym { pub const NAME: Self = unsafe { Self::new_unchecked(30) }; /// Creates a new [`Sym`] from the provided `value`, or returns `None` if `index` is zero. - #[inline] pub(super) fn new(value: usize) -> Option { NonZeroUsize::new(value).map(|value| Self { value }) } @@ -121,7 +120,6 @@ impl Sym { /// # Safety /// /// `value` must not be zero. - #[inline] pub(super) const unsafe fn new_unchecked(value: usize) -> Self { Self { value: diff --git a/boa_macros/src/lib.rs b/boa_macros/src/lib.rs index c875947a10..b68551d7c1 100644 --- a/boa_macros/src/lib.rs +++ b/boa_macros/src/lib.rs @@ -96,7 +96,6 @@ fn derive_trace(mut s: Structure<'_>) -> proc_macro2::TokenStream { #[inline] unsafe fn trace(&self) { #[allow(dead_code)] - #[inline] fn mark(it: &T) { unsafe { ::boa_gc::Trace::trace(it); @@ -107,7 +106,6 @@ fn derive_trace(mut s: Structure<'_>) -> proc_macro2::TokenStream { #[inline] unsafe fn weak_trace(&self) { #[allow(dead_code, unreachable_code)] - #[inline] fn mark(it: &T) { unsafe { ::boa_gc::Trace::weak_trace(it) @@ -118,7 +116,6 @@ fn derive_trace(mut s: Structure<'_>) -> proc_macro2::TokenStream { #[inline] unsafe fn root(&self) { #[allow(dead_code)] - #[inline] fn mark(it: &T) { unsafe { ::boa_gc::Trace::root(it); @@ -129,7 +126,6 @@ fn derive_trace(mut s: Structure<'_>) -> proc_macro2::TokenStream { #[inline] unsafe fn unroot(&self) { #[allow(dead_code)] - #[inline] fn mark(it: &T) { unsafe { ::boa_gc::Trace::unroot(it); @@ -141,7 +137,6 @@ fn derive_trace(mut s: Structure<'_>) -> proc_macro2::TokenStream { fn run_finalizer(&self) { ::boa_gc::Finalize::finalize(self); #[allow(dead_code)] - #[inline] fn mark(it: &T) { unsafe { ::boa_gc::Trace::run_finalizer(it); diff --git a/boa_parser/src/error.rs b/boa_parser/src/error.rs index 336bff5ca9..2213e1aa60 100644 --- a/boa_parser/src/error.rs +++ b/boa_parser/src/error.rs @@ -12,7 +12,6 @@ pub(crate) trait ErrorContext { } impl ErrorContext for ParseResult { - #[inline] fn context(self, context: &'static str) -> Self { self.map_err(|e| e.context(context)) } @@ -89,7 +88,6 @@ impl Error { } /// Creates an `Expected` parsing error. - #[inline] pub(crate) fn expected(expected: E, found: F, span: Span, context: &'static str) -> Self where E: Into>, @@ -104,7 +102,6 @@ impl Error { } /// Creates an `Expected` parsing error. - #[inline] pub(crate) fn unexpected(found: F, span: Span, message: C) -> Self where F: Into>, @@ -118,13 +115,11 @@ impl Error { } /// Creates a "general" parsing error. - #[inline] pub(crate) const fn general(message: &'static str, position: Position) -> Self { Self::General { message, position } } /// Creates a "general" parsing error with the specific error message for a wrong function declaration in non-strict mode. - #[inline] pub(crate) const fn wrong_function_declaration_non_strict(position: Position) -> Self { Self::General { message: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.", @@ -133,7 +128,6 @@ impl Error { } /// Creates a "general" parsing error with the specific error message for a wrong function declaration with label. - #[inline] pub(crate) const fn wrong_labelled_function_declaration(position: Position) -> Self { Self::General { message: "Labelled functions can only be declared at top level or inside a block", @@ -142,7 +136,6 @@ impl Error { } /// Creates a parsing error from a lexing error. - #[inline] pub(crate) const fn lex(e: LexError) -> Self { Self::Lex { err: e } } diff --git a/boa_parser/src/lexer/cursor.rs b/boa_parser/src/lexer/cursor.rs index 88a095c529..06ec3dc466 100644 --- a/boa_parser/src/lexer/cursor.rs +++ b/boa_parser/src/lexer/cursor.rs @@ -13,13 +13,11 @@ pub(super) struct Cursor { impl Cursor { /// Gets the current position of the cursor in the source code. - #[inline] pub(super) const fn pos(&self) -> Position { self.pos } /// Advances the position to the next column. - #[inline] pub(super) fn next_column(&mut self) { let current_line = self.pos.line_number(); let next_column = self.pos.column_number() + 1; @@ -27,19 +25,16 @@ impl Cursor { } /// Advances the position to the next line. - #[inline] fn next_line(&mut self) { let next_line = self.pos.line_number() + 1; self.pos = Position::new(next_line, 1); } - #[inline] /// Returns if strict mode is currently active. pub(super) const fn strict_mode(&self) -> bool { self.strict_mode } - #[inline] /// Sets the current strict mode. pub(super) fn set_strict_mode(&mut self, strict_mode: bool) { self.strict_mode = strict_mode; @@ -51,7 +46,6 @@ where R: Read, { /// Creates a new Lexer cursor. - #[inline] pub(super) fn new(inner: R) -> Self { Self { iter: InnerIter::new(inner.bytes()), @@ -61,7 +55,6 @@ where } /// Creates a new Lexer cursor with an initial position. - #[inline] pub(super) fn with_position(inner: R, pos: Position) -> Self { Self { iter: InnerIter::new(inner.bytes()), @@ -71,7 +64,6 @@ where } /// Peeks the next byte. - #[inline] pub(super) fn peek(&mut self) -> Result, Error> { let _timer = Profiler::global().start_event("cursor::peek()", "Lexing"); @@ -79,7 +71,6 @@ where } /// Peeks the next n bytes, the maximum number of peeked bytes is 4 (n <= 4). - #[inline] pub(super) fn peek_n(&mut self, n: u8) -> Result<&[u8], Error> { let _timer = Profiler::global().start_event("cursor::peek_n()", "Lexing"); @@ -87,15 +78,13 @@ where } /// Peeks the next UTF-8 character in u32 code point. - #[inline] pub(super) fn peek_char(&mut self) -> Result, Error> { let _timer = Profiler::global().start_event("cursor::peek_char()", "Lexing"); self.iter.peek_char() } - /// Compares the byte passed in to the next byte, if they match true is returned and the buffer is incremented - #[inline] + /// Compares the byte passed in to the next byte, if they match true is returned and the buffer is incremented. pub(super) fn next_is(&mut self, byte: u8) -> io::Result { let _timer = Profiler::global().start_event("cursor::next_is()", "Lexing"); @@ -113,7 +102,6 @@ where /// Otherwise returns the result from the predicate on the ascii in char /// /// The buffer is not incremented. - #[inline] pub(super) fn next_is_ascii_pred(&mut self, pred: &F) -> io::Result where F: Fn(char) -> bool, @@ -132,7 +120,6 @@ where /// /// The buffer is not incremented. #[allow(dead_code)] - #[inline] pub(super) fn next_is_char_pred(&mut self, pred: &F) -> io::Result where F: Fn(u32) -> bool, @@ -217,7 +204,6 @@ where /// /// This expects for the buffer to be fully filled. If it's not, it will fail with an /// `UnexpectedEof` I/O error. - #[inline] pub(super) fn fill_bytes(&mut self, buf: &mut [u8]) -> io::Result<()> { let _timer = Profiler::global().start_event("cursor::fill_bytes()", "Lexing"); @@ -225,7 +211,6 @@ where } /// Retrieves the next byte. - #[inline] pub(crate) fn next_byte(&mut self) -> Result, Error> { let _timer = Profiler::global().start_event("cursor::next_byte()", "Lexing"); @@ -259,7 +244,6 @@ where } /// Retrieves the next UTF-8 character. - #[inline] pub(crate) fn next_char(&mut self) -> Result, Error> { let _timer = Profiler::global().start_event("cursor::next_char()", "Lexing"); @@ -296,7 +280,6 @@ struct InnerIter { impl InnerIter { /// Creates a new inner iterator. - #[inline] const fn new(iter: Bytes) -> Self { Self { iter, @@ -315,7 +298,6 @@ where /// /// This expects for the buffer to be fully filled. If it's not, it will fail with an /// `UnexpectedEof` I/O error. - #[inline] fn fill_bytes(&mut self, buf: &mut [u8]) -> io::Result<()> { for byte in buf.iter_mut() { *byte = self.next_byte()?.ok_or_else(|| { @@ -329,7 +311,6 @@ where } /// Increments the iter by n bytes. - #[inline] fn increment(&mut self, n: u32) -> Result<(), Error> { for _ in 0..n { if (self.next_byte()?).is_none() { @@ -340,7 +321,6 @@ where } /// Peeks the next byte. - #[inline] pub(super) fn peek_byte(&mut self) -> Result, Error> { if self.num_peeked_bytes > 0 { let byte = self.peeked_bytes[0]; @@ -358,7 +338,6 @@ where } /// Peeks the next n bytes, the maximum number of peeked bytes is 4 (n <= 4). - #[inline] pub(super) fn peek_n_bytes(&mut self, n: u8) -> Result<&[u8], Error> { while self.num_peeked_bytes < n && self.num_peeked_bytes < 4 { match self.iter.next().transpose()? { @@ -373,7 +352,6 @@ where } /// Peeks the next unchecked character in u32 code point. - #[inline] pub(super) fn peek_char(&mut self) -> Result, Error> { if let Some(ch) = self.peeked_char { Ok(ch) @@ -423,7 +401,6 @@ where } /// Retrieves the next byte - #[inline] fn next_byte(&mut self) -> io::Result> { self.peeked_char = None; if self.num_peeked_bytes > 0 { @@ -437,7 +414,6 @@ where } /// Retrieves the next unchecked char in u32 code point. - #[inline] fn next_char(&mut self) -> io::Result> { if let Some(ch) = self.peeked_char.take() { if let Some(c) = ch { @@ -483,30 +459,25 @@ const CONT_MASK: u8 = 0b0011_1111; /// Returns the initial codepoint accumulator for the first byte. /// The first byte is special, only want bottom 5 bits for width 2, 4 bits /// for width 3, and 3 bits for width 4. -#[inline] fn utf8_first_byte(byte: u8, width: u32) -> u32 { u32::from(byte & (0x7F >> width)) } /// Returns the value of `ch` updated with continuation byte `byte`. -#[inline] fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | u32::from(byte & CONT_MASK) } /// Checks whether the byte is a UTF-8 first byte (i.e., ascii byte or starts with the /// bits `11`). -#[inline] const fn utf8_is_first_byte(byte: u8) -> bool { byte <= 0x7F || (byte >> 6) == 0x11 } -#[inline] fn unwrap_or_0(opt: Option) -> u8 { opt.unwrap_or(0) } -#[inline] const fn utf8_len(ch: u32) -> u32 { if ch <= 0x7F { 1 diff --git a/boa_parser/src/lexer/identifier.rs b/boa_parser/src/lexer/identifier.rs index 288cef2d16..aca96e5aef 100644 --- a/boa_parser/src/lexer/identifier.rs +++ b/boa_parser/src/lexer/identifier.rs @@ -22,7 +22,6 @@ pub(super) struct Identifier { impl Identifier { /// Creates a new identifier/keyword lexer. - #[inline] pub(super) const fn new(init: char) -> Self { Self { init } } @@ -33,7 +32,6 @@ impl Identifier { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-names-and-keywords - #[inline] pub(super) fn is_identifier_start(ch: u32) -> bool { matches!(ch, 0x0024 /* $ */ | 0x005F /* _ */) || char::try_from(ch).map_or(false, char::is_id_start) @@ -45,7 +43,6 @@ impl Identifier { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-names-and-keywords - #[inline] fn is_identifier_part(ch: u32) -> bool { matches!( ch, @@ -82,7 +79,6 @@ impl Tokenizer for Identifier { } impl Identifier { - #[inline] pub(super) fn take_identifier_name( cursor: &mut Cursor, start_pos: Position, diff --git a/boa_parser/src/lexer/mod.rs b/boa_parser/src/lexer/mod.rs index 3d878af86c..9e83814101 100644 --- a/boa_parser/src/lexer/mod.rs +++ b/boa_parser/src/lexer/mod.rs @@ -89,31 +89,26 @@ impl Lexer { } /// Sets the goal symbol for the lexer. - #[inline] pub(crate) fn set_goal(&mut self, elm: InputElement) { self.goal_symbol = elm; } /// Gets the goal symbol the lexer is currently using. - #[inline] pub(crate) const fn get_goal(&self) -> InputElement { self.goal_symbol } - #[inline] /// Returns if strict mode is currently active. pub(super) const fn strict_mode(&self) -> bool { self.cursor.strict_mode() } - #[inline] /// Sets the current strict mode. pub(super) fn set_strict_mode(&mut self, strict_mode: bool) { self.cursor.set_strict_mode(strict_mode); } /// Creates a new lexer. - #[inline] pub fn new(reader: R) -> Self where R: Read, diff --git a/boa_parser/src/lexer/number.rs b/boa_parser/src/lexer/number.rs index 585b69a751..6852420d07 100644 --- a/boa_parser/src/lexer/number.rs +++ b/boa_parser/src/lexer/number.rs @@ -58,7 +58,6 @@ impl NumericKind { } } -#[inline] fn take_signed_integer( buf: &mut Vec, cursor: &mut Cursor, @@ -157,7 +156,6 @@ where /// - [ECMAScript Specification][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-literals-numeric-literals -#[inline] fn check_after_numeric_literal(cursor: &mut Cursor) -> Result<(), Error> where R: Read, diff --git a/boa_parser/src/lexer/string.rs b/boa_parser/src/lexer/string.rs index ed337e1b33..b3e6643f9c 100644 --- a/boa_parser/src/lexer/string.rs +++ b/boa_parser/src/lexer/string.rs @@ -54,7 +54,6 @@ pub(crate) trait UTF16CodeUnitsBuffer { } impl UTF16CodeUnitsBuffer for Vec { - #[inline] fn push_code_point(&mut self, mut code_point: u32) { if let Ok(cp) = code_point.try_into() { self.push(cp); @@ -72,7 +71,6 @@ impl UTF16CodeUnitsBuffer for Vec { self.push(cu2); } - #[inline] fn to_string_lossy(&self) -> String { String::from_utf16_lossy(self.as_slice()) } @@ -107,7 +105,6 @@ impl StringLiteral { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#prod-LineTerminator - #[inline] pub(super) const fn is_line_terminator(ch: u32) -> bool { matches!( ch, @@ -115,7 +112,6 @@ impl StringLiteral { ) } - #[inline] fn take_string_characters( cursor: &mut Cursor, start_pos: Position, @@ -163,7 +159,6 @@ impl StringLiteral { Ok((buf, Span::new(start_pos, cursor.pos()))) } - #[inline] pub(super) fn take_escape_sequence_or_line_continuation( cursor: &mut Cursor, start_pos: Position, @@ -250,7 +245,6 @@ impl StringLiteral { Ok(escape_value) } - #[inline] pub(super) fn take_unicode_escape_sequence( cursor: &mut Cursor, start_pos: Position, @@ -299,7 +293,6 @@ impl StringLiteral { } } - #[inline] fn take_hex_escape_sequence( cursor: &mut Cursor, start_pos: Position, @@ -317,7 +310,6 @@ impl StringLiteral { Ok(u32::from(code_point)) } - #[inline] fn take_legacy_octal_escape_sequence( cursor: &mut Cursor, init_byte: u8, diff --git a/boa_parser/src/parser/cursor/buffered_lexer/mod.rs b/boa_parser/src/parser/cursor/buffered_lexer/mod.rs index f8c3edf098..2256bd1cd8 100644 --- a/boa_parser/src/parser/cursor/buffered_lexer/mod.rs +++ b/boa_parser/src/parser/cursor/buffered_lexer/mod.rs @@ -36,7 +36,6 @@ impl From> for BufferedLexer where R: Read, { - #[inline] fn from(lexer: Lexer) -> Self { Self { lexer, @@ -61,7 +60,6 @@ impl From for BufferedLexer where R: Read, { - #[inline] fn from(reader: R) -> Self { Lexer::new(reader).into() } @@ -72,14 +70,12 @@ where R: Read, { /// Sets the goal symbol for the lexer. - #[inline] pub(super) fn set_goal(&mut self, elm: InputElement) { let _timer = Profiler::global().start_event("cursor::set_goal()", "Parsing"); self.lexer.set_goal(elm); } /// Lexes the next tokens as a regex assuming that the starting '/' has already been consumed. - #[inline] pub(super) fn lex_regex( &mut self, start: Position, @@ -104,12 +100,10 @@ where .map_err(Error::from) } - #[inline] pub(super) const fn strict_mode(&self) -> bool { self.lexer.strict_mode() } - #[inline] pub(super) fn set_strict_mode(&mut self, strict_mode: bool) { self.lexer.set_strict_mode(strict_mode); } diff --git a/boa_parser/src/parser/cursor/mod.rs b/boa_parser/src/parser/cursor/mod.rs index 39d97ac2fb..9614936624 100644 --- a/boa_parser/src/parser/cursor/mod.rs +++ b/boa_parser/src/parser/cursor/mod.rs @@ -41,7 +41,6 @@ where R: Read, { /// Creates a new cursor with the given reader. - #[inline] pub(super) fn new(reader: R) -> Self { Self { buffered_lexer: Lexer::new(reader).into(), @@ -51,12 +50,10 @@ where } } - #[inline] pub(super) fn set_goal(&mut self, elm: InputElement) { self.buffered_lexer.set_goal(elm); } - #[inline] pub(super) fn lex_regex( &mut self, start: Position, @@ -65,7 +62,6 @@ where self.buffered_lexer.lex_regex(start, interner) } - #[inline] pub(super) fn lex_template( &mut self, start: Position, @@ -75,7 +71,6 @@ where } /// Advances the cursor and returns the next token. - #[inline] pub(super) fn next(&mut self, interner: &mut Interner) -> ParseResult> { self.buffered_lexer.next(true, interner) } @@ -85,7 +80,6 @@ where /// # Panics /// /// This function will panic if there is no further token in the cursor. - #[inline] #[track_caller] pub(super) fn advance(&mut self, interner: &mut Interner) { self.next(interner) @@ -95,7 +89,6 @@ where /// Peeks a future token, without consuming it or advancing the cursor. /// /// You can skip some tokens with the `skip_n` option. - #[inline] pub(super) fn peek( &mut self, skip_n: usize, @@ -105,50 +98,42 @@ where } /// Gets the current strict mode for the cursor. - #[inline] pub(super) const fn strict_mode(&self) -> bool { self.buffered_lexer.strict_mode() } /// Sets the strict mode to strict or non-strict. - #[inline] pub(super) fn set_strict_mode(&mut self, strict_mode: bool) { self.buffered_lexer.set_strict_mode(strict_mode); } /// Returns if the cursor is currently in an arrow function declaration. - #[inline] pub(super) const fn arrow(&self) -> bool { self.arrow } /// Set if the cursor is currently in a arrow function declaration. - #[inline] pub(super) fn set_arrow(&mut self, arrow: bool) { self.arrow = arrow; } /// Returns if the cursor is currently used in `JSON.parse`. - #[inline] pub(super) const fn json_parse(&self) -> bool { self.json_parse } /// Set if the cursor is currently used in `JSON.parse`. - #[inline] pub(super) fn set_json_parse(&mut self, json_parse: bool) { self.json_parse = json_parse; } /// Push a new private environment. - #[inline] pub(super) fn push_private_environment(&mut self) { let new = FxHashMap::default(); self.private_environments_stack.push(new); } /// Push a used private identifier. - #[inline] pub(super) fn push_used_private_identifier( &mut self, identifier: Sym, @@ -172,7 +157,6 @@ where /// /// This function takes the private element names of the current class. /// If a used private identifier is not declared, this throws a syntax error. - #[inline] pub(super) fn pop_private_environment( &mut self, identifiers: &FxHashMap, @@ -197,7 +181,6 @@ where } /// Returns an error if the next token is not of kind `kind`. - #[inline] pub(super) fn expect( &mut self, kind: K, @@ -227,7 +210,6 @@ where /// It will automatically insert a semicolon if needed, as specified in the [spec][spec]. /// /// [spec]: https://tc39.es/ecma262/#sec-automatic-semicolon-insertion - #[inline] pub(super) fn peek_semicolon( &mut self, interner: &mut Interner, @@ -247,7 +229,6 @@ where /// It will automatically insert a semicolon if needed, as specified in the [spec][spec]. /// /// [spec]: https://tc39.es/ecma262/#sec-automatic-semicolon-insertion - #[inline] pub(super) fn expect_semicolon( &mut self, context: &'static str, @@ -277,7 +258,6 @@ where /// /// This is just syntatic sugar for a `.peek(skip_n)` call followed by a check that the result /// is not a line terminator or `None`. - #[inline] pub(super) fn peek_expect_no_lineterminator( &mut self, skip_n: usize, @@ -301,7 +281,6 @@ where } /// Check if the peeked token is a line terminator. - #[inline] pub(super) fn peek_is_line_terminator( &mut self, skip_n: usize, @@ -319,7 +298,6 @@ where /// When the next token is a `kind` token, get the token, otherwise return `None`. /// /// No next token also returns None. - #[inline] pub(super) fn next_if( &mut self, kind: K, diff --git a/boa_parser/src/parser/mod.rs b/boa_parser/src/parser/mod.rs index e3f835db61..e8a55f6655 100644 --- a/boa_parser/src/parser/mod.rs +++ b/boa_parser/src/parser/mod.rs @@ -52,7 +52,6 @@ where struct AllowYield(bool); impl From for AllowYield { - #[inline] fn from(allow: bool) -> Self { Self(allow) } @@ -63,7 +62,6 @@ impl From for AllowYield { struct AllowAwait(bool); impl From for AllowAwait { - #[inline] fn from(allow: bool) -> Self { Self(allow) } @@ -74,7 +72,6 @@ impl From for AllowAwait { struct AllowIn(bool); impl From for AllowIn { - #[inline] fn from(allow: bool) -> Self { Self(allow) } @@ -85,7 +82,6 @@ impl From for AllowIn { struct AllowReturn(bool); impl From for AllowReturn { - #[inline] fn from(allow: bool) -> Self { Self(allow) } @@ -96,7 +92,6 @@ impl From for AllowReturn { struct AllowDefault(bool); impl From for AllowDefault { - #[inline] fn from(allow: bool) -> Self { Self(allow) } @@ -119,7 +114,6 @@ pub struct Parser { impl Parser { /// Create a new `Parser` with a reader as the input to parse. - #[inline] pub fn new(reader: R) -> Self where R: Read, @@ -130,7 +124,6 @@ impl Parser { } /// Set the parser strict mode to true. - #[inline] pub fn set_strict(&mut self) where R: Read, @@ -139,7 +132,6 @@ impl Parser { } /// Set the parser strict mode to true. - #[inline] pub fn set_json_parse(&mut self) where R: Read, @@ -155,7 +147,6 @@ impl Parser { /// Will return `Err` on any parsing error, including invalid reads of the bytes being parsed. /// /// [spec]: https://tc39.es/ecma262/#prod-Script - #[inline] pub fn parse_all(&mut self, interner: &mut Interner) -> ParseResult where R: Read, @@ -172,7 +163,6 @@ impl Parser { /// Will return `Err` on any parsing error, including invalid reads of the bytes being parsed. /// /// [spec]: https://tc39.es/ecma262/#sec-performeval - #[inline] pub fn parse_eval( &mut self, direct: bool, @@ -191,7 +181,6 @@ impl Parser { /// Will return `Err` on any parsing error, including invalid reads of the bytes being parsed. /// /// [spec]: https://tc39.es/ecma262/#prod-FunctionBody - #[inline] pub fn parse_function_body( &mut self, interner: &mut Interner, @@ -211,7 +200,6 @@ impl Parser { /// Will return `Err` on any parsing error, including invalid reads of the bytes being parsed. /// /// [spec]: https://tc39.es/ecma262/#prod-FormalParameterList - #[inline] pub fn parse_formal_parameters( &mut self, interner: &mut Interner, @@ -352,7 +340,6 @@ where } /// Helper to check if any parameter names are declared in the given list. -#[inline] fn name_in_lexically_declared_names( bound_names: &[Identifier], lexical_names: &[Identifier], @@ -376,7 +363,6 @@ trait OrAbrupt { } impl OrAbrupt for ParseResult> { - #[inline] fn or_abrupt(self) -> ParseResult { self?.ok_or(Error::AbruptEnd) } diff --git a/boa_parser/src/parser/statement/declaration/hoistable/async_generator_decl/mod.rs b/boa_parser/src/parser/statement/declaration/hoistable/async_generator_decl/mod.rs index 5a5fc49f0d..a62ed8d959 100644 --- a/boa_parser/src/parser/statement/declaration/hoistable/async_generator_decl/mod.rs +++ b/boa_parser/src/parser/statement/declaration/hoistable/async_generator_decl/mod.rs @@ -44,42 +44,34 @@ impl AsyncGeneratorDeclaration { } impl CallableDeclaration for AsyncGeneratorDeclaration { - #[inline] fn error_context(&self) -> &'static str { "async generator declaration" } - #[inline] fn is_default(&self) -> bool { self.is_default.0 } - #[inline] fn name_allow_yield(&self) -> bool { self.allow_yield.0 } - #[inline] fn name_allow_await(&self) -> bool { self.allow_await.0 } - #[inline] fn parameters_allow_yield(&self) -> bool { true } - #[inline] fn parameters_allow_await(&self) -> bool { true } - #[inline] fn body_allow_yield(&self) -> bool { true } - #[inline] fn body_allow_await(&self) -> bool { true } diff --git a/boa_parser/src/parser/statement/declaration/hoistable/mod.rs b/boa_parser/src/parser/statement/declaration/hoistable/mod.rs index 5a82e10571..96d15679a1 100644 --- a/boa_parser/src/parser/statement/declaration/hoistable/mod.rs +++ b/boa_parser/src/parser/statement/declaration/hoistable/mod.rs @@ -138,7 +138,6 @@ trait CallableDeclaration { } // This is a helper function to not duplicate code in the individual callable declaration parsers. -#[inline] fn parse_callable_declaration( c: &C, cursor: &mut Cursor, diff --git a/boa_parser/src/parser/statement/iteration/for_statement.rs b/boa_parser/src/parser/statement/iteration/for_statement.rs index 3a8e7758f2..e5adf74567 100644 --- a/boa_parser/src/parser/statement/iteration/for_statement.rs +++ b/boa_parser/src/parser/statement/iteration/for_statement.rs @@ -284,7 +284,6 @@ where } } -#[inline] fn initializer_to_iterable_loop_initializer( initializer: ForLoopInitializer, position: Position, diff --git a/boa_tester/src/exec/js262.rs b/boa_tester/src/exec/js262.rs index 89d5c4602e..0f0363a060 100644 --- a/boa_tester/src/exec/js262.rs +++ b/boa_tester/src/exec/js262.rs @@ -41,7 +41,6 @@ fn create_realm(_this: &JsValue, _: &[JsValue], _context: &mut Context) -> JsRes /// /// Implements the `DetachArrayBuffer` abstract operation. fn detach_array_buffer(_this: &JsValue, args: &[JsValue], _: &mut Context) -> JsResult { - #[inline] fn type_err() -> JsNativeError { JsNativeError::typ().with_message("The provided object was not an ArrayBuffer") } diff --git a/boa_tester/src/main.rs b/boa_tester/src/main.rs index af02e8b299..f62002f099 100644 --- a/boa_tester/src/main.rs +++ b/boa_tester/src/main.rs @@ -381,7 +381,6 @@ struct Test { impl Test { /// Creates a new test. - #[inline] fn new(name: N, content: C, metadata: MetaData) -> Self where N: Into>,