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

[Merged by Bors] - Fix try/catch/finally related bugs and add tests #1901

Closed
wants to merge 1 commit into from

Conversation

jedel1043
Copy link
Member

This Pull Request fixes some bugs related to try blocks:

  • Fixes a panic when a finally block contained variable declarations. (Thanks to @VTCAKAVSMoACE for the report!)
  • Fixes a bug where try blocks in the last position of a statement list didn't return its inner last value as the result of the evaluation.
  • Add tests for both cases and two other common cases.
  • Extract and cleanup some code.

@github-actions
Copy link

github-actions bot commented Mar 6, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 88,342 88,342 0
Passed 43,291 43,291 0
Ignored 21,413 21,413 0
Failed 23,638 23,638 0
Panics 0 0 0
Conformance 49.00% 49.00% 0.00%

@jedel1043 jedel1043 requested review from raskad, HalidOdat and Razican and removed request for raskad and HalidOdat March 6, 2022 08:20
@codecov
Copy link

codecov bot commented Mar 6, 2022

Codecov Report

Merging #1901 (d46ca92) into main (3b53fec) will decrease coverage by 0.03%.
The diff coverage is 54.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1901      +/-   ##
==========================================
- Coverage   46.41%   46.37%   -0.04%     
==========================================
  Files         206      206              
  Lines       16790    16810      +20     
==========================================
+ Hits         7793     7796       +3     
- Misses       8997     9014      +17     
Impacted Files Coverage Δ
boa_engine/src/context/mod.rs 32.70% <50.00%> (-0.79%) ⬇️
boa_engine/src/bytecompiler.rs 38.38% <54.83%> (-0.47%) ⬇️
...ine/src/syntax/parser/cursor/buffered_lexer/mod.rs 64.86% <0.00%> (-2.71%) ⬇️
boa_engine/src/environments/compile.rs 39.82% <0.00%> (-2.66%) ⬇️
boa_engine/src/object/internal_methods/array.rs 76.36% <0.00%> (-1.42%) ⬇️
boa_engine/src/syntax/parser/cursor/mod.rs 44.26% <0.00%> (ø)
boa_engine/src/builtins/date/mod.rs 77.50% <0.00%> (+0.17%) ⬆️
boa_engine/src/builtins/number/mod.rs 75.65% <0.00%> (+0.28%) ⬆️
boa_engine/src/vm/code_block.rs 47.57% <0.00%> (+0.88%) ⬆️
... and 4 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 3b53fec...d46ca92. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Mar 6, 2022

Benchmark for cbb133d

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 632.1±8.82ns 590.4±8.27ns -6.60%
Arithmetic operations (Execution) 2.4±0.02µs 2.3±0.05µs -4.17%
Arithmetic operations (Parser) 5.7±0.05µs 5.4±0.18µs -5.26%
Array access (Compiler) 1492.0±16.76ns 1461.9±22.63ns -2.02%
Array access (Execution) 11.3±0.17µs 11.0±0.29µs -2.65%
Array access (Parser) 12.5±0.24µs 12.2±0.35µs -2.40%
Array creation (Compiler) 2.1±0.02µs 2.0±0.04µs -4.76%
Array creation (Execution) 3.7±0.10ms 3.7±0.14ms 0.00%
Array creation (Parser) 13.8±0.51µs 13.7±0.41µs -0.72%
Array pop (Compiler) 4.5±0.06µs 4.4±0.07µs -2.22%
Array pop (Execution) 1622.4±35.06µs 1629.7±33.49µs +0.45%
Array pop (Parser) 150.3±3.40µs 143.6±3.90µs -4.46%
Boolean Object Access (Compiler) 1202.3±8.76ns 1162.0±18.99ns -3.35%
Boolean Object Access (Execution) 7.0±0.18µs 6.7±0.16µs -4.29%
Boolean Object Access (Parser) 15.6±0.30µs 15.0±0.46µs -3.85%
Clean js (Compiler) 4.0±0.04µs 3.8±0.08µs -5.00%
Clean js (Execution) 1312.6±14.44µs 1250.4±27.37µs -4.74%
Clean js (Parser) 30.9±0.34µs 29.1±0.96µs -5.83%
Create Realm 323.6±9.98ns 307.5±8.54ns -4.98%
Dynamic Object Property Access (Compiler) 1907.2±27.17ns 1861.4±26.93ns -2.40%
Dynamic Object Property Access (Execution) 7.9±0.11µs 7.8±0.14µs -1.27%
Dynamic Object Property Access (Parser) 10.6±0.38µs 10.5±0.29µs -0.94%
Fibonacci (Compiler) 2.6±0.05µs 2.5±0.05µs -3.85%
Fibonacci (Execution) 2.1±0.03ms 2.0±0.05ms -4.76%
Fibonacci (Parser) 17.6±0.24µs 17.3±0.32µs -1.70%
For loop (Compiler) 2.3±0.04µs 2.2±0.05µs -4.35%
For loop (Execution) 52.2±0.60µs 47.3±1.88µs -9.39%
For loop (Parser) 14.9±0.28µs 15.0±0.19µs +0.67%
Mini js (Compiler) 3.7±0.08µs 3.7±0.14µs 0.00%
Mini js (Execution) 1211.5±15.79µs 1140.1±30.79µs -5.89%
Mini js (Parser) 26.7±0.40µs 25.5±0.77µs -4.49%
Number Object Access (Compiler) 1110.7±9.76ns 1092.6±14.51ns -1.63%
Number Object Access (Execution) 5.4±0.06µs 5.2±0.15µs -3.70%
Number Object Access (Parser) 12.0±0.17µs 11.6±0.39µs -3.33%
Object Creation (Compiler) 1632.8±20.85ns 1585.6±26.00ns -2.89%
Object Creation (Execution) 7.1±0.13µs 7.0±0.18µs -1.41%
Object Creation (Parser) 9.9±0.16µs 9.5±0.23µs -4.04%
RegExp (Compiler) 1918.1±19.90ns 1851.9±32.68ns -3.45%
RegExp (Execution) 14.1±0.33µs 13.4±0.42µs -4.96%
RegExp (Parser) 10.6±0.27µs 10.6±0.24µs 0.00%
RegExp Creation (Compiler) 1650.4±20.73ns 1589.5±39.43ns -3.69%
RegExp Creation (Execution) 10.9±0.16µs 10.3±0.28µs -5.50%
RegExp Creation (Parser) 8.6±0.24µs 8.8±0.22µs +2.33%
RegExp Literal (Compiler) 1918.4±26.90ns 1837.7±69.84ns -4.21%
RegExp Literal (Execution) 14.4±0.34µs 13.4±0.50µs -6.94%
RegExp Literal (Parser) 8.2±0.30µs 8.5±0.24µs +3.66%
RegExp Literal Creation (Compiler) 1681.5±22.10ns 1575.6±45.07ns -6.30%
RegExp Literal Creation (Execution) 10.9±0.21µs 10.0±0.33µs -8.26%
RegExp Literal Creation (Parser) 6.4±0.23µs 6.5±0.21µs +1.56%
Static Object Property Access (Compiler) 1637.6±23.12ns 1578.7±46.25ns -3.60%
Static Object Property Access (Execution) 7.4±0.16µs 7.4±0.12µs 0.00%
Static Object Property Access (Parser) 10.2±0.35µs 10.1±0.31µs -0.98%
String Object Access (Compiler) 1592.3±19.95ns 1585.6±16.76ns -0.42%
String Object Access (Execution) 8.8±0.06µs 8.8±0.15µs 0.00%
String Object Access (Parser) 15.3±0.34µs 14.8±0.47µs -3.27%
String comparison (Compiler) 2.5±0.03µs 2.4±0.04µs -4.00%
String comparison (Execution) 6.8±0.13µs 6.5±0.26µs -4.41%
String comparison (Parser) 11.8±0.28µs 11.9±0.07µs +0.85%
String concatenation (Compiler) 1972.2±12.42ns 1901.6±25.55ns -3.58%
String concatenation (Execution) 6.0±0.12µs 5.8±0.20µs -3.33%
String concatenation (Parser) 8.2±0.14µs 7.9±0.11µs -3.66%
String copy (Compiler) 1521.3±23.32ns 1489.3±21.63ns -2.10%
String copy (Execution) 5.5±0.09µs 5.4±0.08µs -1.82%
String copy (Parser) 5.9±0.18µs 5.8±0.13µs -1.69%
Symbols (Compiler) 1053.8±16.09ns 1029.9±24.92ns -2.27%
Symbols (Execution) 5.3±0.05µs 4.9±0.17µs -7.55%
Symbols (Parser) 4.4±0.08µs 4.5±0.06µs +2.27%

@jedel1043 jedel1043 added bug Something isn't working execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine. labels Mar 6, 2022
@jedel1043 jedel1043 requested review from HalidOdat and RageKnify March 6, 2022 20:02
@jedel1043 jedel1043 added this to the v0.14.0 milestone Mar 7, 2022
@jedel1043 jedel1043 linked an issue Mar 7, 2022 that may be closed by this pull request
@raskad
Copy link
Member

raskad commented Mar 7, 2022

bors r+

bors bot pushed a commit that referenced this pull request Mar 7, 2022
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This Pull Request fixes some bugs related to try blocks:

- Fixes a panic when a finally block contained variable declarations. (Thanks to @VTCAKAVSMoACE for the report!)
- Fixes a bug where try blocks in the last position of a statement list didn't return its inner last value as the result of the evaluation.
- Add tests for both cases and two other common cases.
- Extract and cleanup some code.
@bors
Copy link

bors bot commented Mar 7, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Fix try/catch/finally related bugs and add tests [Merged by Bors] - Fix try/catch/finally related bugs and add tests Mar 7, 2022
@bors bors bot closed this Mar 7, 2022
@bors bors bot deleted the finally-env branch March 7, 2022 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Continues in finally blocks cause a panic
3 participants