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] - Implement Classes #1976

Closed
wants to merge 8 commits into from
Closed

[Merged by Bors] - Implement Classes #1976

wants to merge 8 commits into from

Conversation

raskad
Copy link
Member

@raskad raskad commented Mar 24, 2022

This Pull Request fixes/closes #337.

It changes the following:

  • Implement class declaration parsing.
  • Implement class expression parsing.
  • Implement class execution.

There are still some features like super missing and there are some early errors that are not implemented yet. But I think it makes sense to merge this, as we can branch out the missing features from here.

@raskad raskad added enhancement New feature or request parser Issues surrounding the parser lexer Issues surrounding the lexer execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine. labels Mar 24, 2022
@raskad raskad added this to the v0.15.0 milestone Mar 24, 2022
@raskad
Copy link
Member Author

raskad commented Mar 24, 2022

Too many passed tests for github comments...

VM implementation

Test result main count PR count difference
Total 88,428 88,428 0
Passed 43,990 50,685 +6,695
Ignored 21,495 21,495 0
Failed 22,943 16,248 -6,695
Panics 0 0 0
Conformance 49.75% 57.32% +7.57%
Fixed tests (6766):
Broken tests (71):
test/language/expressions/object/S11.1.5_A4.1.js [strict mode] (previously Passed)
test/language/expressions/object/S11.1.5_A4.1.js (previously Passed)
test/language/expressions/object/method-definition/yield-star-after-newline.js [strict mode] (previously Passed)
test/language/expressions/object/method-definition/yield-star-after-newline.js (previously Passed)
test/language/expressions/generators/param-dflt-yield.js [strict mode] (previously Passed)
test/language/expressions/generators/param-dflt-yield.js (previously Passed)
test/language/expressions/generators/yield-star-after-newline.js [strict mode] (previously Passed)
test/language/expressions/generators/yield-star-after-newline.js (previously Passed)
test/language/expressions/async-generator/early-errors-expression-yield-star-after-newline.js [strict mode] (previously Passed)
test/language/expressions/async-generator/early-errors-expression-yield-star-after-newline.js (previously Passed)
test/language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js [strict mode] (previously Passed)
test/language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js (previously Passed)
test/language/expressions/assignment/fn-name-lhs-cover.js [strict mode] (previously Passed)
test/language/expressions/assignment/fn-name-lhs-cover.js (previously Passed)
test/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js [strict mode] (previously Passed)
test/language/expressions/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js (previously Passed)
test/language/statements/generators/param-dflt-yield.js [strict mode] (previously Passed)
test/language/statements/generators/param-dflt-yield.js (previously Passed)
test/language/statements/generators/yield-star-after-newline.js [strict mode] (previously Passed)
test/language/statements/generators/yield-star-after-newline.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js (previously Passed)
test/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js [strict mode] (previously Passed)
test/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/statements/class/static-init-invalid-await.js (previously Passed)
test/language/statements/class/gen-method-param-dflt-yield.js [strict mode] (previously Passed)
test/language/statements/class/gen-method-param-dflt-yield.js (previously Passed)
test/language/statements/class/static-gen-method-param-dflt-yield.js [strict mode] (previously Passed)
test/language/statements/class/static-gen-method-param-dflt-yield.js (previously Passed)
test/language/statements/class/static-init-invalid-label-dup.js [strict mode] (previously Passed)
test/language/statements/class/static-init-invalid-label-dup.js (previously Passed)
test/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js [strict mode] (previously Passed)
test/language/statements/class/elements/syntax/early-errors/grammar-private-environment-on-class-heritage-function-expression.js (previously Passed)
test/language/statements/class/definition/methods-gen-yield-star-after-newline.js [strict mode] (previously Passed)
test/language/statements/class/definition/methods-gen-yield-star-after-newline.js (previously Passed)
test/language/statements/class/syntax/escaped-static.js [strict mode] (previously Passed)
test/language/statements/class/syntax/escaped-static.js (previously Passed)
test/language/reserved-words/ident-name-reserved-word-literal-accessor.js [strict mode] (previously Passed)
test/language/reserved-words/ident-name-reserved-word-literal-accessor.js (previously Passed)
test/language/reserved-words/ident-name-reserved-word-literal-prop-name.js [strict mode] (previously Passed)
test/language/reserved-words/ident-name-reserved-word-literal-prop-name.js (previously Passed)
test/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js (previously Passed)
test/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js (previously Passed)
test/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js (previously Passed)
test/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js (previously Passed)
test/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js (previously Passed)
test/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js (previously Passed)
test/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-class.js (previously Passed)

@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #1976 (c71bffe) into main (a5337a9) will decrease coverage by 2.03%.
The diff coverage is 23.01%.

@@            Coverage Diff             @@
##             main    #1976      +/-   ##
==========================================
- Coverage   45.90%   43.87%   -2.04%     
==========================================
  Files         206      211       +5     
  Lines       17148    18662    +1514     
==========================================
+ Hits         7872     8188     +316     
- Misses       9276    10474    +1198     
Impacted Files Coverage Δ
boa_engine/src/bytecompiler.rs 30.38% <0.00%> (-6.76%) ⬇️
boa_engine/src/object/mod.rs 20.59% <0.00%> (-0.77%) ⬇️
boa_engine/src/syntax/ast/node/declaration/mod.rs 50.31% <ø> (ø)
...src/syntax/ast/node/field/get_private_field/mod.rs 0.00% <0.00%> (ø)
boa_engine/src/syntax/ast/node/mod.rs 70.12% <0.00%> (-1.88%) ⬇️
..._engine/src/syntax/ast/node/operator/assign/mod.rs 23.52% <0.00%> (+0.52%) ⬆️
boa_engine/src/syntax/lexer/cursor.rs 58.25% <ø> (+0.48%) ⬆️
boa_engine/src/syntax/lexer/token.rs 15.21% <0.00%> (-4.79%) ⬇️
...tax/parser/expression/assignment/arrow_function.rs 34.56% <0.00%> (-1.80%) ⬇️
...tax/parser/expression/assignment/exponentiation.rs 54.16% <ø> (ø)
... and 69 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 a5337a9...c71bffe. Read the comment docs.

@github-actions
Copy link

Benchmark for aeb6891

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 445.7±0.76ns 453.7±1.62ns +1.79%
Arithmetic operations (Execution) 1728.1±2.32ns 1745.7±2.93ns +1.02%
Arithmetic operations (Parser) 5.2±0.01µs 5.1±0.00µs -1.92%
Array access (Compiler) 1102.8±1.77ns 1137.1±5.88ns +3.11%
Array access (Execution) 8.5±0.02µs 9.0±0.03µs +5.88%
Array access (Parser) 11.6±0.01µs 11.4±0.02µs -1.72%
Array creation (Compiler) 1586.0±2.08ns 1599.5±9.97ns +0.85%
Array creation (Execution) 2.8±0.00ms 3.0±0.01ms +7.14%
Array creation (Parser) 13.1±0.02µs 12.9±0.06µs -1.53%
Array pop (Compiler) 3.4±0.01µs 3.3±0.01µs -2.94%
Array pop (Execution) 1234.5±3.68µs 1285.0±7.88µs +4.09%
Array pop (Parser) 130.4±0.22µs 129.6±0.15µs -0.61%
Boolean Object Access (Compiler) 957.3±2.05ns 1108.6±3.14ns +15.80%
Boolean Object Access (Execution) 5.0±0.01µs 5.2±0.01µs +4.00%
Boolean Object Access (Parser) 14.1±0.05µs 13.2±0.01µs -6.38%
Clean js (Compiler) 3.0±0.00µs 2.9±0.01µs -3.33%
Clean js (Execution) 959.2±4.47µs 978.3±4.92µs +1.99%
Clean js (Parser) 28.1±0.06µs 27.6±0.09µs -1.78%
Create Realm 269.0±4.08ns 242.6±1.34ns -9.81%
Dynamic Object Property Access (Compiler) 1617.4±4.62ns 1413.4±1.50ns -12.61%
Dynamic Object Property Access (Execution) 6.6±0.02µs 6.2±0.02µs -6.06%
Dynamic Object Property Access (Parser) 9.1±0.01µs 11.5±0.02µs +26.37%
Fibonacci (Compiler) 2.2±0.01µs 2.0±0.00µs -9.09%
Fibonacci (Execution) 1564.8±3.06µs 1610.6±5.26µs +2.93%
Fibonacci (Parser) 15.8±0.01µs 17.5±0.02µs +10.76%
For loop (Compiler) 1944.5±4.91ns 1727.9±3.22ns -11.14%
For loop (Execution) 38.3±0.40µs 38.3±0.15µs 0.00%
For loop (Parser) 13.4±0.02µs 13.3±0.08µs -0.75%
Mini js (Compiler) 2.9±0.01µs 2.9±0.01µs 0.00%
Mini js (Execution) 884.2±5.19µs 1020.2±6.48µs +15.38%
Mini js (Parser) 24.7±0.04µs 24.2±0.16µs -2.02%
Number Object Access (Compiler) 905.2±1.89ns 911.6±2.95ns +0.71%
Number Object Access (Execution) 4.6±0.01µs 4.1±0.01µs -10.87%
Number Object Access (Parser) 10.9±0.02µs 10.3±0.02µs -5.50%
Object Creation (Compiler) 1344.4±3.97ns 1226.3±2.15ns -8.78%
Object Creation (Execution) 6.0±0.02µs 5.6±0.01µs -6.67%
Object Creation (Parser) 9.0±0.01µs 9.9±0.03µs +10.00%
RegExp (Compiler) 1410.5±8.15ns 1414.8±3.64ns +0.30%
RegExp (Execution) 10.6±0.05µs 11.1±0.04µs +4.72%
RegExp (Parser) 9.9±0.01µs 9.6±0.01µs -3.03%
RegExp Creation (Compiler) 1376.3±6.18ns 1234.4±2.75ns -10.31%
RegExp Creation (Execution) 7.8±0.02µs 8.2±0.03µs +5.13%
RegExp Creation (Parser) 8.3±0.02µs 8.0±0.02µs -3.61%
RegExp Literal (Compiler) 1619.3±3.10ns 1429.3±3.71ns -11.73%
RegExp Literal (Execution) 10.6±0.04µs 11.0±0.04µs +3.77%
RegExp Literal (Parser) 8.1±0.01µs 7.8±0.03µs -3.70%
RegExp Literal Creation (Compiler) 1391.3±5.95ns 1250.9±15.61ns -10.09%
RegExp Literal Creation (Execution) 8.8±0.04µs 8.2±0.04µs -6.82%
RegExp Literal Creation (Parser) 6.4±0.02µs 6.9±0.03µs +7.81%
Static Object Property Access (Compiler) 1401.9±5.60ns 1227.7±11.52ns -12.43%
Static Object Property Access (Execution) 6.2±0.02µs 5.9±0.02µs -4.84%
Static Object Property Access (Parser) 8.6±0.01µs 10.6±0.01µs +23.26%
String Object Access (Compiler) 1278.8±5.23ns 1297.1±4.51ns +1.43%
String Object Access (Execution) 6.7±0.06µs 6.7±0.01µs 0.00%
String Object Access (Parser) 13.7±0.07µs 13.0±0.02µs -5.11%
String comparison (Compiler) 1826.4±4.10ns 1833.5±6.10ns +0.39%
String comparison (Execution) 5.1±0.02µs 5.4±0.01µs +5.88%
String comparison (Parser) 10.8±0.02µs 10.5±0.01µs -2.78%
String concatenation (Compiler) 1411.3±8.86ns 1425.9±4.97ns +1.03%
String concatenation (Execution) 4.7±0.25µs 4.9±0.02µs +4.26%
String concatenation (Parser) 7.4±0.01µs 7.2±0.01µs -2.70%
String copy (Compiler) 1115.4±2.51ns 1150.8±4.10ns +3.17%
String copy (Execution) 4.1±0.01µs 4.4±0.01µs +7.32%
String copy (Parser) 5.5±0.01µs 5.4±0.01µs -1.82%
Symbols (Compiler) 908.3±3.26ns 819.3±2.12ns -9.80%
Symbols (Execution) 4.0±0.01µs 4.2±0.04µs +5.00%
Symbols (Parser) 4.3±0.01µs 4.1±0.00µs -4.65%

@github-actions
Copy link

Benchmark for 9ec374e

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 498.7±0.68ns 502.6±1.19ns +0.78%
Arithmetic operations (Execution) 471.3±8.45ns 454.8±1.61ns -3.50%
Arithmetic operations (Parser) 5.4±0.02µs 5.9±0.01µs +9.26%
Array access (Compiler) 1356.2±5.45ns 1328.0±4.02ns -2.08%
Array access (Execution) 7.7±0.02µs 8.3±0.04µs +7.79%
Array access (Parser) 12.6±0.04µs 13.7±0.04µs +8.73%
Array creation (Compiler) 1988.5±2.56ns 1971.7±5.94ns -0.84%
Array creation (Execution) 2.5±0.01ms 2.4±0.00ms -4.00%
Array creation (Parser) 14.7±0.03µs 15.5±0.04µs +5.44%
Array pop (Compiler) 3.9±0.01µs 3.7±0.01µs -5.13%
Array pop (Execution) 1073.7±2.93µs 1063.0±4.58µs -1.00%
Array pop (Parser) 139.8±0.20µs 156.1±0.27µs +11.66%
Boolean Object Access (Compiler) 1147.4±3.29ns 1106.9±6.96ns -3.53%
Boolean Object Access (Execution) 4.0±0.01µs 4.4±0.01µs +10.00%
Boolean Object Access (Parser) 15.3±0.09µs 16.0±0.09µs +4.58%
Clean js (Compiler) 3.7±0.01µs 3.6±0.01µs -2.70%
Clean js (Execution) 702.7±13.12µs 699.0±2.97µs -0.53%
Clean js (Parser) 30.1±0.04µs 33.0±0.07µs +9.63%
Create Realm 250.5±2.67ns 247.9±1.77ns -1.04%
Dynamic Object Property Access (Compiler) 1765.0±6.63ns 1691.6±2.36ns -4.16%
Dynamic Object Property Access (Execution) 5.0±0.01µs 5.3±0.03µs +6.00%
Dynamic Object Property Access (Parser) 11.0±0.05µs 12.2±0.04µs +10.91%
Fibonacci (Compiler) 2.5±0.00µs 2.4±0.01µs -4.00%
Fibonacci (Execution) 1328.2±1.45µs 1402.1±1.76µs +5.56%
Fibonacci (Parser) 16.7±0.07µs 18.6±0.12µs +11.38%
For loop (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
For loop (Execution) 14.5±0.03µs 15.4±0.05µs +6.21%
For loop (Parser) 14.2±0.07µs 15.9±0.06µs +11.97%
Mini js (Compiler) 3.6±0.01µs 3.5±0.01µs -2.78%
Mini js (Execution) 662.2±2.84µs 658.2±6.07µs -0.60%
Mini js (Parser) 26.6±0.09µs 29.3±0.08µs +10.15%
Number Object Access (Compiler) 1075.0±3.20ns 1038.5±1.73ns -3.40%
Number Object Access (Execution) 3.1±0.01µs 3.3±0.02µs +6.45%
Number Object Access (Parser) 11.7±0.08µs 12.4±0.03µs +5.98%
Object Creation (Compiler) 1466.3±5.01ns 1467.5±6.06ns +0.08%
Object Creation (Execution) 4.7±0.01µs 5.1±0.01µs +8.51%
Object Creation (Parser) 9.6±0.04µs 10.6±0.07µs +10.42%
RegExp (Compiler) 1712.4±4.32ns 1696.0±2.41ns -0.96%
RegExp (Execution) 11.2±0.03µs 11.5±0.06µs +2.68%
RegExp (Parser) 10.7±0.08µs 11.8±0.20µs +10.28%
RegExp Creation (Compiler) 1463.9±4.04ns 1476.6±6.78ns +0.87%
RegExp Creation (Execution) 8.4±0.04µs 8.6±0.03µs +2.38%
RegExp Creation (Parser) 8.9±0.07µs 9.7±0.05µs +8.99%
RegExp Literal (Compiler) 1699.0±4.12ns 1667.2±3.32ns -1.87%
RegExp Literal (Execution) 11.2±0.05µs 11.5±0.06µs +2.68%
RegExp Literal (Parser) 8.7±0.07µs 9.5±0.09µs +9.20%
RegExp Literal Creation (Compiler) 1476.7±3.05ns 1460.3±8.09ns -1.11%
RegExp Literal Creation (Execution) 8.4±0.04µs 8.7±0.03µs +3.57%
RegExp Literal Creation (Parser) 7.0±0.07µs 7.5±0.04µs +7.14%
Static Object Property Access (Compiler) 1507.1±3.00ns 1507.0±5.09ns -0.01%
Static Object Property Access (Execution) 4.9±0.02µs 5.2±0.01µs +6.12%
Static Object Property Access (Parser) 10.4±0.03µs 11.3±0.06µs +8.65%
String Object Access (Compiler) 1533.2±8.44ns 1504.0±8.63ns -1.90%
String Object Access (Execution) 5.8±0.02µs 6.1±0.04µs +5.17%
String Object Access (Parser) 14.6±0.03µs 16.0±0.10µs +9.59%
String comparison (Compiler) 2.2±0.01µs 2.2±0.00µs 0.00%
String comparison (Execution) 4.3±0.01µs 4.7±0.02µs +9.30%
String comparison (Parser) 11.6±0.03µs 12.7±0.05µs +9.48%
String concatenation (Compiler) 1680.3±4.90ns 1682.8±12.98ns +0.15%
String concatenation (Execution) 4.2±0.02µs 4.4±0.01µs +4.76%
String concatenation (Parser) 8.0±0.02µs 8.8±0.06µs +10.00%
String copy (Compiler) 1371.9±4.69ns 1329.4±5.07ns -3.10%
String copy (Execution) 3.9±0.02µs 4.2±0.01µs +7.69%
String copy (Parser) 6.0±0.01µs 6.6±0.06µs +10.00%
Symbols (Compiler) 948.7±2.83ns 944.1±1.55ns -0.48%
Symbols (Execution) 4.0±0.01µs 4.2±0.01µs +5.00%
Symbols (Parser) 4.7±0.02µs 5.0±0.07µs +6.38%

@github-actions
Copy link

Benchmark for 7ac4292

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 517.4±1.51ns 509.4±2.22ns -1.55%
Arithmetic operations (Execution) 693.1±0.67ns 669.6±0.56ns -3.39%
Arithmetic operations (Parser) 5.3±0.01µs 5.8±0.02µs +9.43%
Array access (Compiler) 1249.3±2.73ns 1254.2±3.30ns +0.39%
Array access (Execution) 7.4±0.02µs 7.8±0.02µs +5.41%
Array access (Parser) 11.5±0.02µs 12.8±0.03µs +11.30%
Array creation (Compiler) 1814.5±4.19ns 1843.5±7.54ns +1.60%
Array creation (Execution) 2.5±0.00ms 2.4±0.00ms -4.00%
Array creation (Parser) 13.2±0.02µs 14.6±0.02µs +10.61%
Array pop (Compiler) 3.9±0.02µs 3.8±0.01µs -2.56%
Array pop (Execution) 1123.3±10.22µs 1093.2±3.30µs -2.68%
Array pop (Parser) 130.7±0.10µs 146.6±0.16µs +12.17%
Boolean Object Access (Compiler) 1100.8±4.02ns 1080.7±4.08ns -1.83%
Boolean Object Access (Execution) 3.9±0.01µs 4.1±0.01µs +5.13%
Boolean Object Access (Parser) 14.2±0.02µs 15.2±0.06µs +7.04%
Clean js (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Clean js (Execution) 686.3±3.64µs 693.5±4.61µs +1.05%
Clean js (Parser) 28.3±0.04µs 31.2±0.03µs +10.25%
Create Realm 273.4±0.42ns 271.3±0.36ns -0.77%
Dynamic Object Property Access (Compiler) 1641.3±16.44ns 1608.3±14.81ns -2.01%
Dynamic Object Property Access (Execution) 5.0±0.01µs 5.3±0.01µs +6.00%
Dynamic Object Property Access (Parser) 10.3±0.01µs 11.2±0.02µs +8.74%
Fibonacci (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
Fibonacci (Execution) 1266.3±2.01µs 1361.3±13.38µs +7.50%
Fibonacci (Parser) 15.8±0.02µs 17.3±0.03µs +9.49%
For loop (Compiler) 1930.8±10.81ns 1989.9±8.65ns +3.06%
For loop (Execution) 14.8±0.04µs 15.5±0.06µs +4.73%
For loop (Parser) 13.4±0.02µs 14.9±0.02µs +11.19%
Mini js (Compiler) 3.2±0.01µs 3.3±0.01µs +3.12%
Mini js (Execution) 651.0±3.56µs 655.9±3.72µs +0.75%
Mini js (Parser) 24.7±0.03µs 27.6±0.02µs +11.74%
Number Object Access (Compiler) 1030.4±4.86ns 1030.9±1.87ns +0.05%
Number Object Access (Execution) 3.0±0.00µs 3.2±0.01µs +6.67%
Number Object Access (Parser) 11.1±0.01µs 11.7±0.01µs +5.41%
Object Creation (Compiler) 1383.2±5.83ns 1355.3±6.28ns -2.02%
Object Creation (Execution) 4.7±0.01µs 5.0±0.02µs +6.38%
Object Creation (Parser) 9.0±0.02µs 9.8±0.02µs +8.89%
RegExp (Compiler) 1603.8±1.97ns 1578.8±3.26ns -1.56%
RegExp (Execution) 10.9±0.05µs 11.2±0.06µs +2.75%
RegExp (Parser) 9.9±0.01µs 10.9±0.02µs +10.10%
RegExp Creation (Compiler) 1383.6±5.78ns 1401.9±4.48ns +1.32%
RegExp Creation (Execution) 8.1±0.04µs 8.3±0.03µs +2.47%
RegExp Creation (Parser) 8.3±0.02µs 9.0±0.02µs +8.43%
RegExp Literal (Compiler) 1617.3±4.40ns 1603.4±11.52ns -0.86%
RegExp Literal (Execution) 10.9±0.05µs 11.1±0.05µs +1.83%
RegExp Literal (Parser) 8.0±0.02µs 8.8±0.02µs +10.00%
RegExp Literal Creation (Compiler) 1401.8±5.93ns 1408.7±4.82ns +0.49%
RegExp Literal Creation (Execution) 8.1±0.02µs 8.3±0.03µs +2.47%
RegExp Literal Creation (Parser) 6.4±0.02µs 6.9±0.02µs +7.81%
Static Object Property Access (Compiler) 1407.7±4.55ns 1373.3±3.89ns -2.44%
Static Object Property Access (Execution) 4.8±0.02µs 5.2±0.02µs +8.33%
Static Object Property Access (Parser) 9.6±0.09µs 10.5±0.04µs +9.38%
String Object Access (Compiler) 1470.1±9.92ns 1444.3±5.56ns -1.75%
String Object Access (Execution) 5.5±0.01µs 5.9±0.01µs +7.27%
String Object Access (Parser) 13.8±0.01µs 14.9±0.01µs +7.97%
String comparison (Compiler) 2.1±0.01µs 2.1±0.00µs 0.00%
String comparison (Execution) 4.3±0.02µs 4.6±0.01µs +6.98%
String comparison (Parser) 10.9±0.03µs 12.0±0.02µs +10.09%
String concatenation (Compiler) 1611.3±8.88ns 1628.5±3.32ns +1.07%
String concatenation (Execution) 4.0±0.02µs 4.4±0.01µs +10.00%
String concatenation (Parser) 7.4±0.02µs 8.2±0.02µs +10.81%
String copy (Compiler) 1277.1±3.25ns 1281.0±4.12ns +0.31%
String copy (Execution) 3.8±0.01µs 4.1±0.02µs +7.89%
String copy (Parser) 5.5±0.02µs 6.2±0.02µs +12.73%
Symbols (Compiler) 911.7±3.49ns 903.6±3.01ns -0.89%
Symbols (Execution) 3.8±0.01µs 4.2±0.01µs +10.53%
Symbols (Parser) 4.3±0.01µs 4.6±0.01µs +6.98%

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.

Great work!! It looks very good. I have stuff to review, but I already have some comments.

boa_engine/src/syntax/ast/node/object/mod.rs Outdated Show resolved Hide resolved
boa_engine/src/syntax/lexer/identifier.rs Show resolved Hide resolved
boa_engine/src/syntax/lexer/token.rs Show resolved Hide resolved
@github-actions
Copy link

Benchmark for 43ff007

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 597.3±10.80ns 606.3±7.65ns +1.51%
Arithmetic operations (Execution) 809.9±6.62ns 774.9±2.39ns -4.32%
Arithmetic operations (Parser) 5.7±0.03µs 6.4±0.08µs +12.28%
Array access (Compiler) 1512.7±5.12ns 1494.9±13.34ns -1.18%
Array access (Execution) 8.8±0.06µs 9.2±0.07µs +4.55%
Array access (Parser) 12.7±0.09µs 13.7±0.16µs +7.87%
Array creation (Compiler) 2.1±0.02µs 2.1±0.02µs 0.00%
Array creation (Execution) 3.0±0.03ms 3.0±0.02ms 0.00%
Array creation (Parser) 14.4±0.13µs 15.8±0.16µs +9.72%
Array pop (Compiler) 4.7±0.04µs 4.4±0.05µs -6.38%
Array pop (Execution) 1332.3±12.09µs 1336.7±5.99µs +0.33%
Array pop (Parser) 149.6±0.71µs 162.7±1.95µs +8.76%
Boolean Object Access (Compiler) 1140.1±16.93ns 1164.1±10.10ns +2.11%
Boolean Object Access (Execution) 4.6±0.03µs 5.0±0.31µs +8.70%
Boolean Object Access (Parser) 15.9±0.11µs 16.8±0.09µs +5.66%
Clean js (Compiler) 3.9±0.07µs 3.9±0.04µs 0.00%
Clean js (Execution) 824.9±8.14µs 827.6±8.28µs +0.33%
Clean js (Parser) 31.0±0.14µs 33.9±0.32µs +9.35%
Create Realm 323.3±4.46ns 339.6±7.96ns +5.04%
Dynamic Object Property Access (Compiler) 1900.8±7.44ns 1902.2±16.38ns +0.07%
Dynamic Object Property Access (Execution) 5.9±0.05µs 6.3±0.05µs +6.78%
Dynamic Object Property Access (Parser) 11.3±0.07µs 11.8±0.25µs +4.42%
Fibonacci (Compiler) 2.6±0.02µs 2.6±0.05µs 0.00%
Fibonacci (Execution) 1497.7±12.91µs 1579.7±15.40µs +5.48%
Fibonacci (Parser) 17.6±0.10µs 18.7±0.40µs +6.25%
For loop (Compiler) 2.3±0.02µs 2.3±0.03µs 0.00%
For loop (Execution) 17.9±0.20µs 18.4±0.21µs +2.79%
For loop (Parser) 14.9±0.04µs 15.7±0.47µs +5.37%
Mini js (Compiler) 3.8±0.04µs 3.8±0.04µs 0.00%
Mini js (Execution) 777.1±6.17µs 784.2±4.74µs +0.91%
Mini js (Parser) 27.1±0.15µs 29.8±0.33µs +9.96%
Number Object Access (Compiler) 1097.6±12.84ns 1112.7±10.22ns +1.38%
Number Object Access (Execution) 3.6±0.03µs 3.8±0.02µs +5.56%
Number Object Access (Parser) 12.1±0.04µs 12.9±0.12µs +6.61%
Object Creation (Compiler) 1662.5±19.06ns 1643.0±9.34ns -1.17%
Object Creation (Execution) 5.7±0.04µs 6.0±0.08µs +5.26%
Object Creation (Parser) 9.8±0.06µs 10.4±0.19µs +6.12%
RegExp (Compiler) 1957.1±9.72ns 1922.0±12.16ns -1.79%
RegExp (Execution) 12.7±0.16µs 13.1±0.17µs +3.15%
RegExp (Parser) 10.9±0.03µs 11.6±0.22µs +6.42%
RegExp Creation (Compiler) 1634.6±7.56ns 1684.9±5.85ns +3.08%
RegExp Creation (Execution) 9.6±0.10µs 10.0±0.16µs +4.17%
RegExp Creation (Parser) 9.1±0.08µs 9.6±0.13µs +5.49%
RegExp Literal (Compiler) 1955.2±11.23ns 1886.8±10.73ns -3.50%
RegExp Literal (Execution) 12.8±0.17µs 13.1±0.11µs +2.34%
RegExp Literal (Parser) 8.8±0.03µs 9.3±0.20µs +5.68%
RegExp Literal Creation (Compiler) 1669.3±14.10ns 1652.4±15.90ns -1.01%
RegExp Literal Creation (Execution) 9.7±0.03µs 9.9±0.15µs +2.06%
RegExp Literal Creation (Parser) 6.9±0.05µs 7.1±0.15µs +2.90%
Static Object Property Access (Compiler) 1669.7±8.76ns 1679.4±17.17ns +0.58%
Static Object Property Access (Execution) 5.8±0.05µs 6.1±0.06µs +5.17%
Static Object Property Access (Parser) 10.6±0.09µs 11.1±0.27µs +4.72%
String Object Access (Compiler) 1590.3±32.24ns 1581.5±16.86ns -0.55%
String Object Access (Execution) 6.6±0.06µs 6.9±0.04µs +4.55%
String Object Access (Parser) 15.9±0.73µs 16.4±0.15µs +3.14%
String comparison (Compiler) 2.5±0.03µs 2.5±0.14µs 0.00%
String comparison (Execution) 5.1±0.03µs 5.4±0.05µs +5.88%
String comparison (Parser) 11.9±0.07µs 13.0±0.16µs +9.24%
String concatenation (Compiler) 1881.0±30.18ns 1895.0±23.66ns +0.74%
String concatenation (Execution) 4.9±0.04µs 5.2±0.04µs +6.12%
String concatenation (Parser) 8.1±0.07µs 8.8±0.10µs +8.64%
String copy (Compiler) 1515.1±19.38ns 1527.1±16.97ns +0.79%
String copy (Execution) 4.6±0.03µs 4.9±0.04µs +6.52%
String copy (Parser) 6.0±0.03µs 6.6±0.07µs +10.00%
Symbols (Compiler) 1088.4±5.42ns 1072.1±10.63ns -1.50%
Symbols (Execution) 4.6±0.07µs 5.0±0.04µs +8.70%
Symbols (Parser) 4.6±0.03µs 4.8±0.08µs +4.35%

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.

Looks very good from my side :) I added some improvements that could be done. Especially in the parser.

The bytecompiler module is getting very out of hand... but not related to the PR. Almost 3k lines... We really need #1808 and #1608 to be implemented asap, since this is a huge issue for being able to contribute to the compiler.

It would be good to document how the idea behind each opcode is thought of. The order of the operands in the stack, how is the implementation... But maybe can be done in PRs to fix those two issues.

Comment on lines +53 to +57
let _timer = Profiler::global().start_event("ClassExpression", "Parsing");
let strict = cursor.strict_mode();
cursor.set_strict_mode(true);

let token = cursor.peek(0, interner)?.ok_or(ParseError::AbruptEnd)?;
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the spec, the first token of this parser should be the class keyword, right? I guess this should "expect" that keyword.

I guess it's not here because the parser that calls it consumes it before calling it, but I think that should be changed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that is exactly it. I will open a issue for this, because it will mean replacing next with peek in multiple places and as a result multiple parsers need to be changed. We have this behaviour in lot's of parsers, so doing this in a dedicated issue seems like the best idea.

Comment on lines +104 to +106
TokenKind::Keyword(Keyword::Class) => {
ClassExpression::new(self.name, false, false).parse(cursor, interner)
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess the "TODO" a bit higher is the issue. I guess this could be fixed in a future PR.

boa_engine/src/vm/opcode.rs Outdated Show resolved Hide resolved
{
type Output = Class;

fn parse(
Copy link
Member

Choose a reason for hiding this comment

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

This parser is way too big, and it's not clear how to follow the spec. It seems that this parser should be pretty simple: just check if the extends keyword exists, and if so, call the ClassHeritage parser, and then, expect the {, call the ClassBody parser, then expect the }.

Then, we could have all the different parsers defined (well, ClassBody would be a type alias for ClassElementList, for example). Dividing this parser into multiple smaller parsers should make things more maintainable (and reusable, if any of them gets referenced anywhere else in the future).

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 refactored the parser to match the spec better. I think it got a bit better for sure. Some syntax error handling is now consolidated instead of spread throughout hundreds of lines.

The ClassElement parser is still ~700 lines long. We maybe can get the line count down with some helpers, but I think it is mostly the natural complexity of the parser. I guess this is probably one of the most complex parsers in spec, because we have fields, methods of all kinds, all of that in static, constructors, static blocks and all of that with private identifiers.

boa_engine/src/bytecompiler.rs Show resolved Hide resolved
@github-actions
Copy link

Benchmark for 5c84d48

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 509.5±1.83ns 503.6±0.81ns -1.16%
Arithmetic operations (Execution) 684.4±0.94ns 648.2±0.27ns -5.29%
Arithmetic operations (Parser) 5.3±0.06µs 5.8±0.01µs +9.43%
Array access (Compiler) 1266.0±2.40ns 1278.0±2.95ns +0.95%
Array access (Execution) 7.5±0.03µs 7.7±0.02µs +2.67%
Array access (Parser) 11.5±0.02µs 12.9±0.03µs +12.17%
Array creation (Compiler) 1837.2±13.20ns 1807.7±5.16ns -1.61%
Array creation (Execution) 2.5±0.00ms 2.5±0.00ms 0.00%
Array creation (Parser) 13.1±0.02µs 14.6±0.02µs +11.45%
Array pop (Compiler) 3.8±0.01µs 3.6±0.01µs -5.26%
Array pop (Execution) 1107.3±3.21µs 1104.9±2.77µs -0.22%
Array pop (Parser) 130.0±0.11µs 149.5±0.25µs +15.00%
Boolean Object Access (Compiler) 1112.6±3.94ns 1107.4±4.41ns -0.47%
Boolean Object Access (Execution) 3.8±0.01µs 4.0±0.01µs +5.26%
Boolean Object Access (Parser) 13.9±0.05µs 15.4±0.08µs +10.79%
Clean js (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Clean js (Execution) 681.4±3.56µs 688.8±3.20µs +1.09%
Clean js (Parser) 28.2±0.04µs 31.6±0.13µs +12.06%
Create Realm 265.7±0.18ns 293.7±0.39ns +10.54%
Dynamic Object Property Access (Compiler) 1604.6±8.97ns 1612.9±10.90ns +0.52%
Dynamic Object Property Access (Execution) 5.0±0.02µs 5.3±0.01µs +6.00%
Dynamic Object Property Access (Parser) 10.2±0.11µs 11.4±0.02µs +11.76%
Fibonacci (Compiler) 2.3±0.01µs 2.3±0.01µs 0.00%
Fibonacci (Execution) 1292.8±1.80µs 1367.1±2.12µs +5.75%
Fibonacci (Parser) 15.7±0.04µs 17.7±0.02µs +12.74%
For loop (Compiler) 1938.1±3.13ns 1940.2±6.47ns +0.11%
For loop (Execution) 15.0±0.05µs 15.0±0.05µs 0.00%
For loop (Parser) 13.4±0.13µs 14.9±0.02µs +11.19%
Mini js (Compiler) 3.3±0.01µs 3.2±0.01µs -3.03%
Mini js (Execution) 643.7±5.20µs 650.3±3.43µs +1.03%
Mini js (Parser) 24.7±0.04µs 27.7±0.03µs +12.15%
Number Object Access (Compiler) 1041.3±5.53ns 1035.4±1.89ns -0.57%
Number Object Access (Execution) 3.0±0.03µs 3.1±0.01µs +3.33%
Number Object Access (Parser) 10.9±0.03µs 11.9±0.02µs +9.17%
Object Creation (Compiler) 1383.9±6.62ns 1366.9±3.13ns -1.23%
Object Creation (Execution) 4.7±0.02µs 5.0±0.03µs +6.38%
Object Creation (Parser) 8.8±0.02µs 10.0±0.01µs +13.64%
RegExp (Compiler) 1632.0±8.86ns 1604.9±3.49ns -1.66%
RegExp (Execution) 11.3±0.04µs 11.6±0.07µs +2.65%
RegExp (Parser) 9.9±0.03µs 11.0±0.02µs +11.11%
RegExp Creation (Compiler) 1407.4±4.99ns 1399.0±3.01ns -0.60%
RegExp Creation (Execution) 8.4±0.03µs 8.7±0.05µs +3.57%
RegExp Creation (Parser) 8.2±0.02µs 9.2±0.01µs +12.20%
RegExp Literal (Compiler) 1624.9±8.16ns 1585.4±2.68ns -2.43%
RegExp Literal (Execution) 11.2±0.07µs 11.5±0.06µs +2.68%
RegExp Literal (Parser) 8.0±0.02µs 8.9±0.04µs +11.25%
RegExp Literal Creation (Compiler) 1407.7±5.01ns 1378.6±3.41ns -2.07%
RegExp Literal Creation (Execution) 8.4±0.03µs 8.8±0.04µs +4.76%
RegExp Literal Creation (Parser) 6.3±0.02µs 6.9±0.01µs +9.52%
Static Object Property Access (Compiler) 1403.6±8.75ns 1425.4±2.75ns +1.55%
Static Object Property Access (Execution) 4.9±0.01µs 5.2±0.02µs +6.12%
Static Object Property Access (Parser) 9.5±0.04µs 10.7±0.02µs +12.63%
String Object Access (Compiler) 1482.7±8.56ns 1459.6±8.06ns -1.56%
String Object Access (Execution) 5.6±0.02µs 5.8±0.03µs +3.57%
String Object Access (Parser) 13.6±0.03µs 15.1±0.01µs +11.03%
String comparison (Compiler) 2.1±0.01µs 2.1±0.00µs 0.00%
String comparison (Execution) 4.3±0.01µs 4.5±0.01µs +4.65%
String comparison (Parser) 10.6±0.01µs 11.9±0.02µs +12.26%
String concatenation (Compiler) 1607.8±1.56ns 1623.5±3.26ns +0.98%
String concatenation (Execution) 4.1±0.01µs 4.4±0.01µs +7.32%
String concatenation (Parser) 7.4±0.01µs 8.2±0.02µs +10.81%
String copy (Compiler) 1300.6±3.29ns 1300.9±4.51ns +0.02%
String copy (Execution) 3.8±0.02µs 4.1±0.02µs +7.89%
String copy (Parser) 5.4±0.01µs 6.1±0.01µs +12.96%
Symbols (Compiler) 906.5±3.73ns 904.9±2.68ns -0.18%
Symbols (Execution) 3.9±0.01µs 4.1±0.02µs +5.13%
Symbols (Parser) 4.2±0.01µs 4.7±0.01µs +11.90%

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Great work @raskad !

I did a light review of the PR, I intend to do a more in depth review :)

boa_engine/src/syntax/ast/node/object/mod.rs Show resolved Hide resolved
@raskad
Copy link
Member Author

raskad commented Mar 31, 2022

Rebased

@github-actions
Copy link

Benchmark for 66bc9d5

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 439.4±2.13ns 438.7±1.32ns -0.16%
Arithmetic operations (Execution) 597.9±3.42ns 581.8±0.90ns -2.69%
Arithmetic operations (Parser) 5.2±0.01µs 5.0±0.00µs -3.85%
Array access (Compiler) 1143.4±1.92ns 1112.6±2.97ns -2.69%
Array access (Execution) 7.3±0.03µs 6.7±0.01µs -8.22%
Array access (Parser) 10.1±0.02µs 11.2±0.01µs +10.89%
Array creation (Compiler) 1629.8±4.77ns 1604.1±2.61ns -1.58%
Array creation (Execution) 2.5±0.00ms 2.2±0.00ms -12.00%
Array creation (Parser) 11.4±0.02µs 12.7±0.02µs +11.40%
Array pop (Compiler) 3.3±0.01µs 3.2±0.01µs -3.03%
Array pop (Execution) 983.4±4.73µs 1137.2±13.45µs +15.64%
Array pop (Parser) 113.7±0.10µs 145.1±0.16µs +27.62%
Boolean Object Access (Compiler) 972.5±2.74ns 968.7±1.40ns -0.39%
Boolean Object Access (Execution) 3.4±0.02µs 3.6±0.01µs +5.88%
Boolean Object Access (Parser) 12.2±0.01µs 13.4±0.13µs +9.84%
Clean js (Compiler) 3.0±0.01µs 2.9±0.01µs -3.33%
Clean js (Execution) 598.6±4.58µs 615.5±3.23µs +2.82%
Clean js (Parser) 28.0±0.03µs 27.4±0.03µs -2.14%
Create Realm 267.6±0.23ns 240.7±0.31ns -10.05%
Dynamic Object Property Access (Compiler) 1457.1±6.19ns 1412.3±8.08ns -3.07%
Dynamic Object Property Access (Execution) 4.5±0.03µs 4.7±0.01µs +4.44%
Dynamic Object Property Access (Parser) 9.0±0.02µs 9.9±0.01µs +10.00%
Fibonacci (Compiler) 2.0±0.00µs 1996.6±3.71ns -0.17%
Fibonacci (Execution) 1111.3±4.94µs 1165.1±10.45µs +4.84%
Fibonacci (Parser) 13.7±0.02µs 15.1±0.02µs +10.22%
For loop (Compiler) 1731.5±5.25ns 1735.9±4.90ns +0.25%
For loop (Execution) 12.9±0.07µs 13.4±0.04µs +3.88%
For loop (Parser) 11.8±0.02µs 12.9±0.02µs +9.32%
Mini js (Compiler) 2.9±0.01µs 2.9±0.01µs 0.00%
Mini js (Execution) 571.0±3.01µs 579.8±2.57µs +1.54%
Mini js (Parser) 24.3±0.03µs 24.1±0.03µs -0.82%
Number Object Access (Compiler) 906.9±5.44ns 907.6±28.19ns +0.08%
Number Object Access (Execution) 2.6±0.01µs 2.8±0.01µs +7.69%
Number Object Access (Parser) 9.5±0.01µs 10.5±0.01µs +10.53%
Object Creation (Compiler) 1231.2±4.22ns 1213.6±1.38ns -1.43%
Object Creation (Execution) 4.2±0.02µs 4.5±0.01µs +7.14%
Object Creation (Parser) 7.8±0.01µs 8.6±0.02µs +10.26%
RegExp (Compiler) 1448.3±11.28ns 1399.0±14.97ns -3.40%
RegExp (Execution) 10.2±0.62µs 9.8±0.03µs -3.92%
RegExp (Parser) 8.5±0.01µs 9.6±0.02µs +12.94%
RegExp Creation (Compiler) 1245.2±2.74ns 1252.9±3.64ns +0.62%
RegExp Creation (Execution) 7.4±0.04µs 7.4±0.02µs 0.00%
RegExp Creation (Parser) 8.1±0.01µs 8.0±0.02µs -1.23%
RegExp Literal (Compiler) 1447.1±4.51ns 1401.0±3.00ns -3.19%
RegExp Literal (Execution) 9.9±0.06µs 9.8±0.03µs -1.01%
RegExp Literal (Parser) 6.9±0.06µs 7.8±0.02µs +13.04%
RegExp Literal Creation (Compiler) 1249.5±3.26ns 1246.1±3.11ns -0.27%
RegExp Literal Creation (Execution) 7.5±0.04µs 7.4±0.02µs -1.33%
RegExp Literal Creation (Parser) 6.2±0.01µs 6.2±0.01µs 0.00%
Static Object Property Access (Compiler) 1249.4±1.93ns 1246.7±5.21ns -0.22%
Static Object Property Access (Execution) 4.3±0.02µs 4.6±0.01µs +6.98%
Static Object Property Access (Parser) 8.4±0.03µs 9.2±0.02µs +9.52%
String Object Access (Compiler) 1299.2±6.72ns 1280.6±3.40ns -1.43%
String Object Access (Execution) 4.9±0.02µs 5.2±0.01µs +6.12%
String Object Access (Parser) 11.9±0.01µs 13.2±0.02µs +10.92%
String comparison (Compiler) 1867.0±5.60ns 1809.4±3.99ns -3.09%
String comparison (Execution) 3.8±0.02µs 4.0±0.01µs +5.26%
String comparison (Parser) 9.4±0.01µs 10.4±0.02µs +10.64%
String concatenation (Compiler) 1442.4±6.97ns 1417.8±1.74ns -1.71%
String concatenation (Execution) 3.6±0.01µs 3.8±0.02µs +5.56%
String concatenation (Parser) 6.4±0.01µs 7.1±0.01µs +10.94%
String copy (Compiler) 1168.9±5.71ns 1139.0±5.13ns -2.56%
String copy (Execution) 3.4±0.02µs 3.6±0.02µs +5.88%
String copy (Parser) 4.8±0.01µs 5.3±0.01µs +10.42%
Symbols (Compiler) 806.6±1.88ns 800.5±1.56ns -0.76%
Symbols (Execution) 3.4±0.02µs 3.7±0.01µs +8.82%
Symbols (Parser) 4.2±0.01µs 4.1±0.01µs -2.38%

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good from my side :)

@raskad raskad requested a review from Razican April 6, 2022 23:36
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.

This looks very good now! LGTM!

@Razican
Copy link
Member

Razican commented Apr 7, 2022

bors r+

bors bot pushed a commit that referenced this pull request Apr 7, 2022
This Pull Request fixes/closes #337.

It changes the following:

- Implement class declaration parsing.
- Implement class expression parsing.
- Implement class execution.

There are still some features like `super` missing and there are some early errors that are not implemented yet. But I think it makes sense to merge this, as we can branch out the missing features from here.
@bors
Copy link

bors bot commented Apr 7, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement Classes [Merged by Bors] - Implement Classes Apr 7, 2022
@bors bors bot closed this Apr 7, 2022
@bors bors bot deleted the implement-classes branch April 7, 2022 07:21
Razican pushed a commit that referenced this pull request Jun 8, 2022
This Pull Request fixes/closes #337.

It changes the following:

- Implement class declaration parsing.
- Implement class expression parsing.
- Implement class execution.

There are still some features like `super` missing and there are some early errors that are not implemented yet. But I think it makes sense to merge this, as we can branch out the missing features from here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request execution Issues or PRs related to code execution lexer Issues surrounding the lexer parser Issues surrounding the parser vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for classes
3 participants