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] - Split Node into Statement, Expression and Declaration #2319

Closed
wants to merge 10 commits into from

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Oct 1, 2022

This Pull Request fixes #1371. And yeah, the number of file changes is real...

It changes the following:

  • Split the ast Node into Statement and Expression.
  • Rewrite the parser and bytecompiler to conform to this change.
  • Refactor some ast nodes into reusable structures.
  • Rewrite contains_arguments and contains to ease the transition into a future ast visitor.

List of things that were apparently fixed by this refactor?:

  • Implement read-assign operation for private accessors (e.g. this.#field ||= 5).
  • var await declaration now allowed outside async functions and inside functions nested in async functions.
  • Reject redeclarations of variables declared in the init list of a for loop.

Still missing some documentation adjustments, will try to do it ASAP.

@jedel1043 jedel1043 added parser Issues surrounding the parser vm Issues and PRs related to the Boa Virtual Machine. ast Issue surrounding the abstract syntax tree run-benchmark Label used to run banchmarks on PRs labels Oct 1, 2022
@jedel1043 jedel1043 added this to the v0.17.0 milestone Oct 1, 2022
@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 92,565 92,565 0
Passed 68,948 69,095 +147
Ignored 17,394 17,394 0
Failed 6,223 6,076 -147
Panics 0 0 0
Conformance 74.49% 74.64% +0.16%
Fixed tests (148):
test/language/statements/for/head-let-bound-names-in-stmt.js [strict mode] (previously Failed)
test/language/statements/for/head-let-bound-names-in-stmt.js (previously Failed)
test/language/statements/for/head-const-bound-names-in-stmt.js [strict mode] (previously Failed)
test/language/statements/for/head-const-bound-names-in-stmt.js (previously Failed)
test/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js [strict mode] (previously Failed)
test/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js [strict mode] (previously Failed)
test/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-and.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-and.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-and.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-and.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-or.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-or.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-nullish.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-nullish.js (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-method-and.js [strict mode] (previously Failed)
test/language/expressions/logical-assignment/left-hand-side-private-reference-method-and.js (previously Failed)
test/language/expressions/await/await-in-nested-function.js [strict mode] (previously Failed)
test/language/expressions/await/await-in-nested-function.js (previously Failed)
test/language/expressions/await/await-in-nested-generator.js [strict mode] (previously Failed)
test/language/expressions/await/await-in-nested-generator.js (previously Failed)
Broken tests (1):
test/annexB/language/statements/labeled/function-declaration.js (previously Passed)

@codecov
Copy link

codecov bot commented Oct 1, 2022

Codecov Report

Merging #2319 (bb101f7) into main (13dcdd4) will decrease coverage by 0.54%.
The diff coverage is 41.90%.

@@            Coverage Diff             @@
##             main    #2319      +/-   ##
==========================================
- Coverage   40.68%   40.14%   -0.55%     
==========================================
  Files         241      241              
  Lines       22811    22966     +155     
==========================================
- Hits         9281     9219      -62     
- Misses      13530    13747     +217     
Impacted Files Coverage Δ
boa_cli/src/main.rs 5.55% <ø> (ø)
boa_engine/src/builtins/eval/mod.rs 13.33% <0.00%> (+0.43%) ⬆️
boa_engine/src/builtins/function/arguments.rs 82.35% <ø> (ø)
boa_engine/src/builtins/function/mod.rs 23.73% <0.00%> (ø)
boa_engine/src/bytecompiler/mod.rs 29.23% <ø> (+0.04%) ⬆️
boa_engine/src/lib.rs 82.14% <ø> (ø)
boa_engine/src/syntax/ast/expression/identifier.rs 15.78% <0.00%> (ø)
..._engine/src/syntax/ast/function/async_generator.rs 5.88% <0.00%> (ø)
boa_engine/src/syntax/ast/function/generator.rs 5.88% <0.00%> (ø)
boa_engine/src/syntax/ast/keyword.rs 61.36% <0.00%> (ø)
... and 156 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Benchmark for e04c7d0

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 645.0±11.48ns 614.4±11.14ns -4.74%
Arithmetic operations (Execution) 746.3±6.70ns 774.9±10.77ns +3.83%
Arithmetic operations (Parser) 8.1±0.11µs 6.6±0.13µs -18.52%
Array access (Compiler) 1606.7±24.19ns 1698.1±29.12ns +5.69%
Array access (Execution) 8.4±0.08µs 8.3±0.16µs -1.19%
Array access (Parser) 14.8±0.12µs 14.7±0.05µs -0.68%
Array creation (Compiler) 2.5±0.05µs 2.5±0.04µs 0.00%
Array creation (Execution) 1414.6±5.53µs 1379.2±16.44µs -2.50%
Array creation (Parser) 17.6±0.28µs 17.5±0.27µs -0.57%
Array pop (Compiler) 4.9±0.07µs 4.8±0.07µs -2.04%
Array pop (Execution) 739.2±13.87µs 696.1±10.00µs -5.83%
Array pop (Parser) 166.4±1.92µs 159.5±2.25µs -4.15%
Boolean Object Access (Compiler) 1193.1±20.92ns 1148.4±21.26ns -3.75%
Boolean Object Access (Execution) 5.1±0.08µs 5.0±0.07µs -1.96%
Boolean Object Access (Parser) 17.5±0.23µs 17.7±0.35µs +1.14%
Clean js (Compiler) 5.3±0.08µs 5.2±0.09µs -1.89%
Clean js (Execution) 717.5±9.61µs 706.0±13.34µs -1.60%
Clean js (Parser) 35.3±0.46µs 35.5±0.60µs +0.57%
Create Realm 284.8±0.52ns 281.8±5.11ns -1.05%
Dynamic Object Property Access (Compiler) 1924.9±35.49ns 2.0±0.13µs +3.90%
Dynamic Object Property Access (Execution) 5.6±0.06µs 5.7±0.05µs +1.79%
Dynamic Object Property Access (Parser) 13.6±0.20µs 13.1±0.25µs -3.68%
Fibonacci (Compiler) 2.9±0.05µs 2.9±0.05µs 0.00%
Fibonacci (Execution) 1247.9±58.07µs 1177.2±15.54µs -5.67%
Fibonacci (Parser) 20.6±0.29µs 20.3±0.27µs -1.46%
For loop (Compiler) 2.8±0.04µs 2.8±0.06µs 0.00%
For loop (Execution) 19.4±0.27µs 19.1±0.32µs -1.55%
For loop (Parser) 17.8±0.28µs 17.9±0.36µs +0.56%
Mini js (Compiler) 4.6±0.08µs 4.5±0.07µs -2.17%
Mini js (Execution) 653.9±7.76µs 654.3±13.01µs +0.06%
Mini js (Parser) 30.7±0.41µs 30.6±0.42µs -0.33%
Number Object Access (Compiler) 1119.0±18.23ns 1109.7±23.30ns -0.83%
Number Object Access (Execution) 3.9±0.06µs 3.7±0.06µs -5.13%
Number Object Access (Parser) 13.7±0.17µs 13.6±0.19µs -0.73%
Object Creation (Compiler) 1702.1±23.79ns 1687.7±33.61ns -0.85%
Object Creation (Execution) 5.2±0.09µs 5.2±0.07µs 0.00%
Object Creation (Parser) 11.7±0.17µs 11.5±0.15µs -1.71%
RegExp (Compiler) 1900.8±33.33ns 1939.8±69.43ns +2.05%
RegExp (Execution) 12.8±0.23µs 12.8±0.21µs 0.00%
RegExp (Parser) 13.5±0.62µs 12.4±0.32µs -8.15%
RegExp Creation (Compiler) 1723.5±29.34ns 1715.4±23.27ns -0.47%
RegExp Creation (Execution) 9.5±0.17µs 9.9±0.04µs +4.21%
RegExp Creation (Parser) 10.7±0.15µs 10.6±0.20µs -0.93%
RegExp Literal (Compiler) 1931.1±22.25ns 1916.6±34.21ns -0.75%
RegExp Literal (Execution) 12.6±0.19µs 13.1±0.17µs +3.97%
RegExp Literal (Parser) 11.9±0.17µs 10.1±0.14µs -15.13%
RegExp Literal Creation (Compiler) 1751.9±17.92ns 1767.0±21.46ns +0.86%
RegExp Literal Creation (Execution) 9.4±0.18µs 9.7±0.20µs +3.19%
RegExp Literal Creation (Parser) 7.9±0.13µs 8.0±0.41µs +1.27%
Static Object Property Access (Compiler) 1715.2±29.09ns 1732.1±47.49ns +0.99%
Static Object Property Access (Execution) 5.3±0.10µs 5.5±0.07µs +3.77%
Static Object Property Access (Parser) 12.5±0.24µs 12.5±0.18µs 0.00%
String Object Access (Compiler) 1519.5±27.51ns 1581.2±170.39ns +4.06%
String Object Access (Execution) 7.1±0.10µs 7.1±0.09µs 0.00%
String Object Access (Parser) 17.0±0.28µs 17.1±0.34µs +0.59%
String comparison (Compiler) 2.5±0.04µs 2.5±0.05µs 0.00%
String comparison (Execution) 4.9±0.15µs 4.7±0.06µs -4.08%
String comparison (Parser) 13.8±0.15µs 14.0±0.08µs +1.45%
String concatenation (Compiler) 1918.3±39.31ns 1955.9±30.17ns +1.96%
String concatenation (Execution) 4.5±0.03µs 4.4±0.08µs -2.22%
String concatenation (Parser) 9.5±0.16µs 9.6±0.16µs +1.05%
String copy (Compiler) 1569.6±34.53ns 1564.8±26.65ns -0.31%
String copy (Execution) 4.1±0.05µs 4.2±0.06µs +2.44%
String copy (Parser) 7.1±0.09µs 6.9±0.15µs -2.82%
Symbols (Compiler) 1178.9±15.39ns 1251.4±93.99ns +6.15%
Symbols (Execution) 4.1±0.07µs 4.1±0.07µs 0.00%
Symbols (Parser) 5.4±0.09µs 5.3±0.08µs -1.85%

Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

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

Impressive work!
I saw some structs and methods missing docs, but I would definitley be fine merging this as-is to prevent needing to rebase it later.

boa_engine/src/syntax/ast/statement/mod.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Benchmark for 2e66299

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 503.9±1.32ns 476.9±0.91ns -5.36%
Arithmetic operations (Execution) 519.4±0.36ns 541.9±0.37ns +4.33%
Arithmetic operations (Parser) 6.8±0.08µs 6.6±0.04µs -2.94%
Array access (Compiler) 1466.2±3.74ns 1498.7±6.00ns +2.22%
Array access (Execution) 7.6±0.03µs 7.7±0.02µs +1.32%
Array access (Parser) 14.5±0.03µs 14.7±0.05µs +1.38%
Array creation (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
Array creation (Execution) 1185.4±16.50µs 1204.7±5.17µs +1.63%
Array creation (Parser) 17.0±0.04µs 17.2±0.05µs +1.18%
Array pop (Compiler) 4.1±0.02µs 4.1±0.01µs 0.00%
Array pop (Execution) 628.9±1.90µs 635.5±2.87µs +1.05%
Array pop (Parser) 159.4±0.18µs 153.0±0.19µs -4.02%
Boolean Object Access (Compiler) 1161.6±6.69ns 1132.4±1.88ns -2.51%
Boolean Object Access (Execution) 4.5±0.02µs 4.5±0.01µs 0.00%
Boolean Object Access (Parser) 16.8±0.06µs 17.0±0.10µs +1.19%
Clean js (Compiler) 5.0±0.01µs 4.9±0.01µs -2.00%
Clean js (Execution) 641.4±5.83µs 651.9±4.26µs +1.64%
Clean js (Parser) 35.3±0.09µs 35.1±0.12µs -0.57%
Create Realm 249.0±0.48ns 242.8±0.19ns -2.49%
Dynamic Object Property Access (Compiler) 1776.0±6.95ns 1914.3±15.31ns +7.79%
Dynamic Object Property Access (Execution) 4.9±0.02µs 5.0±0.03µs +2.04%
Dynamic Object Property Access (Parser) 13.4±0.03µs 13.3±0.04µs -0.75%
Fibonacci (Compiler) 2.8±0.01µs 2.8±0.01µs 0.00%
Fibonacci (Execution) 1108.9±2.55µs 1101.9±6.38µs -0.63%
Fibonacci (Parser) 20.4±0.08µs 20.0±0.06µs -1.96%
For loop (Compiler) 2.6±0.01µs 2.6±0.01µs 0.00%
For loop (Execution) 16.6±0.04µs 16.9±0.03µs +1.81%
For loop (Parser) 17.6±0.03µs 17.5±0.05µs -0.57%
Mini js (Compiler) 4.3±0.02µs 4.3±0.03µs 0.00%
Mini js (Execution) 581.3±5.51µs 601.3±5.02µs +3.44%
Mini js (Parser) 30.4±0.16µs 30.0±0.18µs -1.32%
Number Object Access (Compiler) 1089.0±2.03ns 1051.3±7.51ns -3.46%
Number Object Access (Execution) 3.5±0.01µs 3.4±0.01µs -2.86%
Number Object Access (Parser) 13.2±0.05µs 13.1±0.01µs -0.76%
Object Creation (Compiler) 1577.5±8.12ns 1698.9±20.20ns +7.70%
Object Creation (Execution) 4.7±0.01µs 4.7±0.01µs 0.00%
Object Creation (Parser) 11.8±0.08µs 11.7±0.05µs -0.85%
RegExp (Compiler) 1790.2±5.39ns 1872.3±22.02ns +4.59%
RegExp (Execution) 11.7±0.03µs 11.9±0.03µs +1.71%
RegExp (Parser) 12.7±0.05µs 12.7±0.07µs 0.00%
RegExp Creation (Compiler) 1558.2±6.98ns 1572.0±7.20ns +0.89%
RegExp Creation (Execution) 8.6±0.03µs 8.8±0.02µs +2.33%
RegExp Creation (Parser) 10.5±0.03µs 10.6±0.04µs +0.95%
RegExp Literal (Compiler) 1804.2±7.17ns 1883.3±22.75ns +4.38%
RegExp Literal (Execution) 11.8±0.30µs 11.9±0.03µs +0.85%
RegExp Literal (Parser) 10.2±0.03µs 10.2±0.04µs 0.00%
RegExp Literal Creation (Compiler) 1558.8±8.17ns 1586.3±9.54ns +1.76%
RegExp Literal Creation (Execution) 8.6±0.05µs 8.8±0.02µs +2.33%
RegExp Literal Creation (Parser) 8.0±0.04µs 8.2±0.54µs +2.50%
Static Object Property Access (Compiler) 1570.8±7.41ns 1714.4±17.73ns +9.14%
Static Object Property Access (Execution) 4.8±0.01µs 4.8±0.01µs 0.00%
Static Object Property Access (Parser) 12.6±0.06µs 12.6±0.05µs 0.00%
String Object Access (Compiler) 1466.5±5.30ns 1448.3±5.62ns -1.24%
String Object Access (Execution) 6.2±0.03µs 6.7±0.06µs +8.06%
String Object Access (Parser) 16.4±0.05µs 16.6±0.07µs +1.22%
String comparison (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
String comparison (Execution) 4.2±0.02µs 4.3±0.02µs +2.38%
String comparison (Parser) 13.5±0.03µs 13.6±0.07µs +0.74%
String concatenation (Compiler) 1751.6±3.98ns 1795.1±5.17ns +2.48%
String concatenation (Execution) 4.0±0.01µs 4.0±0.01µs 0.00%
String concatenation (Parser) 9.5±0.01µs 9.5±0.04µs 0.00%
String copy (Compiler) 1452.3±4.12ns 1448.1±4.18ns -0.29%
String copy (Execution) 3.7±0.01µs 3.8±0.01µs +2.70%
String copy (Parser) 7.2±0.02µs 7.3±0.03µs +1.39%
Symbols (Compiler) 1062.4±4.52ns 1057.7±2.65ns -0.44%
Symbols (Execution) 3.8±0.02µs 3.8±0.01µs 0.00%
Symbols (Parser) 5.7±0.05µs 5.6±0.04µs -1.75%

@Razican Razican added the hacktoberfest-accepted PR accepted for Hacktoberfest label Oct 2, 2022
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.

Impressive work! This is a great addition. I still didn't have the time to look over everything (150 files left :O) But it's looking very good.

I'd like to have your thoughts about boxing all expressions. It makes sense from a space perspective, but might be less efficient. It might make sense to box them at the Node level only.

boa_engine/src/syntax/ast/expression/await.rs Show resolved Hide resolved
boa_engine/src/syntax/ast/expression/call.rs Outdated Show resolved Hide resolved
boa_engine/src/syntax/ast/expression/literal/object/mod.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Oct 2, 2022

Benchmark for e8bd7d3

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 505.5±1.28ns 484.3±3.80ns -4.19%
Arithmetic operations (Execution) 524.8±0.34ns 536.9±0.99ns +2.31%
Arithmetic operations (Parser) 6.7±0.07µs 6.6±0.01µs -1.49%
Array access (Compiler) 1479.4±5.57ns 1487.7±3.71ns +0.56%
Array access (Execution) 7.5±0.03µs 7.6±0.02µs +1.33%
Array access (Parser) 14.4±0.07µs 14.2±0.05µs -1.39%
Array creation (Compiler) 2.3±0.02µs 2.3±0.00µs 0.00%
Array creation (Execution) 1182.9±2.31µs 1171.8±7.25µs -0.94%
Array creation (Parser) 16.8±0.06µs 16.8±0.05µs 0.00%
Array pop (Compiler) 4.1±0.02µs 4.0±0.01µs -2.44%
Array pop (Execution) 627.5±1.65µs 618.1±6.08µs -1.50%
Array pop (Parser) 160.0±1.18µs 149.2±0.18µs -6.75%
Boolean Object Access (Compiler) 1156.9±2.83ns 1129.8±1.61ns -2.34%
Boolean Object Access (Execution) 4.5±0.03µs 4.4±0.01µs -2.22%
Boolean Object Access (Parser) 16.8±0.06µs 16.3±0.09µs -2.98%
Clean js (Compiler) 5.0±0.01µs 5.0±0.02µs 0.00%
Clean js (Execution) 641.9±4.64µs 632.9±6.63µs -1.40%
Clean js (Parser) 34.8±0.08µs 34.4±0.08µs -1.15%
Create Realm 282.6±2.73ns 247.1±1.11ns -12.56%
Dynamic Object Property Access (Compiler) 1781.9±8.39ns 1858.4±26.90ns +4.29%
Dynamic Object Property Access (Execution) 4.9±0.01µs 5.1±0.02µs +4.08%
Dynamic Object Property Access (Parser) 13.2±0.04µs 13.0±0.04µs -1.52%
Fibonacci (Compiler) 2.8±0.01µs 2.8±0.01µs 0.00%
Fibonacci (Execution) 1086.9±3.57µs 1148.6±2.36µs +5.68%
Fibonacci (Parser) 20.0±0.06µs 19.5±0.05µs -2.50%
For loop (Compiler) 2.7±0.01µs 2.6±0.01µs -3.70%
For loop (Execution) 16.7±0.03µs 17.4±0.05µs +4.19%
For loop (Parser) 17.7±0.06µs 17.1±0.05µs -3.39%
Mini js (Compiler) 4.3±0.01µs 4.4±0.03µs +2.33%
Mini js (Execution) 586.5±6.17µs 575.0±4.97µs -1.96%
Mini js (Parser) 30.3±0.16µs 29.9±0.06µs -1.32%
Number Object Access (Compiler) 1080.0±2.25ns 1060.2±2.29ns -1.83%
Number Object Access (Execution) 3.5±0.01µs 3.4±0.01µs -2.86%
Number Object Access (Parser) 13.1±0.03µs 12.6±0.02µs -3.82%
Object Creation (Compiler) 1555.9±4.01ns 1684.0±9.56ns +8.23%
Object Creation (Execution) 4.6±0.01µs 4.8±0.03µs +4.35%
Object Creation (Parser) 11.7±0.05µs 11.5±0.13µs -1.71%
RegExp (Compiler) 1781.8±7.45ns 1865.4±17.75ns +4.69%
RegExp (Execution) 11.6±0.03µs 11.9±0.08µs +2.59%
RegExp (Parser) 12.7±0.03µs 12.5±0.05µs -1.57%
RegExp Creation (Compiler) 1570.8±4.93ns 1608.6±3.49ns +2.41%
RegExp Creation (Execution) 8.6±0.02µs 8.7±0.02µs +1.16%
RegExp Creation (Parser) 10.4±0.03µs 10.4±0.05µs 0.00%
RegExp Literal (Compiler) 1779.2±7.02ns 1862.2±30.25ns +4.67%
RegExp Literal (Execution) 11.6±0.03µs 11.9±0.02µs +2.59%
RegExp Literal (Parser) 10.2±0.05µs 10.0±0.04µs -1.96%
RegExp Literal Creation (Compiler) 1590.2±4.41ns 1599.5±3.58ns +0.58%
RegExp Literal Creation (Execution) 8.6±0.02µs 8.7±0.02µs +1.16%
RegExp Literal Creation (Parser) 8.0±0.06µs 8.0±0.03µs 0.00%
Static Object Property Access (Compiler) 1584.0±3.36ns 1725.7±10.38ns +8.95%
Static Object Property Access (Execution) 4.8±0.01µs 4.9±0.01µs +2.08%
Static Object Property Access (Parser) 12.6±0.05µs 12.3±0.04µs -2.38%
String Object Access (Compiler) 1484.1±9.57ns 1453.3±6.55ns -2.08%
String Object Access (Execution) 6.3±0.02µs 7.0±0.01µs +11.11%
String Object Access (Parser) 16.6±0.07µs 16.0±0.04µs -3.61%
String comparison (Compiler) 2.3±0.09µs 2.3±0.01µs 0.00%
String comparison (Execution) 4.3±0.02µs 4.3±0.03µs 0.00%
String comparison (Parser) 13.5±0.02µs 13.3±0.04µs -1.48%
String concatenation (Compiler) 1799.1±6.77ns 1781.9±8.70ns -0.96%
String concatenation (Execution) 4.0±0.01µs 4.0±0.02µs 0.00%
String concatenation (Parser) 9.4±0.03µs 9.3±0.02µs -1.06%
String copy (Compiler) 1460.8±5.75ns 1444.3±3.58ns -1.13%
String copy (Execution) 3.7±0.02µs 3.8±0.01µs +2.70%
String copy (Parser) 7.1±0.04µs 7.1±0.02µs 0.00%
Symbols (Compiler) 1080.2±2.48ns 1050.5±2.32ns -2.75%
Symbols (Execution) 3.8±0.01µs 3.8±0.02µs 0.00%
Symbols (Parser) 5.6±0.04µs 5.5±0.04µs -1.79%

@github-actions
Copy link

Benchmark for 76a0d2b

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 495.6±0.90ns 497.4±1.08ns +0.36%
Arithmetic operations (Execution) 521.4±0.49ns 526.1±0.75ns +0.90%
Arithmetic operations (Parser) 6.9±0.06µs 6.6±0.01µs -4.35%
Array access (Compiler) 1488.5±4.09ns 1504.3±4.88ns +1.06%
Array access (Execution) 7.6±0.02µs 7.7±0.02µs +1.32%
Array access (Parser) 14.4±0.03µs 14.2±0.06µs -1.39%
Array creation (Compiler) 2.5±0.03µs 2.3±0.01µs -8.00%
Array creation (Execution) 1183.8±4.15µs 1172.6±9.18µs -0.95%
Array creation (Parser) 16.7±0.06µs 16.7±0.05µs 0.00%
Array pop (Compiler) 4.1±0.01µs 4.0±0.01µs -2.44%
Array pop (Execution) 629.5±1.11µs 627.7±1.90µs -0.29%
Array pop (Parser) 159.8±0.18µs 148.5±0.10µs -7.07%
Boolean Object Access (Compiler) 1167.1±4.44ns 1133.0±2.17ns -2.92%
Boolean Object Access (Execution) 4.7±0.03µs 4.4±0.01µs -6.38%
Boolean Object Access (Parser) 16.8±0.08µs 16.2±0.08µs -3.57%
Clean js (Compiler) 5.0±0.02µs 4.9±0.02µs -2.00%
Clean js (Execution) 651.6±4.47µs 656.8±3.67µs +0.80%
Clean js (Parser) 34.9±0.08µs 34.5±0.06µs -1.15%
Create Realm 262.7±0.21ns 247.4±0.41ns -5.82%
Dynamic Object Property Access (Compiler) 1845.3±37.96ns 1887.4±24.99ns +2.28%
Dynamic Object Property Access (Execution) 4.9±0.01µs 5.1±0.03µs +4.08%
Dynamic Object Property Access (Parser) 13.3±0.05µs 13.0±0.06µs -2.26%
Fibonacci (Compiler) 2.8±0.01µs 2.8±0.01µs 0.00%
Fibonacci (Execution) 1125.5±2.03µs 1124.8±5.68µs -0.06%
Fibonacci (Parser) 20.1±0.07µs 19.6±0.07µs -2.49%
For loop (Compiler) 2.7±0.03µs 2.6±0.01µs -3.70%
For loop (Execution) 16.6±0.03µs 17.7±0.04µs +6.63%
For loop (Parser) 17.4±0.04µs 17.3±0.04µs -0.57%
Mini js (Compiler) 4.4±0.02µs 4.3±0.02µs -2.27%
Mini js (Execution) 586.3±4.13µs 592.2±4.86µs +1.01%
Mini js (Parser) 30.4±0.10µs 29.9±0.09µs -1.64%
Number Object Access (Compiler) 1096.2±24.89ns 1056.6±2.67ns -3.61%
Number Object Access (Execution) 3.5±0.01µs 3.4±0.01µs -2.86%
Number Object Access (Parser) 13.1±0.03µs 12.6±0.08µs -3.82%
Object Creation (Compiler) 1584.5±4.44ns 1704.0±18.94ns +7.54%
Object Creation (Execution) 4.6±0.01µs 4.8±0.02µs +4.35%
Object Creation (Parser) 11.6±0.08µs 11.5±0.07µs -0.86%
RegExp (Compiler) 1806.9±7.47ns 1903.7±8.27ns +5.36%
RegExp (Execution) 11.7±0.02µs 11.9±0.05µs +1.71%
RegExp (Parser) 12.6±0.03µs 12.4±0.06µs -1.59%
RegExp Creation (Compiler) 1602.0±4.92ns 1626.6±3.01ns +1.54%
RegExp Creation (Execution) 8.6±0.03µs 8.7±0.02µs +1.16%
RegExp Creation (Parser) 10.4±0.03µs 10.4±0.05µs 0.00%
RegExp Literal (Compiler) 1800.9±18.86ns 1894.9±15.51ns +5.22%
RegExp Literal (Execution) 11.7±0.03µs 11.8±0.03µs +0.85%
RegExp Literal (Parser) 10.1±0.03µs 10.0±0.08µs -0.99%
RegExp Literal Creation (Compiler) 1601.3±8.79ns 1631.3±3.35ns +1.87%
RegExp Literal Creation (Execution) 8.6±0.05µs 8.7±0.02µs +1.16%
RegExp Literal Creation (Parser) 8.0±0.03µs 7.9±0.03µs -1.25%
Static Object Property Access (Compiler) 1606.4±4.41ns 1734.2±12.95ns +7.96%
Static Object Property Access (Execution) 4.8±0.01µs 5.0±0.03µs +4.17%
Static Object Property Access (Parser) 12.5±0.04µs 12.2±0.06µs -2.40%
String Object Access (Compiler) 1496.9±17.56ns 1450.7±3.49ns -3.09%
String Object Access (Execution) 6.3±0.03µs 6.9±0.02µs +9.52%
String Object Access (Parser) 16.6±0.10µs 16.1±0.05µs -3.01%
String comparison (Compiler) 2.4±0.02µs 2.4±0.01µs 0.00%
String comparison (Execution) 4.2±0.02µs 4.3±0.02µs +2.38%
String comparison (Parser) 13.5±0.03µs 13.4±0.15µs -0.74%
String concatenation (Compiler) 1798.1±17.75ns 1792.0±8.32ns -0.34%
String concatenation (Execution) 4.0±0.01µs 4.0±0.01µs 0.00%
String concatenation (Parser) 9.3±0.02µs 9.3±0.06µs 0.00%
String copy (Compiler) 1450.1±3.30ns 1441.0±10.09ns -0.63%
String copy (Execution) 3.8±0.01µs 3.7±0.01µs -2.63%
String copy (Parser) 7.1±0.03µs 7.2±0.02µs +1.41%
Symbols (Compiler) 1072.7±2.54ns 1066.0±3.13ns -0.62%
Symbols (Execution) 3.8±0.02µs 3.8±0.02µs 0.00%
Symbols (Parser) 5.6±0.03µs 5.5±0.05µs -1.79%

@github-actions
Copy link

Benchmark for d63a871

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 513.9±1.42ns 496.6±7.40ns -3.37%
Arithmetic operations (Execution) 684.8±0.52ns 689.1±0.51ns +0.63%
Arithmetic operations (Parser) 6.6±0.01µs 6.1±0.01µs -7.58%
Array access (Compiler) 1393.6±3.46ns 1424.5±4.61ns +2.22%
Array access (Execution) 9.2±0.03µs 9.3±0.05µs +1.09%
Array access (Parser) 13.9±0.02µs 13.2±0.02µs -5.04%
Array creation (Compiler) 2.2±0.00µs 2.2±0.01µs 0.00%
Array creation (Execution) 1316.8±3.20µs 1318.0±55.75µs +0.09%
Array creation (Parser) 16.2±0.04µs 15.7±0.08µs -3.09%
Array pop (Compiler) 4.1±0.01µs 4.1±0.01µs 0.00%
Array pop (Execution) 757.6±1.97µs 772.1±3.24µs +1.91%
Array pop (Parser) 150.8±0.25µs 142.1±0.13µs -5.77%
Boolean Object Access (Compiler) 1114.9±1.99ns 1108.5±2.33ns -0.57%
Boolean Object Access (Execution) 5.3±0.01µs 5.4±0.02µs +1.89%
Boolean Object Access (Parser) 16.2±0.02µs 15.8±0.02µs -2.47%
Clean js (Compiler) 4.7±0.01µs 4.6±0.02µs -2.13%
Clean js (Execution) 746.8±4.68µs 760.0±3.35µs +1.77%
Clean js (Parser) 33.1±0.06µs 32.4±0.06µs -2.11%
Create Realm 238.6±0.24ns 242.2±6.42ns +1.51%
Dynamic Object Property Access (Compiler) 1714.8±13.61ns 1672.7±9.64ns -2.46%
Dynamic Object Property Access (Execution) 5.3±0.02µs 5.4±0.02µs +1.89%
Dynamic Object Property Access (Parser) 12.6±0.04µs 11.9±0.05µs -5.56%
Fibonacci (Compiler) 2.6±0.00µs 2.6±0.01µs 0.00%
Fibonacci (Execution) 1117.5±2.05µs 1133.0±2.20µs +1.39%
Fibonacci (Parser) 19.0±0.04µs 18.4±0.19µs -3.16%
For loop (Compiler) 2.4±0.00µs 2.5±0.01µs +4.17%
For loop (Execution) 17.2±0.03µs 17.3±0.04µs +0.58%
For loop (Parser) 16.5±0.03µs 16.0±0.02µs -3.03%
Mini js (Compiler) 4.1±0.02µs 4.0±0.02µs -2.44%
Mini js (Execution) 688.6±3.95µs 711.3±4.13µs +3.30%
Mini js (Parser) 28.5±0.02µs 28.0±0.06µs -1.75%
Number Object Access (Compiler) 1049.5±3.48ns 1052.6±3.41ns +0.30%
Number Object Access (Execution) 4.1±0.02µs 4.2±0.04µs +2.44%
Number Object Access (Parser) 12.7±0.02µs 12.2±0.01µs -3.94%
Object Creation (Compiler) 1456.4±4.12ns 1465.7±6.79ns +0.64%
Object Creation (Execution) 5.0±0.06µs 5.0±0.02µs 0.00%
Object Creation (Parser) 10.9±0.03µs 10.4±0.03µs -4.59%
RegExp (Compiler) 1639.4±1.60ns 1683.7±5.36ns +2.70%
RegExp (Execution) 14.7±0.07µs 14.2±0.07µs -3.40%
RegExp (Parser) 11.8±0.02µs 11.4±0.02µs -3.39%
RegExp Creation (Compiler) 1474.0±4.78ns 1515.6±4.63ns +2.82%
RegExp Creation (Execution) 9.9±0.04µs 9.5±0.03µs -4.04%
RegExp Creation (Parser) 10.0±0.08µs 9.5±0.06µs -5.00%
RegExp Literal (Compiler) 1634.7±3.10ns 1680.3±3.74ns +2.79%
RegExp Literal (Execution) 14.6±0.07µs 14.2±0.06µs -2.74%
RegExp Literal (Parser) 9.6±0.02µs 9.2±0.03µs -4.17%
RegExp Literal Creation (Compiler) 1478.3±5.24ns 1516.2±4.26ns +2.56%
RegExp Literal Creation (Execution) 9.9±0.06µs 9.5±0.04µs -4.04%
RegExp Literal Creation (Parser) 7.6±0.02µs 7.1±0.02µs -6.58%
Static Object Property Access (Compiler) 1487.0±4.73ns 1480.7±18.27ns -0.42%
Static Object Property Access (Execution) 5.2±0.02µs 5.2±0.02µs 0.00%
Static Object Property Access (Parser) 11.8±0.04µs 11.1±0.01µs -5.93%
String Object Access (Compiler) 1438.0±10.52ns 1428.0±4.48ns -0.70%
String Object Access (Execution) 7.5±0.05µs 7.7±0.04µs +2.67%
String Object Access (Parser) 15.8±0.02µs 15.3±0.02µs -3.16%
String comparison (Compiler) 2.2±0.01µs 2.2±0.01µs 0.00%
String comparison (Execution) 4.4±0.01µs 4.5±0.02µs +2.27%
String comparison (Parser) 12.8±0.01µs 12.4±0.02µs -3.13%
String concatenation (Compiler) 1665.6±9.00ns 1714.5±7.79ns +2.94%
String concatenation (Execution) 4.2±0.03µs 4.2±0.02µs 0.00%
String concatenation (Parser) 9.0±0.03µs 8.6±0.01µs -4.44%
String copy (Compiler) 1370.0±11.56ns 1406.0±7.41ns +2.63%
String copy (Execution) 3.9±0.02µs 3.9±0.01µs 0.00%
String copy (Parser) 6.8±0.01µs 6.4±0.01µs -5.88%
Symbols (Compiler) 993.4±3.93ns 988.4±5.27ns -0.50%
Symbols (Execution) 4.0±0.01µs 4.0±0.04µs 0.00%
Symbols (Parser) 5.3±0.01µs 5.0±0.02µs -5.66%

@jedel1043 jedel1043 changed the title Split Node into Statement and Expression Split Node into Statement, Expression and Declaration Oct 14, 2022
@jedel1043
Copy link
Member Author

jedel1043 commented Oct 14, 2022

Had to split Statement into Statement and Declaration since LabelledStatement doesn't accept Declaration as a labellable node. This will temporarily break a test (test/annexB/language/statements/labeled/function-declaration.js), but I already have another PR implementing LabelledStatement that fixes this.

@github-actions
Copy link

Benchmark for ab9193a

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 577.2±16.76ns 542.1±16.27ns -6.08%
Arithmetic operations (Execution) 790.0±16.31ns 814.3±23.13ns +3.08%
Arithmetic operations (Parser) 7.0±0.16µs 6.4±0.17µs -8.57%
Array access (Compiler) 1578.4±63.01ns 1549.7±48.50ns -1.82%
Array access (Execution) 10.2±0.24µs 10.5±0.23µs +2.94%
Array access (Parser) 14.8±0.33µs 13.9±0.42µs -6.08%
Array creation (Compiler) 2.4±0.06µs 2.4±0.08µs 0.00%
Array creation (Execution) 1516.9±44.71µs 1495.9±38.54µs -1.38%
Array creation (Parser) 17.4±0.32µs 16.7±0.38µs -4.02%
Array pop (Compiler) 4.5±0.11µs 4.5±0.13µs 0.00%
Array pop (Execution) 873.3±12.71µs 868.1±21.11µs -0.60%
Array pop (Parser) 165.8±3.28µs 150.6±3.78µs -9.17%
Boolean Object Access (Compiler) 1120.8±28.31ns 1118.7±25.21ns -0.19%
Boolean Object Access (Execution) 6.3±0.12µs 6.1±0.15µs -3.17%
Boolean Object Access (Parser) 17.5±0.41µs 16.6±0.44µs -5.14%
Clean js (Compiler) 5.1±0.13µs 5.1±0.15µs 0.00%
Clean js (Execution) 855.4±20.70µs 844.2±26.18µs -1.31%
Clean js (Parser) 36.0±0.71µs 34.3±0.68µs -4.72%
Create Realm 280.4±5.08ns 292.0±7.63ns +4.14%
Dynamic Object Property Access (Compiler) 1860.1±42.45ns 1832.6±45.87ns -1.48%
Dynamic Object Property Access (Execution) 6.0±0.13µs 5.9±0.18µs -1.67%
Dynamic Object Property Access (Parser) 13.3±0.24µs 12.2±0.31µs -8.27%
Fibonacci (Compiler) 2.8±0.08µs 2.9±0.06µs +3.57%
Fibonacci (Execution) 1238.5±30.64µs 1311.2±42.23µs +5.87%
Fibonacci (Parser) 20.4±0.50µs 19.4±0.50µs -4.90%
For loop (Compiler) 2.7±0.07µs 2.7±0.05µs 0.00%
For loop (Execution) 19.2±0.46µs 19.3±0.51µs +0.52%
For loop (Parser) 17.8±0.35µs 17.1±0.50µs -3.93%
Mini js (Compiler) 4.5±0.12µs 4.3±0.13µs -4.44%
Mini js (Execution) 801.1±12.38µs 783.8±16.51µs -2.16%
Mini js (Parser) 29.6±0.79µs 29.7±0.58µs +0.34%
Number Object Access (Compiler) 1088.5±29.61ns 1062.1±28.64ns -2.43%
Number Object Access (Execution) 4.8±0.10µs 4.6±0.16µs -4.17%
Number Object Access (Parser) 13.7±0.35µs 13.0±0.43µs -5.11%
Object Creation (Compiler) 1602.9±50.78ns 1639.9±36.29ns +2.31%
Object Creation (Execution) 5.6±0.14µs 5.5±0.14µs -1.79%
Object Creation (Parser) 11.6±0.26µs 10.8±0.24µs -6.90%
RegExp (Compiler) 1877.0±43.35ns 1861.0±48.08ns -0.85%
RegExp (Execution) 16.6±0.37µs 16.3±0.45µs -1.81%
RegExp (Parser) 12.6±0.26µs 11.9±0.30µs -5.56%
RegExp Creation (Compiler) 1652.1±34.43ns 1666.3±43.73ns +0.86%
RegExp Creation (Execution) 11.1±0.27µs 10.9±0.28µs -1.80%
RegExp Creation (Parser) 10.5±0.31µs 9.8±0.27µs -6.67%
RegExp Literal (Compiler) 1855.5±48.74ns 1839.7±56.09ns -0.85%
RegExp Literal (Execution) 16.4±0.36µs 16.1±0.37µs -1.83%
RegExp Literal (Parser) 10.1±0.31µs 9.5±0.24µs -5.94%
RegExp Literal Creation (Compiler) 1645.9±44.74ns 1660.6±56.04ns +0.89%
RegExp Literal Creation (Execution) 11.3±0.37µs 10.9±0.27µs -3.54%
RegExp Literal Creation (Parser) 8.1±0.16µs 7.5±0.28µs -7.41%
Static Object Property Access (Compiler) 1696.9±40.58ns 1655.6±37.17ns -2.43%
Static Object Property Access (Execution) 5.8±0.12µs 5.8±0.16µs 0.00%
Static Object Property Access (Parser) 12.4±0.28µs 11.7±0.38µs -5.65%
String Object Access (Compiler) 1502.7±46.30ns 1474.6±43.81ns -1.87%
String Object Access (Execution) 8.7±0.22µs 8.5±0.23µs -2.30%
String Object Access (Parser) 17.0±0.55µs 16.4±0.68µs -3.53%
String comparison (Compiler) 2.4±0.07µs 2.5±0.07µs +4.17%
String comparison (Execution) 5.1±0.09µs 4.9±0.13µs -3.92%
String comparison (Parser) 13.8±0.38µs 13.5±0.33µs -2.17%
String concatenation (Compiler) 1857.2±61.14ns 1910.0±56.55ns +2.84%
String concatenation (Execution) 4.9±0.08µs 4.8±0.16µs -2.04%
String concatenation (Parser) 9.5±0.17µs 9.1±0.25µs -4.21%
String copy (Compiler) 1509.4±39.46ns 1545.5±39.27ns +2.39%
String copy (Execution) 4.5±0.07µs 4.4±0.13µs -2.22%
String copy (Parser) 7.0±0.21µs 6.6±0.18µs -5.71%
Symbols (Compiler) 1114.2±34.10ns 1172.8±26.05ns +5.26%
Symbols (Execution) 4.6±0.13µs 4.5±0.11µs -2.17%
Symbols (Parser) 5.6±0.11µs 5.2±0.11µs -7.14%

@github-actions
Copy link

Benchmark for 8d25bf6

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 701.6±34.44ns 672.5±38.03ns -4.15%
Arithmetic operations (Execution) 791.7±56.10ns 800.7±52.85ns +1.14%
Arithmetic operations (Parser) 8.2±0.86µs 7.5±0.40µs -8.54%
Array access (Compiler) 2.0±0.17µs 1984.9±112.99ns -0.75%
Array access (Execution) 11.6±0.42µs 12.0±0.72µs +3.45%
Array access (Parser) 17.2±0.84µs 16.4±1.67µs -4.65%
Array creation (Compiler) 3.0±0.09µs 3.0±0.18µs 0.00%
Array creation (Execution) 1523.1±75.59µs 1520.4±82.49µs -0.18%
Array creation (Parser) 20.9±0.89µs 19.8±1.26µs -5.26%
Array pop (Compiler) 5.1±0.23µs 5.2±0.29µs +1.96%
Array pop (Execution) 923.3±38.35µs 910.0±38.50µs -1.44%
Array pop (Parser) 201.1±12.16µs 177.5±7.09µs -11.74%
Boolean Object Access (Compiler) 1396.1±74.46ns 1489.4±54.91ns +6.68%
Boolean Object Access (Execution) 7.0±0.30µs 7.0±0.34µs 0.00%
Boolean Object Access (Parser) 20.0±1.13µs 18.8±0.89µs -6.00%
Clean js (Compiler) 6.2±0.29µs 6.2±0.36µs 0.00%
Clean js (Execution) 952.2±39.51µs 927.0±42.27µs -2.65%
Clean js (Parser) 41.7±2.62µs 39.8±2.28µs -4.56%
Create Realm 299.0±36.56ns 313.4±21.29ns +4.82%
Dynamic Object Property Access (Compiler) 2.3±0.09µs 2.3±0.09µs 0.00%
Dynamic Object Property Access (Execution) 7.1±0.44µs 7.0±0.34µs -1.41%
Dynamic Object Property Access (Parser) 15.6±0.79µs 15.3±0.76µs -1.92%
Fibonacci (Compiler) 3.6±0.19µs 3.7±0.22µs +2.78%
Fibonacci (Execution) 1521.2±82.98µs 1515.4±65.99µs -0.38%
Fibonacci (Parser) 23.6±1.40µs 23.3±1.23µs -1.27%
For loop (Compiler) 3.4±0.14µs 3.4±0.14µs 0.00%
For loop (Execution) 23.0±1.11µs 24.0±1.18µs +4.35%
For loop (Parser) 20.8±1.24µs 19.8±1.07µs -4.81%
Mini js (Compiler) 5.5±0.26µs 5.4±0.38µs -1.82%
Mini js (Execution) 861.3±37.28µs 852.7±50.76µs -1.00%
Mini js (Parser) 35.4±2.00µs 33.7±2.00µs -4.80%
Number Object Access (Compiler) 1385.1±80.69ns 1424.3±78.25ns +2.83%
Number Object Access (Execution) 5.4±0.26µs 5.4±0.27µs 0.00%
Number Object Access (Parser) 15.9±1.25µs 15.2±1.08µs -4.40%
Object Creation (Compiler) 2.0±0.08µs 2.1±0.18µs +5.00%
Object Creation (Execution) 7.0±0.32µs 6.6±0.37µs -5.71%
Object Creation (Parser) 13.7±0.71µs 12.9±0.78µs -5.84%
RegExp (Compiler) 2.3±0.12µs 2.4±0.13µs +4.35%
RegExp (Execution) 18.3±1.14µs 18.4±0.75µs +0.55%
RegExp (Parser) 15.2±2.39µs 14.2±0.64µs -6.58%
RegExp Creation (Compiler) 2.1±0.12µs 2.1±0.12µs 0.00%
RegExp Creation (Execution) 12.0±0.60µs 12.3±0.52µs +2.50%
RegExp Creation (Parser) 12.3±0.69µs 11.7±0.69µs -4.88%
RegExp Literal (Compiler) 2.3±0.11µs 2.4±0.11µs +4.35%
RegExp Literal (Execution) 18.2±0.82µs 18.8±1.12µs +3.30%
RegExp Literal (Parser) 11.5±0.52µs 12.1±1.78µs +5.22%
RegExp Literal Creation (Compiler) 2.1±0.13µs 2.1±0.14µs 0.00%
RegExp Literal Creation (Execution) 12.4±0.66µs 12.3±0.39µs -0.81%
RegExp Literal Creation (Parser) 9.4±0.54µs 9.2±0.70µs -2.13%
Static Object Property Access (Compiler) 2.1±0.09µs 2.1±0.10µs 0.00%
Static Object Property Access (Execution) 6.9±0.26µs 7.1±0.51µs +2.90%
Static Object Property Access (Parser) 14.3±0.74µs 14.0±0.57µs -2.10%
String Object Access (Compiler) 1783.6±78.56ns 2000.0±276.53ns +12.13%
String Object Access (Execution) 9.8±0.50µs 10.2±0.48µs +4.08%
String Object Access (Parser) 19.3±1.20µs 18.7±0.87µs -3.11%
String comparison (Compiler) 2.9±0.11µs 3.0±0.15µs +3.45%
String comparison (Execution) 5.9±0.28µs 5.9±0.39µs 0.00%
String comparison (Parser) 15.8±0.83µs 15.5±0.99µs -1.90%
String concatenation (Compiler) 2.4±0.15µs 2.5±0.64µs +4.17%
String concatenation (Execution) 5.7±0.36µs 5.6±0.32µs -1.75%
String concatenation (Parser) 10.8±0.49µs 10.6±0.58µs -1.85%
String copy (Compiler) 1935.4±95.72ns 2.0±0.11µs +3.34%
String copy (Execution) 5.2±0.28µs 5.2±0.23µs 0.00%
String copy (Parser) 8.3±0.52µs 8.1±0.39µs -2.41%
Symbols (Compiler) 1489.5±68.57ns 1530.5±70.84ns +2.75%
Symbols (Execution) 5.3±0.26µs 5.2±0.35µs -1.89%
Symbols (Parser) 6.6±0.61µs 6.5±0.77µs -1.52%

@github-actions
Copy link

Benchmark for 4c72bda

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 509.3±1.52ns 490.4±5.78ns -3.71%
Arithmetic operations (Execution) 676.9±0.68ns 712.8±0.56ns +5.30%
Arithmetic operations (Parser) 6.5±0.02µs 6.2±0.02µs -4.62%
Array access (Compiler) 1390.0±4.66ns 1379.1±2.39ns -0.78%
Array access (Execution) 9.2±0.03µs 9.2±0.03µs 0.00%
Array access (Parser) 13.7±0.02µs 13.4±0.01µs -2.19%
Array creation (Compiler) 2.2±0.01µs 2.1±0.00µs -4.55%
Array creation (Execution) 1314.3±5.32µs 1306.9±3.70µs -0.56%
Array creation (Parser) 16.1±0.03µs 15.9±0.03µs -1.24%
Array pop (Compiler) 4.0±0.01µs 4.0±0.01µs 0.00%
Array pop (Execution) 754.8±2.00µs 765.5±1.04µs +1.42%
Array pop (Parser) 150.3±0.22µs 141.2±0.42µs -6.05%
Boolean Object Access (Compiler) 1104.0±1.84ns 1115.1±1.91ns +1.01%
Boolean Object Access (Execution) 5.3±0.01µs 5.3±0.07µs 0.00%
Boolean Object Access (Parser) 16.3±0.03µs 15.9±0.03µs -2.45%
Clean js (Compiler) 4.6±0.01µs 4.5±0.01µs -2.17%
Clean js (Execution) 752.8±3.06µs 751.0±3.39µs -0.24%
Clean js (Parser) 32.8±0.05µs 32.5±0.03µs -0.91%
Create Realm 251.8±0.21ns 248.4±0.11ns -1.35%
Dynamic Object Property Access (Compiler) 1700.4±9.65ns 1664.1±3.20ns -2.13%
Dynamic Object Property Access (Execution) 5.4±0.02µs 5.3±0.02µs -1.85%
Dynamic Object Property Access (Parser) 12.5±0.01µs 12.1±0.02µs -3.20%
Fibonacci (Compiler) 2.6±0.01µs 2.6±0.00µs 0.00%
Fibonacci (Execution) 1122.5±2.51µs 1118.0±3.68µs -0.40%
Fibonacci (Parser) 18.9±0.03µs 18.6±0.04µs -1.59%
For loop (Compiler) 2.4±0.01µs 2.4±0.01µs 0.00%
For loop (Execution) 17.3±0.03µs 17.1±0.02µs -1.16%
For loop (Parser) 16.3±0.02µs 16.2±0.02µs -0.61%
Mini js (Compiler) 4.1±0.02µs 3.9±0.01µs -4.88%
Mini js (Execution) 695.4±3.64µs 695.2±4.66µs -0.03%
Mini js (Parser) 28.4±0.03µs 28.2±0.04µs -0.70%
Number Object Access (Compiler) 1039.9±2.75ns 1035.4±2.36ns -0.43%
Number Object Access (Execution) 4.1±0.01µs 4.1±0.01µs 0.00%
Number Object Access (Parser) 12.7±0.02µs 12.4±0.02µs -2.36%
Object Creation (Compiler) 1455.3±6.40ns 1453.2±4.97ns -0.14%
Object Creation (Execution) 5.0±0.02µs 5.0±0.02µs 0.00%
Object Creation (Parser) 10.9±0.14µs 10.6±0.01µs -2.75%
RegExp (Compiler) 1629.7±9.89ns 1663.3±3.68ns +2.06%
RegExp (Execution) 14.7±0.07µs 14.2±0.07µs -3.40%
RegExp (Parser) 11.8±0.01µs 11.6±0.02µs -1.69%
RegExp Creation (Compiler) 1485.8±7.10ns 1480.0±4.45ns -0.39%
RegExp Creation (Execution) 9.8±0.04µs 9.5±0.03µs -3.06%
RegExp Creation (Parser) 9.9±0.01µs 9.8±0.02µs -1.01%
RegExp Literal (Compiler) 1640.3±7.63ns 1654.1±2.33ns +0.84%
RegExp Literal (Execution) 14.6±0.06µs 14.2±0.05µs -2.74%
RegExp Literal (Parser) 9.5±0.02µs 9.4±0.01µs -1.05%
RegExp Literal Creation (Compiler) 1482.4±7.95ns 1476.3±4.85ns -0.41%
RegExp Literal Creation (Execution) 9.8±0.04µs 9.5±0.02µs -3.06%
RegExp Literal Creation (Parser) 7.6±0.02µs 7.4±0.01µs -2.63%
Static Object Property Access (Compiler) 1467.8±5.95ns 1473.3±6.81ns +0.37%
Static Object Property Access (Execution) 5.3±0.26µs 5.2±0.02µs -1.89%
Static Object Property Access (Parser) 11.7±0.02µs 11.4±0.01µs -2.56%
String Object Access (Compiler) 1423.9±12.20ns 1410.1±3.47ns -0.97%
String Object Access (Execution) 7.7±0.02µs 7.5±0.02µs -2.60%
String Object Access (Parser) 15.7±0.03µs 15.4±0.02µs -1.91%
String comparison (Compiler) 2.2±0.01µs 2.2±0.01µs 0.00%
String comparison (Execution) 4.4±0.06µs 4.4±0.03µs 0.00%
String comparison (Parser) 12.7±0.02µs 12.6±0.03µs -0.79%
String concatenation (Compiler) 1682.2±9.78ns 1679.1±3.74ns -0.18%
String concatenation (Execution) 4.2±0.02µs 4.2±0.02µs 0.00%
String concatenation (Parser) 8.9±0.02µs 8.8±0.02µs -1.12%
String copy (Compiler) 1360.9±10.96ns 1352.8±2.56ns -0.60%
String copy (Execution) 3.9±0.01µs 3.9±0.02µs 0.00%
String copy (Parser) 6.7±0.01µs 6.6±0.01µs -1.49%
Symbols (Compiler) 1007.8±6.73ns 999.8±2.24ns -0.79%
Symbols (Execution) 3.9±0.01µs 3.9±0.01µs 0.00%
Symbols (Parser) 5.3±0.03µs 5.1±0.01µs -3.77%

Copy link
Member

@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.

Really cool change, definitely appreciate differentiating things more by having expressions and statements not be variants of the same thing.

@jedel1043
Copy link
Member Author

This is missing a lot of documentation, but I'll merge this as it is, since the number of changes is pretty massive and I wouldn't like to add more changes on top of that.

I'll follow up with two PRs that implement LabelledStatement and add the missing documentation.

bors r+

bors bot pushed a commit that referenced this pull request Oct 16, 2022
This Pull Request fixes #1371. And yeah, the number of file changes is real...

It changes the following:

- Split the ast `Node` into `Statement` and `Expression`. 
- Rewrite the parser and bytecompiler to conform to this change.
- Refactor some ast nodes into reusable structures.
- Rewrite `contains_arguments` and `contains` to ease the transition into a future ast visitor.

List of things that were apparently fixed by this refactor?:
- Implement read-assign operation for private accessors (e.g. `this.#field ||= 5`).
- `var await` declaration now allowed outside `async` functions and inside functions nested in async functions.
- Reject redeclarations of variables declared in the init list of a for loop.

Still missing some documentation adjustments, will try to do it ASAP.
@bors
Copy link

bors bot commented Oct 16, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Split Node into Statement, Expression and Declaration [Merged by Bors] - Split Node into Statement, Expression and Declaration Oct 16, 2022
@bors bors bot closed this Oct 16, 2022
@bors bors bot deleted the stmt-expr-split branch October 16, 2022 23:47
bors bot pushed a commit that referenced this pull request Oct 26, 2022
As promised in #2319 (comment). There are still some style inconsistencies (which require a bit more time and effort), but having the whole module documented is a lot better for clarity.
@RageKnify RageKnify added the Internal Category for changelog label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Issue surrounding the abstract syntax tree hacktoberfest-accepted PR accepted for Hacktoberfest Internal Category for changelog parser Issues surrounding the parser run-benchmark Label used to run banchmarks on PRs vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split Node into Expression, Statement and Declaration
4 participants