Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,4 @@ suspicious = { level = "warn", priority = -1 }
style = { level = "warn", priority = -1 }
complexity = { level = "warn", priority = -1 }
perf = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
4 changes: 1 addition & 3 deletions core/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rust-version.workspace = true

[features]
default = ["float16", "xsum", "temporal"]
trace = ["js"] # Enable Boa's VM instruction tracing

embedded_lz4 = ["boa_macros/embedded_lz4", "lz4_flex"]

Expand Down Expand Up @@ -64,9 +65,6 @@ fuzz = ["boa_ast/arbitrary", "boa_interner/arbitrary"]
# Enable Boa's VM instruction flowgraph generator.
flowgraph = []

# Enable Boa's VM instruction tracing.
trace = ["js"]

# Enable Boa's additional ECMAScript features for web browsers.
annex-b = ["boa_ast/annex-b", "boa_parser/annex-b"]

Expand Down
22 changes: 14 additions & 8 deletions core/engine/src/object/internal_methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,19 @@ impl JsObject {
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver
pub(crate) fn __set__(
&self,
key: PropertyKey,
value: JsValue,
receiver: JsValue,
context: &mut InternalMethodPropertyContext<'_>,
) -> JsResult<bool> {
(self.vtable().__set__)(self, key, value, receiver, context)
&self,
key: PropertyKey,
value: JsValue,
receiver: JsValue,
context: &mut InternalMethodPropertyContext<'_>,
) -> JsResult<bool> {
let result = (self.vtable().__set__)(self, key.clone(), value.clone(), receiver.clone(), context);
#[cfg(feature = "trace")]
if let Ok(true) = result {
println!("[TRACE] SET -> key: {:?}, value: {:?}", key, value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's honestly fine to use tracing here. We just need to adjust our features so that tracing is disabled if the trace feature is not set

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@Maanvi212006 Maanvi212006 Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jedel1043 ,

Thank you for your feedback. I’ve carefully reviewed your suggestions and made the following changes:

  1. Trace logging updated: Replaced manual println! traces with tracing::trace! macros for proper compile-time and runtime filtering.
  2. Cloning key/value for safe ownership: Fixed move/borrow issues by cloning key and value only when necessary to avoid multiple moves.
  3. ordinary_set cleanup: Removed duplicate calls and unnecessary code paths, ensuring proper handling of data descriptors and accessor descriptors.
  4. Feature-gated tracing: All debug output now respects the "trace" feature flag and does not affect normal execution.
  5. Unused variables and imports addressed: Prefixed _context and removed unused imports to clean warnings.

}

result
}
/// Internal method `[[Delete]]`
///
/// Delete the specified own property of this object.
Expand Down Expand Up @@ -709,6 +713,8 @@ pub(crate) fn ordinary_get(
receiver: JsValue,
context: &mut InternalMethodPropertyContext<'_>,
) -> JsResult<JsValue> {
#[cfg(feature = "trace-object")]
println!("[trace:object] GET property '{}'", key);
// 1. Assert: IsPropertyKey(P) is true.
// 2. Let desc be ? O.[[GetOwnProperty]](P).
match obj.__get_own_property__(key, context)? {
Expand Down
Loading