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] - Extract Intrinsics struct from Context and cleanup names #1890

Closed
wants to merge 4 commits into from

Conversation

jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Mar 3, 2022

Building up to #186, this PR extracts an Intrinsics struct from Context, facilitating a lot the extraction of a Realm struct.
Also, it adapts the BuiltIn trait to be useful for builtins that don't expose a global property on initialization (Generator, TypedArray, etc.)

It changes the following:

  • Creates an Intrinsics struct and refactors Context to transfer its intrinsic related fields to Intrinsics.
  • Renames some methods and parameters to better describe their functionality.
  • Makes BuiltIn::init return Option<JsValue> to skip global property initialization if the builtin initialization returns None

@jedel1043 jedel1043 added builtins PRs and Issues related to builtins/intrinsics Internal Category for changelog labels Mar 3, 2022
@jedel1043 jedel1043 added this to the v0.14.0 milestone Mar 3, 2022
@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Test262 conformance changes

VM implementation

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

@jedel1043 jedel1043 marked this pull request as draft March 3, 2022 00:49
@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #1890 (900a14d) into main (9c2b111) will decrease coverage by 0.17%.
The diff coverage is 54.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1890      +/-   ##
==========================================
- Coverage   46.58%   46.41%   -0.18%     
==========================================
  Files         206      206              
  Lines       16781    16790       +9     
==========================================
- Hits         7818     7793      -25     
- Misses       8963     8997      +34     
Impacted Files Coverage Δ
boa_engine/src/builtins/array/array_iterator.rs 86.66% <ø> (ø)
boa_engine/src/builtins/infinity/mod.rs 50.00% <0.00%> (ø)
boa_engine/src/builtins/iterable/mod.rs 49.01% <ø> (ø)
boa_engine/src/builtins/map/map_iterator.rs 91.17% <ø> (ø)
boa_engine/src/builtins/nan/mod.rs 50.00% <0.00%> (ø)
...gine/src/builtins/regexp/regexp_string_iterator.rs 70.00% <ø> (ø)
boa_engine/src/builtins/set/set_iterator.rs 80.64% <ø> (ø)
boa_engine/src/builtins/string/string_iterator.rs 88.88% <ø> (ø)
boa_engine/src/builtins/undefined/mod.rs 50.00% <0.00%> (ø)
boa_engine/src/object/jsarray.rs 5.15% <0.00%> (-0.47%) ⬇️
... and 60 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 9c2b111...900a14d. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Benchmark for 1e5beb4

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 521.5±1.72ns 512.3±1.81ns -1.76%
Arithmetic operations (Execution) 1975.0±1.96ns 1949.5±2.60ns -1.29%
Arithmetic operations (Parser) 5.2±0.01µs 5.3±0.02µs +1.92%
Array access (Compiler) 1247.8±6.82ns 1258.6±2.64ns +0.87%
Array access (Execution) 9.7±0.05µs 9.6±0.07µs -1.03%
Array access (Parser) 11.6±0.02µs 11.7±0.02µs +0.86%
Array creation (Compiler) 1799.2±9.04ns 1812.4±4.31ns +0.73%
Array creation (Execution) 3.1±0.02ms 3.1±0.00ms 0.00%
Array creation (Parser) 12.9±0.01µs 13.1±0.16µs +1.55%
Array pop (Compiler) 3.9±0.01µs 3.9±0.01µs 0.00%
Array pop (Execution) 1342.9±3.70µs 1348.3±3.77µs +0.40%
Array pop (Parser) 130.1±0.17µs 131.9±0.11µs +1.38%
Boolean Object Access (Compiler) 1094.3±3.80ns 1092.2±4.50ns -0.19%
Boolean Object Access (Execution) 5.9±0.05µs 5.7±0.02µs -3.39%
Boolean Object Access (Parser) 13.9±0.01µs 14.2±0.01µs +2.16%
Clean js (Compiler) 3.3±0.01µs 3.3±0.01µs 0.00%
Clean js (Execution) 1078.1±10.97µs 1086.4±6.25µs +0.77%
Clean js (Parser) 28.0±0.03µs 28.2±0.03µs +0.71%
Create Realm 264.9±2.48ns 295.6±0.72ns +11.59%
Dynamic Object Property Access (Compiler) 1582.7±2.70ns 1605.2±12.05ns +1.42%
Dynamic Object Property Access (Execution) 6.7±0.03µs 6.7±0.04µs 0.00%
Dynamic Object Property Access (Parser) 10.3±0.01µs 10.3±0.02µs 0.00%
Fibonacci (Compiler) 2.2±0.01µs 2.2±0.00µs 0.00%
Fibonacci (Execution) 1732.6±1.87µs 1735.5±1.87µs +0.17%
Fibonacci (Parser) 15.8±0.05µs 15.8±0.11µs 0.00%
For loop (Compiler) 1925.0±5.20ns 1959.0±8.01ns +1.77%
For loop (Execution) 42.3±0.06µs 42.0±0.10µs -0.71%
For loop (Parser) 13.5±0.05µs 13.5±0.02µs 0.00%
Mini js (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
Mini js (Execution) 989.6±3.39µs 997.8±7.09µs +0.83%
Mini js (Parser) 24.4±0.02µs 24.7±0.04µs +1.23%
Number Object Access (Compiler) 1023.0±4.14ns 1033.9±4.57ns +1.07%
Number Object Access (Execution) 4.6±0.04µs 4.5±0.02µs -2.17%
Number Object Access (Parser) 10.9±0.01µs 11.1±0.03µs +1.83%
Object Creation (Compiler) 1357.6±4.74ns 1387.4±9.53ns +2.20%
Object Creation (Execution) 6.1±0.02µs 6.0±0.02µs -1.64%
Object Creation (Parser) 9.0±0.02µs 9.0±0.01µs 0.00%
RegExp (Compiler) 1582.1±2.60ns 1617.8±4.65ns +2.26%
RegExp (Execution) 12.4±0.06µs 12.2±0.07µs -1.61%
RegExp (Parser) 9.8±0.01µs 9.9±0.01µs +1.02%
RegExp Creation (Compiler) 1363.4±5.87ns 1373.3±5.93ns +0.73%
RegExp Creation (Execution) 9.4±0.04µs 9.0±0.13µs -4.26%
RegExp Creation (Parser) 8.2±0.01µs 8.3±0.01µs +1.22%
RegExp Literal (Compiler) 1592.2±3.73ns 1598.0±1.88ns +0.36%
RegExp Literal (Execution) 12.5±0.04µs 12.1±0.06µs -3.20%
RegExp Literal (Parser) 8.0±0.03µs 8.0±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1378.7±5.83ns 1390.1±5.12ns +0.83%
RegExp Literal Creation (Execution) 9.3±0.03µs 9.0±0.03µs -3.23%
RegExp Literal Creation (Parser) 6.3±0.01µs 6.3±0.04µs 0.00%
Static Object Property Access (Compiler) 1361.2±6.29ns 1409.7±4.72ns +3.56%
Static Object Property Access (Execution) 6.3±0.02µs 6.3±0.03µs 0.00%
Static Object Property Access (Parser) 9.7±0.02µs 9.7±0.02µs 0.00%
String Object Access (Compiler) 1446.8±5.14ns 1450.3±8.01ns +0.24%
String Object Access (Execution) 7.6±0.05µs 7.5±0.03µs -1.32%
String Object Access (Parser) 13.7±0.01µs 13.8±0.01µs +0.73%
String comparison (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
String comparison (Execution) 5.8±0.01µs 5.7±0.01µs -1.72%
String comparison (Parser) 10.6±0.01µs 10.7±0.02µs +0.94%
String concatenation (Compiler) 1584.8±6.35ns 1605.6±1.32ns +1.31%
String concatenation (Execution) 5.2±0.02µs 5.2±0.02µs 0.00%
String concatenation (Parser) 7.4±0.01µs 7.4±0.01µs 0.00%
String copy (Compiler) 1264.4±1.86ns 1284.0±2.65ns +1.55%
String copy (Execution) 4.7±0.03µs 4.7±0.01µs 0.00%
String copy (Parser) 5.5±0.01µs 5.5±0.08µs 0.00%
Symbols (Compiler) 887.4±1.33ns 904.5±1.41ns +1.93%
Symbols (Execution) 4.4±0.01µs 4.4±0.01µs 0.00%
Symbols (Parser) 4.2±0.01µs 4.3±0.01µs +2.38%

@jedel1043 jedel1043 marked this pull request as ready for review March 3, 2022 02:08
@jedel1043 jedel1043 force-pushed the intrinsics-rewrite branch from 1284d2a to 8e1aa3d Compare March 3, 2022 02:38
@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Benchmark for 6995448

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 503.2±1.91ns 515.2±1.85ns +2.38%
Arithmetic operations (Execution) 1727.8±11.21ns 1935.4±2.82ns +12.02%
Arithmetic operations (Parser) 5.2±0.00µs 5.2±0.01µs 0.00%
Array access (Compiler) 1248.3±2.92ns 1260.9±2.36ns +1.01%
Array access (Execution) 9.6±0.05µs 8.5±0.06µs -11.46%
Array access (Parser) 11.4±0.02µs 11.6±0.01µs +1.75%
Array creation (Compiler) 1768.0±5.29ns 1815.0±5.00ns +2.66%
Array creation (Execution) 3.1±0.01ms 3.1±0.01ms 0.00%
Array creation (Parser) 12.7±0.02µs 13.1±0.02µs +3.15%
Array pop (Compiler) 3.8±0.01µs 3.9±0.02µs +2.63%
Array pop (Execution) 1340.7±2.79µs 1345.4±4.15µs +0.35%
Array pop (Parser) 128.9±0.10µs 131.2±0.16µs +1.78%
Boolean Object Access (Compiler) 1092.7±3.40ns 1111.1±5.73ns +1.68%
Boolean Object Access (Execution) 5.8±0.02µs 5.7±0.03µs -1.72%
Boolean Object Access (Parser) 13.7±0.01µs 14.2±0.05µs +3.65%
Clean js (Compiler) 3.3±0.01µs 3.3±0.01µs 0.00%
Clean js (Execution) 958.4±3.43µs 1079.7±8.28µs +12.66%
Clean js (Parser) 27.8±0.04µs 28.2±0.03µs +1.44%
Create Realm 265.0±3.09ns 279.3±3.14ns +5.40%
Dynamic Object Property Access (Compiler) 1574.0±2.72ns 1592.5±6.03ns +1.18%
Dynamic Object Property Access (Execution) 6.8±0.03µs 6.7±0.03µs -1.47%
Dynamic Object Property Access (Parser) 10.2±0.01µs 10.4±0.02µs +1.96%
Fibonacci (Compiler) 2.2±0.01µs 2.2±0.01µs 0.00%
Fibonacci (Execution) 1733.0±2.10µs 1757.0±2.83µs +1.38%
Fibonacci (Parser) 15.6±0.04µs 15.8±0.02µs +1.28%
For loop (Compiler) 1909.2±8.23ns 1924.7±7.79ns +0.81%
For loop (Execution) 42.2±0.07µs 41.9±0.11µs -0.71%
For loop (Parser) 13.3±0.03µs 13.5±0.04µs +1.50%
Mini js (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
Mini js (Execution) 877.8±5.41µs 994.3±9.39µs +13.27%
Mini js (Parser) 24.2±0.03µs 21.7±0.04µs -10.33%
Number Object Access (Compiler) 1034.7±1.91ns 912.3±6.08ns -11.83%
Number Object Access (Execution) 4.6±0.02µs 4.5±0.04µs -2.17%
Number Object Access (Parser) 10.7±0.05µs 11.0±0.01µs +2.80%
Object Creation (Compiler) 1347.8±3.93ns 1381.7±6.77ns +2.52%
Object Creation (Execution) 6.0±0.02µs 6.0±0.02µs 0.00%
Object Creation (Parser) 8.8±0.02µs 9.0±0.02µs +2.27%
RegExp (Compiler) 1566.6±4.08ns 1601.4±2.05ns +2.22%
RegExp (Execution) 12.4±0.04µs 11.1±0.08µs -10.48%
RegExp (Parser) 9.7±0.09µs 9.9±0.02µs +2.06%
RegExp Creation (Compiler) 1364.6±6.45ns 1382.1±3.80ns +1.28%
RegExp Creation (Execution) 9.4±0.03µs 9.5±0.04µs +1.06%
RegExp Creation (Parser) 8.1±0.02µs 8.3±0.01µs +2.47%
RegExp Literal (Compiler) 1575.0±2.82ns 1600.9±2.64ns +1.64%
RegExp Literal (Execution) 12.5±0.04µs 12.6±0.05µs +0.80%
RegExp Literal (Parser) 7.8±0.02µs 8.0±0.01µs +2.56%
RegExp Literal Creation (Compiler) 1378.9±6.04ns 1377.1±5.88ns -0.13%
RegExp Literal Creation (Execution) 9.4±0.04µs 9.5±0.04µs +1.06%
RegExp Literal Creation (Parser) 6.2±0.02µs 6.3±0.01µs +1.61%
Static Object Property Access (Compiler) 1355.3±3.08ns 1407.9±6.20ns +3.88%
Static Object Property Access (Execution) 6.3±0.03µs 6.3±0.02µs 0.00%
Static Object Property Access (Parser) 9.5±0.02µs 9.7±0.02µs +2.11%
String Object Access (Compiler) 1457.8±7.36ns 1461.5±7.99ns +0.25%
String Object Access (Execution) 7.7±0.03µs 7.5±0.02µs -2.60%
String Object Access (Parser) 13.5±0.01µs 13.9±0.01µs +2.96%
String comparison (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
String comparison (Execution) 5.8±0.01µs 5.7±0.01µs -1.72%
String comparison (Parser) 10.5±0.03µs 10.7±0.07µs +1.90%
String concatenation (Compiler) 1590.3±3.05ns 1631.3±8.50ns +2.58%
String concatenation (Execution) 5.3±0.02µs 5.2±0.02µs -1.89%
String concatenation (Parser) 7.2±0.01µs 7.5±0.02µs +4.17%
String copy (Compiler) 1280.0±2.94ns 1138.9±7.06ns -11.02%
String copy (Execution) 4.7±0.03µs 4.7±0.01µs 0.00%
String copy (Parser) 5.4±0.02µs 5.6±0.01µs +3.70%
Symbols (Compiler) 899.5±0.97ns 897.8±1.38ns -0.19%
Symbols (Execution) 4.5±0.01µs 4.4±0.01µs -2.22%
Symbols (Parser) 4.2±0.02µs 4.4±0.02µs +4.76%

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Benchmark for fea3e93

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 443.5±3.58ns 445.8±1.16ns +0.52%
Arithmetic operations (Execution) 1714.9±32.47ns 2.0±0.01µs +16.62%
Arithmetic operations (Parser) 4.6±0.02µs 5.2±0.01µs +13.04%
Array access (Compiler) 1258.8±2.45ns 1267.8±3.09ns +0.71%
Array access (Execution) 8.6±0.05µs 9.7±0.05µs +12.79%
Array access (Parser) 11.6±0.01µs 10.1±0.03µs -12.93%
Array creation (Compiler) 1815.0±4.58ns 1623.0±5.21ns -10.58%
Array creation (Execution) 2.8±0.02ms 3.1±0.01ms +10.71%
Array creation (Parser) 11.5±0.03µs 12.9±0.03µs +12.17%
Array pop (Compiler) 3.5±0.02µs 3.8±0.01µs +8.57%
Array pop (Execution) 1233.6±3.66µs 1196.6±12.84µs -3.00%
Array pop (Parser) 115.1±0.41µs 131.1±0.10µs +13.90%
Boolean Object Access (Compiler) 1098.5±3.24ns 977.1±6.31ns -11.05%
Boolean Object Access (Execution) 5.1±0.06µs 5.8±0.03µs +13.73%
Boolean Object Access (Parser) 12.5±0.05µs 13.8±0.01µs +10.40%
Clean js (Compiler) 3.0±0.01µs 3.0±0.01µs 0.00%
Clean js (Execution) 964.2±3.91µs 952.1±9.50µs -1.25%
Clean js (Parser) 24.6±0.22µs 28.0±0.03µs +13.82%
Create Realm 263.4±0.34ns 274.7±0.36ns +4.29%
Dynamic Object Property Access (Compiler) 1393.1±5.70ns 1409.7±7.52ns +1.19%
Dynamic Object Property Access (Execution) 6.0±0.03µs 5.9±0.02µs -1.67%
Dynamic Object Property Access (Parser) 9.1±0.02µs 10.3±0.01µs +13.19%
Fibonacci (Compiler) 1970.6±11.13ns 2.0±0.01µs +1.49%
Fibonacci (Execution) 1558.5±7.67µs 1549.4±4.75µs -0.58%
Fibonacci (Parser) 15.8±0.03µs 15.5±0.03µs -1.90%
For loop (Compiler) 1696.7±7.51ns 1967.8±5.28ns +15.98%
For loop (Execution) 37.1±0.30µs 36.8±0.21µs -0.81%
For loop (Parser) 13.4±0.02µs 13.3±0.02µs -0.75%
Mini js (Compiler) 2.9±0.01µs 3.2±0.01µs +10.34%
Mini js (Execution) 885.3±5.51µs 877.5±5.02µs -0.88%
Mini js (Parser) 21.6±0.12µs 24.5±0.03µs +13.43%
Number Object Access (Compiler) 1032.5±4.74ns 911.7±5.56ns -11.70%
Number Object Access (Execution) 4.6±0.02µs 3.9±0.02µs -15.22%
Number Object Access (Parser) 9.7±0.03µs 10.8±0.02µs +11.34%
Object Creation (Compiler) 1177.3±5.93ns 1197.8±5.23ns +1.74%
Object Creation (Execution) 5.3±0.02µs 6.0±0.02µs +13.21%
Object Creation (Parser) 9.0±0.02µs 7.8±0.03µs -13.33%
RegExp (Compiler) 1408.1±5.53ns 1615.7±9.00ns +14.74%
RegExp (Execution) 11.2±0.06µs 10.9±0.07µs -2.68%
RegExp (Parser) 9.9±0.02µs 9.7±0.02µs -2.02%
RegExp Creation (Compiler) 1201.3±4.40ns 1216.5±6.04ns +1.27%
RegExp Creation (Execution) 8.4±0.03µs 8.3±0.07µs -1.19%
RegExp Creation (Parser) 7.3±0.03µs 7.1±0.04µs -2.74%
RegExp Literal (Compiler) 1385.7±6.27ns 1406.3±6.04ns +1.49%
RegExp Literal (Execution) 12.7±0.04µs 11.0±0.10µs -13.39%
RegExp Literal (Parser) 7.0±0.01µs 7.0±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1218.1±9.57ns 1222.4±4.66ns +0.35%
RegExp Literal Creation (Execution) 8.4±0.04µs 8.2±0.03µs -2.38%
RegExp Literal Creation (Parser) 5.6±0.01µs 6.2±0.01µs +10.71%
Static Object Property Access (Compiler) 1203.6±7.91ns 1417.6±5.68ns +17.78%
Static Object Property Access (Execution) 5.5±0.03µs 6.3±0.02µs +14.55%
Static Object Property Access (Parser) 8.5±0.04µs 8.4±0.08µs -1.18%
String Object Access (Compiler) 1451.9±6.06ns 1460.3±5.73ns +0.58%
String Object Access (Execution) 6.5±0.06µs 7.5±0.03µs +15.38%
String Object Access (Parser) 12.2±0.04µs 11.9±0.08µs -2.46%
String comparison (Compiler) 1810.7±10.68ns 2.1±0.01µs +15.98%
String comparison (Execution) 5.1±0.03µs 5.8±0.01µs +13.73%
String comparison (Parser) 10.6±0.01µs 9.3±0.02µs -12.26%
String concatenation (Compiler) 1422.5±11.09ns 1615.8±5.25ns +13.59%
String concatenation (Execution) 4.6±0.03µs 4.5±0.02µs -2.17%
String concatenation (Parser) 7.3±0.02µs 6.4±0.03µs -12.33%
String copy (Compiler) 1264.7±3.33ns 1274.6±3.57ns +0.78%
String copy (Execution) 4.1±0.01µs 4.6±0.01µs +12.20%
String copy (Parser) 4.8±0.03µs 4.8±0.01µs 0.00%
Symbols (Compiler) 803.9±2.19ns 924.4±4.43ns +14.99%
Symbols (Execution) 4.0±0.04µs 4.4±0.01µs +10.00%
Symbols (Parser) 4.3±0.02µs 4.3±0.01µs 0.00%

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!

check my comment on how we might improve this :)

boa_engine/Cargo.toml Show resolved Hide resolved
boa_engine/src/context/intrinsics.rs Outdated Show resolved Hide resolved
boa_engine/src/value/conversions.rs Show resolved Hide resolved
@HalidOdat HalidOdat self-requested a review March 4, 2022 14:15
@jedel1043 jedel1043 force-pushed the intrinsics-rewrite branch from 8030e2a to 900a14d Compare March 4, 2022 22:48
@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Benchmark for dae0362

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 509.6±1.80ns 511.2±2.03ns +0.31%
Arithmetic operations (Execution) 1990.8±3.69ns 1987.4±3.38ns -0.17%
Arithmetic operations (Parser) 5.2±0.02µs 5.2±0.01µs 0.00%
Array access (Compiler) 1268.2±2.55ns 1270.0±1.76ns +0.14%
Array access (Execution) 9.6±0.04µs 9.7±0.05µs +1.04%
Array access (Parser) 11.7±0.02µs 11.7±0.01µs 0.00%
Array creation (Compiler) 1810.6±4.76ns 1805.8±7.53ns -0.27%
Array creation (Execution) 3.0±0.00ms 3.1±0.00ms +3.33%
Array creation (Parser) 13.1±0.02µs 13.1±0.02µs 0.00%
Array pop (Compiler) 3.9±0.00µs 3.9±0.03µs 0.00%
Array pop (Execution) 1311.8±7.05µs 1350.0±8.47µs +2.91%
Array pop (Parser) 130.4±0.09µs 130.7±0.12µs +0.23%
Boolean Object Access (Compiler) 1100.5±31.42ns 1103.1±3.44ns +0.24%
Boolean Object Access (Execution) 5.8±0.02µs 5.7±0.02µs -1.72%
Boolean Object Access (Parser) 14.4±0.03µs 14.2±0.01µs -1.39%
Clean js (Compiler) 3.3±0.01µs 3.4±0.01µs +3.03%
Clean js (Execution) 1078.9±8.82µs 1092.7±6.65µs +1.28%
Clean js (Parser) 28.3±0.04µs 28.3±0.03µs 0.00%
Create Realm 281.1±3.17ns 317.6±3.08ns +12.98%
Dynamic Object Property Access (Compiler) 1671.3±9.72ns 1598.9±3.27ns -4.33%
Dynamic Object Property Access (Execution) 6.8±0.04µs 6.7±0.03µs -1.47%
Dynamic Object Property Access (Parser) 10.4±0.01µs 10.3±0.01µs -0.96%
Fibonacci (Compiler) 2.2±0.01µs 2.3±0.01µs +4.55%
Fibonacci (Execution) 1745.7±4.30µs 1746.0±6.42µs +0.02%
Fibonacci (Parser) 15.9±0.02µs 16.0±0.03µs +0.63%
For loop (Compiler) 1953.8±3.31ns 1933.5±5.61ns -1.04%
For loop (Execution) 42.3±0.19µs 42.4±0.18µs +0.24%
For loop (Parser) 13.6±0.03µs 13.6±0.01µs 0.00%
Mini js (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
Mini js (Execution) 991.5±4.46µs 1000.4±9.01µs +0.90%
Mini js (Parser) 24.7±0.06µs 24.6±0.04µs -0.40%
Number Object Access (Compiler) 1034.5±2.79ns 1028.4±4.73ns -0.59%
Number Object Access (Execution) 4.5±0.02µs 4.5±0.01µs 0.00%
Number Object Access (Parser) 11.1±0.02µs 11.2±0.01µs +0.90%
Object Creation (Compiler) 1421.1±23.22ns 1385.4±6.09ns -2.51%
Object Creation (Execution) 6.1±0.03µs 6.0±0.02µs -1.64%
Object Creation (Parser) 9.0±0.01µs 9.0±0.01µs 0.00%
RegExp (Compiler) 1668.1±10.33ns 1619.5±9.55ns -2.91%
RegExp (Execution) 12.1±0.09µs 12.6±0.06µs +4.13%
RegExp (Parser) 10.0±0.03µs 10.0±0.02µs 0.00%
RegExp Creation (Compiler) 1392.4±6.25ns 1398.3±9.82ns +0.42%
RegExp Creation (Execution) 8.9±0.03µs 9.4±0.04µs +5.62%
RegExp Creation (Parser) 8.3±0.02µs 8.3±0.02µs 0.00%
RegExp Literal (Compiler) 1669.9±13.63ns 1636.5±8.83ns -2.00%
RegExp Literal (Execution) 12.0±0.08µs 12.5±0.04µs +4.17%
RegExp Literal (Parser) 8.0±0.02µs 8.1±0.05µs +1.25%
RegExp Literal Creation (Compiler) 1383.2±5.66ns 1376.1±5.88ns -0.51%
RegExp Literal Creation (Execution) 9.0±0.03µs 9.4±0.03µs +4.44%
RegExp Literal Creation (Parser) 6.3±0.02µs 6.3±0.01µs 0.00%
Static Object Property Access (Compiler) 1441.5±5.88ns 1402.8±5.62ns -2.68%
Static Object Property Access (Execution) 6.4±0.02µs 6.3±0.02µs -1.56%
Static Object Property Access (Parser) 9.7±0.05µs 9.7±0.01µs 0.00%
String Object Access (Compiler) 1467.7±5.42ns 1454.0±7.07ns -0.93%
String Object Access (Execution) 7.4±0.03µs 7.5±0.05µs +1.35%
String Object Access (Parser) 13.9±0.03µs 14.0±0.09µs +0.72%
String comparison (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
String comparison (Execution) 5.8±0.06µs 5.7±0.06µs -1.72%
String comparison (Parser) 10.7±0.02µs 10.7±0.01µs 0.00%
String concatenation (Compiler) 1599.6±1.82ns 1605.8±1.41ns +0.39%
String concatenation (Execution) 5.2±0.02µs 5.2±0.01µs 0.00%
String concatenation (Parser) 7.3±0.01µs 7.4±0.02µs +1.37%
String copy (Compiler) 1284.7±2.25ns 1291.0±2.73ns +0.49%
String copy (Execution) 4.7±0.02µs 4.6±0.02µs -2.13%
String copy (Parser) 5.5±0.02µs 5.5±0.03µs 0.00%
Symbols (Compiler) 902.2±4.52ns 921.0±3.47ns +2.08%
Symbols (Execution) 4.4±0.01µs 4.4±0.01µs 0.00%
Symbols (Parser) 4.2±0.01µs 4.3±0.01µs +2.38%

@jedel1043
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Mar 4, 2022
Building up to #186, this PR extracts an `Intrinsics` struct from `Context`, facilitating a lot the extraction of a `Realm` struct.
Also, it adapts the `BuiltIn` trait to be useful for builtins that don't expose a global property on initialization (`Generator`, `TypedArray`, etc.)

It changes the following:

- Creates an `Intrinsics` struct and refactors `Context` to transfer its intrinsic related fields to `Intrinsics`.
- Renames some methods and parameters to better describe their functionality.
- Makes `BuiltIn::init` return `Option<JsValue>` to skip global property initialization if the builtin initialization returns `None`
@bors
Copy link

bors bot commented Mar 5, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Extract Intrinsics struct from Context and cleanup names [Merged by Bors] - Extract Intrinsics struct from Context and cleanup names Mar 5, 2022
@bors bors bot closed this Mar 5, 2022
@bors bors bot deleted the intrinsics-rewrite branch March 5, 2022 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics Internal Category for changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants