Skip to content

Enable tracing for property sets in VM (__set__ calls)#5136

Open
Maanvi212006 wants to merge 2 commits intoboa-dev:mainfrom
Maanvi212006:trace-set-logging
Open

Enable tracing for property sets in VM (__set__ calls)#5136
Maanvi212006 wants to merge 2 commits intoboa-dev:mainfrom
Maanvi212006:trace-set-logging

Conversation

@Maanvi212006
Copy link

This Pull Request introduces logging for property sets in the JS engine.

It changes the following:

  • Adds [TRACE] SET logging in __set__ for JsObject properties.
  • Prints both key and value whenever a property is set, helping debug assignment behavior.
  • Minimal code changes: only touches core/engine/src/object/internal_methods/mod.rs.

Screenshot

The screenshot demonstrates the new [TRACE] SET logging added in the JS engine.
-A JavaScript object x is created: let x = {};.
-A property b is assigned the value 20: x.b = 20;.
-The [TRACE] SET log prints the property key ("b") and the value being assigned (20) twice, showing the internal call flow.

The final 20 shows that the assignment completes successfully and the value is returned as expected.

This clearly illustrates that the new logging correctly captures property set operations in the VM without affecting normal execution.

boa 2

@Maanvi212006 Maanvi212006 requested a review from a team as a code owner March 18, 2026 18:02
@github-actions github-actions bot added the Waiting On Review Waiting on reviews from the maintainers label Mar 18, 2026
@github-actions github-actions bot added this to the v1.0.0 milestone Mar 18, 2026
@github-actions github-actions bot added C-Dependencies Pull requests that update a dependency file C-Builtins PRs and Issues related to builtins/intrinsics labels Mar 18, 2026
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.

@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,073 50,073 0
Ignored 2,072 2,072 0
Failed 818 818 0
Panics 0 0 0
Conformance 94.54% 94.54% 0.00%

Tested main commit: 50f0103d9188d33862efbc38397a81e497973632
Tested PR commit: 299a51aa4d30ea3c4c429a961ba18612f050a960
Compare commits: 50f0103...299a51a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Builtins PRs and Issues related to builtins/intrinsics C-Dependencies Pull requests that update a dependency file Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants