Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM Trace output fixes #1035 #1048

Merged
merged 5 commits into from
Feb 4, 2021
Merged

VM Trace output fixes #1035 #1048

merged 5 commits into from
Feb 4, 2021

Conversation

jasonwilliams
Copy link
Member

@jasonwilliams jasonwilliams commented Jan 7, 2021

For the JS

let a = 1;
let b = 2;

Output is:

VM start up time: 0μs
Time       Instr                Top Of Stack

27μs       DefLet(0)             <empty>
3μs        One                   <empty>
35μs       InitLexical(0)        1      0x7f727f41d0c0
18μs       DefLet(1)             1      0x7f727f41d0c0
4μs        Int32(2)              1      0x7f727f41d0c0
19μs       InitLexical(1)        2      0x7f727f41d0d8

Pool
0          "a" 0x7f727f41d120
1          "b" 0x7f727f41d138

Stack
0          1 0x7f727f41d0c0
1          2 0x7f727f41d0d8

2

Currently this is on by default.
Preferably we would pass --trace to the cli to get this output, similar to other JS Cli's.

This would mean needing to add a trace option to eval() here https://github.com/boa-dev/boa/blob/master/boa/src/context.rs#L751

@codecov
Copy link

codecov bot commented Jan 7, 2021

Codecov Report

Merging #1048 (3598cbe) into master (e0f226a) will decrease coverage by 0.13%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1048      +/-   ##
==========================================
- Coverage   58.69%   58.56%   -0.14%     
==========================================
  Files         176      176              
  Lines       12389    12516     +127     
==========================================
+ Hits         7272     7330      +58     
- Misses       5117     5186      +69     
Impacted Files Coverage Δ
boa/src/context.rs 61.08% <ø> (+0.47%) ⬆️
boa/src/vm/compilation.rs 0.00% <ø> (ø)
boa/src/vm/mod.rs 0.00% <0.00%> (ø)
boa_cli/src/main.rs 33.33% <ø> (ø)
boa/src/builtins/map/ordered_map.rs 57.57% <0.00%> (-6.07%) ⬇️
boa/src/realm.rs 87.50% <0.00%> (-5.36%) ⬇️
boa/src/builtins/mod.rs 21.21% <0.00%> (-2.32%) ⬇️
...arser/expression/primary/object_initializer/mod.rs 65.65% <0.00%> (-2.09%) ⬇️
boa/src/builtins/map/mod.rs 71.08% <0.00%> (-0.92%) ⬇️
boa/src/syntax/ast/node/call/mod.rs 83.33% <0.00%> (-0.76%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0f226a...3598cbe. Read the comment docs.

@Razican Razican added the vm Issues and PRs related to the Boa Virtual Machine. label Jan 8, 2021
@Razican Razican added this to the v0.11.0 milestone Jan 8, 2021
Copy link
Contributor

@RageKnify RageKnify left a comment

Choose a reason for hiding this comment

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

LGTM, just have 1 question.

boa/src/vm/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

I had some comments, but overall it looks good :)

boa/src/vm/mod.rs Outdated Show resolved Hide resolved
boa/src/vm/mod.rs Outdated Show resolved Hide resolved
Comment on lines +69 to +81
while self.idx < self.instructions.len() {
if self.is_trace {
self.trace_print(false);
};

while idx < self.instructions.len() {
let _timer =
BoaProfiler::global().start_event(&self.instructions[idx].to_string(), "vm");
match self.instructions[idx] {
BoaProfiler::global().start_event(&self.instructions[self.idx].to_string(), "vm");
match self.instructions[self.idx] {
Copy link
Member

Choose a reason for hiding this comment

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

Here I see we are iterating and using the index to retrieve the instruction. Couldn't we do this with iterators?

Copy link
Member Author

Choose a reason for hiding this comment

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

I’m going to merge and come back to this

@RageKnify RageKnify modified the milestones: v0.11.0, v0.12.0 Jan 14, 2021
@jasonwilliams jasonwilliams merged commit 8cdc886 into boa-dev:master Feb 4, 2021
Razican pushed a commit that referenced this pull request May 22, 2021
* no more need for dbg!()
* pass -t or --trace for tracing output
* documentation on output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants