diff --git a/docs/debugging.md b/docs/debugging.md index a0e53827888..c472456f0e0 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -37,15 +37,14 @@ cargo run -- --dump-ast # AST dump format is Debug by default. ## Bytecode generation and Execution -Once the AST has been generated boa will compile it into bytecode. -The bytecode is then executed by the vm. +Once the AST has been generated, boa will compile it into bytecode, which is then executed by the VM. You can print the bytecode and the executed instructions with the command-line flag `--trace`. -For more detailed information about the vm and the trace output look [here](./vm.md). +For more detailed information about the VM and the trace output look [here](./vm.md). ## Instruction flowgraph -We can to get the vm instructions flowgraph, which is a visual representation of the instruction flow. +We can also get the VM instructions flowgraph, which is a visual representation of the instruction flow. The `Start` (in green) and `End` (in red) node in the graph represents the start and end point of execution. They are not instructions, just markers. diff --git a/docs/img/boa_architecture.png b/docs/img/boa_architecture.png new file mode 100644 index 00000000000..1d076d374e8 Binary files /dev/null and b/docs/img/boa_architecture.png differ diff --git a/docs/vm.md b/docs/vm.md index 7027cb28c67..a5b1ed94925 100644 --- a/docs/vm.md +++ b/docs/vm.md @@ -2,7 +2,7 @@ ## Architecture -![image](img/boa_architecture.drawio.png) +![image](img/boa_architecture.png) ## Understanding the trace output @@ -71,7 +71,7 @@ The above output contains the following information: ### Comparing ByteCode output -If you wanted another engine's bytecode output for the same JS, SpiderMonkey's bytecode output is the best to use. You can follow the setup [here](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell). You will need to build from source because the pre-built binarys don't include the debugging utilities which we need. +If you wanted another engine's bytecode output for the same JS, SpiderMonkey's bytecode output is the best to use. You can follow the setup [here](https://udn.realityripple.com/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell). You will need to build from source because the pre-built binarys don't include the debugging utilities which we need. I named the binary `js_shell` as `js` conflicts with NodeJS. Once up and running you should be able to use `js_shell -f tests/js/test.js`. You will get no output to begin with, this is because you need to run `dis()` or `dis([func])` in the code. Once you've done that you should get some output like so: