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 Number.parseInt and Number.parseFloat #1894

Closed
wants to merge 1 commit into from

Conversation

HalidOdat
Copy link
Member

This PR add Number.parseInt and Number.parseFloat which according to spec are clones of the global objects parseInt and parseFloat.

It also fixes the last failing test of the NativeError feature with this we get 100% spec complaint NativeErrors 🎉

It changes the following:

  • Add Number.parseInt()
  • Add Number.parseFloat()
  • Fix length of AggregateError
  • Fix length of Reflect.setPrototypeOf

@HalidOdat HalidOdat added bug Something isn't working enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics labels Mar 4, 2022
@HalidOdat HalidOdat added this to the v0.14.0 milestone Mar 4, 2022
@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 88,342 88,342 0
Passed 43,283 43,291 +8
Ignored 21,413 21,413 0
Failed 23,646 23,638 -8
Panics 0 0 0
Conformance 48.99% 49.00% +0.01%
Fixed tests (8):
test/built-ins/NativeErrors/AggregateError/length.js [strict mode] (previously Failed)
test/built-ins/NativeErrors/AggregateError/length.js (previously Failed)
test/built-ins/Reflect/setPrototypeOf/length.js [strict mode] (previously Failed)
test/built-ins/Reflect/setPrototypeOf/length.js (previously Failed)
test/built-ins/Number/parseFloat.js [strict mode] (previously Failed)
test/built-ins/Number/parseFloat.js (previously Failed)
test/built-ins/Number/parseInt.js [strict mode] (previously Failed)
test/built-ins/Number/parseInt.js (previously Failed)

@codecov
Copy link

codecov bot commented Mar 4, 2022

Codecov Report

Merging #1894 (a611fdd) into main (3ec6f63) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1894   +/-   ##
=======================================
  Coverage   46.57%   46.58%           
=======================================
  Files         206      206           
  Lines       16776    16781    +5     
=======================================
+ Hits         7814     7818    +4     
- Misses       8962     8963    +1     
Impacted Files Coverage Δ
boa_engine/src/builtins/error/aggregate.rs 42.10% <ø> (ø)
boa_engine/src/builtins/reflect/mod.rs 80.24% <ø> (ø)
boa_engine/src/builtins/number/mod.rs 76.31% <100.00%> (+0.36%) ⬆️
boa_engine/src/builtins/generator_function/mod.rs 76.19% <0.00%> (-4.77%) ⬇️
...ine/src/syntax/parser/cursor/buffered_lexer/mod.rs 64.86% <0.00%> (-2.71%) ⬇️
boa_engine/src/builtins/symbol/mod.rs 58.33% <0.00%> (-0.83%) ⬇️
boa_engine/src/syntax/parser/cursor/mod.rs 44.26% <0.00%> (ø)
...engine/src/syntax/parser/expression/primary/mod.rs 37.50% <0.00%> (+3.12%) ⬆️

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 3ec6f63...a611fdd. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Benchmark for 8034847

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 501.2±0.46ns 509.5±1.45ns +1.66%
Arithmetic operations (Execution) 1947.6±2.77ns 1977.3±4.24ns +1.52%
Arithmetic operations (Parser) 5.2±0.02µs 5.3±0.00µs +1.92%
Array access (Compiler) 1292.5±2.13ns 1275.7±2.56ns -1.30%
Array access (Execution) 9.9±0.05µs 9.8±0.05µs -1.01%
Array access (Parser) 11.6±0.02µs 11.7±0.01µs +0.86%
Array creation (Compiler) 1859.7±3.44ns 1864.6±3.47ns +0.26%
Array creation (Execution) 3.0±0.00ms 3.0±0.00ms 0.00%
Array creation (Parser) 13.1±0.02µs 13.2±0.03µs +0.76%
Array pop (Compiler) 3.9±0.01µs 4.0±0.01µs +2.56%
Array pop (Execution) 1306.5±6.52µs 1313.6±5.82µs +0.54%
Array pop (Parser) 129.0±0.08µs 130.8±0.11µs +1.40%
Boolean Object Access (Compiler) 1093.0±3.53ns 1096.5±2.90ns +0.32%
Boolean Object Access (Execution) 6.1±0.05µs 6.1±0.04µs 0.00%
Boolean Object Access (Parser) 14.2±0.05µs 14.4±0.05µs +1.41%
Clean js (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Clean js (Execution) 1082.2±6.65µs 1082.1±6.38µs -0.01%
Clean js (Parser) 28.3±0.05µs 28.4±0.03µs +0.35%
Create Realm 271.9±2.94ns 275.6±0.58ns +1.36%
Dynamic Object Property Access (Compiler) 1689.6±6.11ns 1641.6±13.05ns -2.84%
Dynamic Object Property Access (Execution) 6.9±0.04µs 6.8±0.05µs -1.45%
Dynamic Object Property Access (Parser) 10.3±0.02µs 10.4±0.02µs +0.97%
Fibonacci (Compiler) 2.3±0.00µs 2.3±0.00µs 0.00%
Fibonacci (Execution) 1780.9±4.15µs 1744.8±8.90µs -2.03%
Fibonacci (Parser) 15.9±0.03µs 16.0±0.02µs +0.63%
For loop (Compiler) 1964.1±3.59ns 1973.0±9.77ns +0.45%
For loop (Execution) 42.4±0.10µs 42.1±0.07µs -0.71%
For loop (Parser) 13.5±0.01µs 13.6±0.11µs +0.74%
Mini js (Compiler) 3.3±0.01µs 3.3±0.01µs 0.00%
Mini js (Execution) 990.6±6.56µs 996.9±6.36µs +0.64%
Mini js (Parser) 24.8±0.04µs 24.8±0.05µs 0.00%
Number Object Access (Compiler) 1024.5±2.82ns 1029.4±3.47ns +0.48%
Number Object Access (Execution) 4.7±0.05µs 4.6±0.02µs -2.13%
Number Object Access (Parser) 11.1±0.01µs 11.1±0.01µs 0.00%
Object Creation (Compiler) 1479.4±10.70ns 1421.1±13.62ns -3.94%
Object Creation (Execution) 6.3±0.08µs 6.1±0.02µs -3.17%
Object Creation (Parser) 9.0±0.01µs 9.0±0.06µs 0.00%
RegExp (Compiler) 1692.4±6.42ns 1664.7±16.80ns -1.64%
RegExp (Execution) 12.8±0.04µs 12.2±0.06µs -4.69%
RegExp (Parser) 9.9±0.02µs 9.9±0.02µs 0.00%
RegExp Creation (Compiler) 1434.1±6.29ns 1420.3±7.82ns -0.96%
RegExp Creation (Execution) 9.5±0.04µs 9.0±0.04µs -5.26%
RegExp Creation (Parser) 8.4±0.01µs 8.3±0.02µs -1.19%
RegExp Literal (Compiler) 1696.1±10.05ns 1657.2±19.73ns -2.29%
RegExp Literal (Execution) 12.8±0.04µs 12.1±0.07µs -5.47%
RegExp Literal (Parser) 8.0±0.01µs 8.0±0.01µs 0.00%
RegExp Literal Creation (Compiler) 1421.8±48.35ns 1389.3±5.85ns -2.29%
RegExp Literal Creation (Execution) 9.5±0.04µs 9.0±0.03µs -5.26%
RegExp Literal Creation (Parser) 6.4±0.01µs 6.3±0.03µs -1.56%
Static Object Property Access (Compiler) 1496.9±8.15ns 1424.9±13.68ns -4.81%
Static Object Property Access (Execution) 6.5±0.04µs 6.4±0.02µs -1.54%
Static Object Property Access (Parser) 9.7±0.01µs 9.7±0.02µs 0.00%
String Object Access (Compiler) 1482.6±7.58ns 1448.4±6.07ns -2.31%
String Object Access (Execution) 7.7±0.02µs 7.7±0.04µs 0.00%
String Object Access (Parser) 13.9±0.06µs 14.1±0.04µs +1.44%
String comparison (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
String comparison (Execution) 6.0±0.03µs 5.9±0.02µs -1.67%
String comparison (Parser) 10.7±0.02µs 10.8±0.01µs +0.93%
String concatenation (Compiler) 1641.4±4.91ns 1655.0±4.14ns +0.83%
String concatenation (Execution) 5.3±0.01µs 5.3±0.02µs 0.00%
String concatenation (Parser) 7.3±0.01µs 7.4±0.01µs +1.37%
String copy (Compiler) 1334.3±2.57ns 1300.7±2.70ns -2.52%
String copy (Execution) 4.8±0.02µs 4.7±0.02µs -2.08%
String copy (Parser) 5.5±0.01µs 5.6±0.01µs +1.82%
Symbols (Compiler) 910.6±3.46ns 921.7±3.24ns +1.22%
Symbols (Execution) 4.6±0.03µs 4.4±0.01µs -4.35%
Symbols (Parser) 4.2±0.01µs 4.3±0.01µs +2.38%

- Fix length of `AggregateError()`
- Fix length of `Reflect.setPrototypeOf()`
@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Benchmark for 857fb98

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 503.1±1.27ns 499.5±1.33ns -0.72%
Arithmetic operations (Execution) 1972.9±12.70ns 1937.3±2.26ns -1.80%
Arithmetic operations (Parser) 5.2±0.02µs 5.3±0.01µs +1.92%
Array access (Compiler) 1251.5±2.77ns 1264.4±2.79ns +1.03%
Array access (Execution) 9.8±0.06µs 9.7±0.04µs -1.02%
Array access (Parser) 11.7±0.02µs 11.7±0.02µs 0.00%
Array creation (Compiler) 1785.2±7.60ns 1824.5±24.55ns +2.20%
Array creation (Execution) 3.0±0.00ms 3.0±0.00ms 0.00%
Array creation (Parser) 13.1±0.03µs 13.2±0.02µs +0.76%
Array pop (Compiler) 3.9±0.01µs 3.9±0.01µs 0.00%
Array pop (Execution) 1308.6±6.02µs 1306.2±8.30µs -0.18%
Array pop (Parser) 129.4±1.20µs 130.8±0.10µs +1.08%
Boolean Object Access (Compiler) 1096.8±2.92ns 1087.5±45.27ns -0.85%
Boolean Object Access (Execution) 6.0±0.06µs 5.8±0.02µs -3.33%
Boolean Object Access (Parser) 14.3±0.05µs 14.4±0.04µs +0.70%
Clean js (Compiler) 3.3±0.01µs 3.3±0.01µs 0.00%
Clean js (Execution) 1085.3±7.15µs 1079.7±9.35µs -0.52%
Clean js (Parser) 28.5±0.05µs 28.4±0.08µs -0.35%
Create Realm 276.4±3.42ns 272.7±10.75ns -1.34%
Dynamic Object Property Access (Compiler) 1619.9±12.54ns 1615.2±14.70ns -0.29%
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.03µs 10.3±0.01µs -0.96%
Fibonacci (Compiler) 2.2±0.04µs 2.3±0.01µs +4.55%
Fibonacci (Execution) 1738.5±3.58µs 1732.3±3.50µs -0.36%
Fibonacci (Parser) 16.0±0.03µs 15.9±0.02µs -0.62%
For loop (Compiler) 1934.5±3.74ns 1956.1±3.90ns +1.12%
For loop (Execution) 42.2±0.14µs 42.1±0.07µs -0.24%
For loop (Parser) 13.6±0.02µs 13.5±0.02µs -0.74%
Mini js (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
Mini js (Execution) 998.7±5.06µs 991.4±5.96µs -0.73%
Mini js (Parser) 25.0±0.04µs 24.9±0.05µs -0.40%
Number Object Access (Compiler) 1022.0±2.34ns 1021.8±1.96ns -0.02%
Number Object Access (Execution) 4.7±0.03µs 4.5±0.01µs -4.26%
Number Object Access (Parser) 11.1±0.02µs 11.2±0.01µs +0.90%
Object Creation (Compiler) 1405.3±6.35ns 1425.0±16.21ns +1.40%
Object Creation (Execution) 6.1±0.02µs 6.1±0.04µs 0.00%
Object Creation (Parser) 9.0±0.02µs 9.0±0.02µs 0.00%
RegExp (Compiler) 1617.0±11.94ns 1639.6±17.88ns +1.40%
RegExp (Execution) 12.6±0.04µs 12.5±0.04µs -0.79%
RegExp (Parser) 10.0±0.02µs 10.0±0.06µs 0.00%
RegExp Creation (Compiler) 1392.3±3.63ns 1369.3±4.96ns -1.65%
RegExp Creation (Execution) 9.3±0.04µs 9.5±0.04µs +2.15%
RegExp Creation (Parser) 8.4±0.01µs 8.3±0.02µs -1.19%
RegExp Literal (Compiler) 1625.2±11.75ns 1629.9±15.51ns +0.29%
RegExp Literal (Execution) 12.6±0.04µs 12.6±0.04µs 0.00%
RegExp Literal (Parser) 8.0±0.01µs 8.0±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1391.4±4.79ns 1375.1±8.39ns -1.17%
RegExp Literal Creation (Execution) 9.3±0.04µs 9.4±0.03µs +1.08%
RegExp Literal Creation (Parser) 6.4±0.02µs 6.4±0.02µs 0.00%
Static Object Property Access (Compiler) 1417.6±6.19ns 1426.6±15.83ns +0.63%
Static Object Property Access (Execution) 6.4±0.02µs 6.3±0.07µs -1.56%
Static Object Property Access (Parser) 9.8±0.04µs 9.7±0.02µs -1.02%
String Object Access (Compiler) 1425.2±8.53ns 1429.6±10.45ns +0.31%
String Object Access (Execution) 7.6±0.04µs 7.5±0.05µs -1.32%
String Object Access (Parser) 14.0±0.03µs 13.9±0.02µs -0.71%
String comparison (Compiler) 2.1±0.00µs 2.1±0.01µs 0.00%
String comparison (Execution) 5.8±0.02µs 5.9±0.06µs +1.72%
String comparison (Parser) 10.7±0.03µs 10.8±0.01µs +0.93%
String concatenation (Compiler) 1606.9±2.87ns 1593.2±2.45ns -0.85%
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) 1273.9±2.60ns 1283.5±2.10ns +0.75%
String copy (Execution) 4.6±0.01µs 4.7±0.02µs +2.17%
String copy (Parser) 5.5±0.01µs 5.5±0.03µs 0.00%
Symbols (Compiler) 905.2±4.40ns 893.9±0.98ns -1.25%
Symbols (Execution) 4.4±0.01µs 4.4±0.01µs 0.00%
Symbols (Parser) 4.3±0.01µs 4.3±0.02µs 0.00%

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Benchmark for 8d4ae8f

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 691.0±24.24ns 651.2±18.09ns -5.76%
Arithmetic operations (Execution) 2.5±0.12µs 2.4±0.08µs -4.00%
Arithmetic operations (Parser) 6.4±0.24µs 6.5±0.31µs +1.56%
Array access (Compiler) 1702.5±53.46ns 1682.0±48.06ns -1.20%
Array access (Execution) 12.7±0.40µs 12.4±0.46µs -2.36%
Array access (Parser) 14.2±0.48µs 14.2±0.57µs 0.00%
Array creation (Compiler) 2.4±0.09µs 2.4±0.13µs 0.00%
Array creation (Execution) 3.7±0.09ms 3.6±0.10ms -2.70%
Array creation (Parser) 15.6±0.38µs 16.0±0.60µs +2.56%
Array pop (Compiler) 4.7±0.16µs 4.6±0.15µs -2.13%
Array pop (Execution) 1577.1±57.00µs 1562.6±40.57µs -0.92%
Array pop (Parser) 166.3±5.64µs 167.2±5.39µs +0.54%
Boolean Object Access (Compiler) 1430.8±107.41ns 1386.7±30.79ns -3.08%
Boolean Object Access (Execution) 7.3±0.31µs 7.3±0.24µs 0.00%
Boolean Object Access (Parser) 16.9±0.68µs 17.1±0.67µs +1.18%
Clean js (Compiler) 4.5±0.09µs 4.4±0.12µs -2.22%
Clean js (Execution) 1343.4±62.69µs 1321.3±32.98µs -1.65%
Clean js (Parser) 34.4±1.07µs 34.8±1.17µs +1.16%
Create Realm 338.4±9.88ns 338.9±11.40ns +0.15%
Dynamic Object Property Access (Compiler) 2.2±0.06µs 2.2±0.06µs 0.00%
Dynamic Object Property Access (Execution) 8.7±0.31µs 8.9±0.45µs +2.30%
Dynamic Object Property Access (Parser) 12.4±0.33µs 12.6±0.35µs +1.61%
Fibonacci (Compiler) 3.0±0.16µs 3.0±0.14µs 0.00%
Fibonacci (Execution) 2.3±0.05ms 2.3±0.05ms 0.00%
Fibonacci (Parser) 19.0±0.61µs 19.4±0.64µs +2.11%
For loop (Compiler) 2.6±0.12µs 2.7±0.17µs +3.85%
For loop (Execution) 53.1±2.53µs 52.0±2.39µs -2.07%
For loop (Parser) 16.4±0.62µs 16.3±0.39µs -0.61%
Mini js (Compiler) 4.3±0.23µs 4.3±0.20µs 0.00%
Mini js (Execution) 1207.0±47.10µs 1206.1±63.05µs -0.07%
Mini js (Parser) 30.0±0.95µs 30.2±1.46µs +0.67%
Number Object Access (Compiler) 1348.6±35.81ns 1347.7±51.95ns -0.07%
Number Object Access (Execution) 5.7±0.17µs 5.6±0.13µs -1.75%
Number Object Access (Parser) 13.1±0.45µs 13.2±0.35µs +0.76%
Object Creation (Compiler) 1919.1±60.49ns 1918.0±60.61ns -0.06%
Object Creation (Execution) 8.0±0.35µs 8.2±0.25µs +2.50%
Object Creation (Parser) 10.8±0.50µs 11.0±0.39µs +1.85%
RegExp (Compiler) 2.2±0.04µs 2.2±0.35µs 0.00%
RegExp (Execution) 16.0±0.41µs 16.5±0.67µs +3.13%
RegExp (Parser) 11.8±0.30µs 11.9±0.32µs +0.85%
RegExp Creation (Compiler) 1849.5±66.93ns 1902.5±71.61ns +2.87%
RegExp Creation (Execution) 11.5±0.54µs 11.9±0.45µs +3.48%
RegExp Creation (Parser) 9.9±0.25µs 9.9±0.22µs 0.00%
RegExp Literal (Compiler) 2.2±0.05µs 2.2±0.09µs 0.00%
RegExp Literal (Execution) 16.0±0.56µs 16.0±0.77µs 0.00%
RegExp Literal (Parser) 9.6±0.24µs 9.7±0.33µs +1.04%
RegExp Literal Creation (Compiler) 1856.4±103.01ns 1914.1±43.13ns +3.11%
RegExp Literal Creation (Execution) 11.7±0.45µs 11.8±0.39µs +0.85%
RegExp Literal Creation (Parser) 7.5±0.50µs 7.6±0.22µs +1.33%
Static Object Property Access (Compiler) 1922.6±70.41ns 1951.2±102.87ns +1.49%
Static Object Property Access (Execution) 8.2±0.83µs 8.7±0.34µs +6.10%
Static Object Property Access (Parser) 11.6±0.32µs 11.8±0.53µs +1.72%
String Object Access (Compiler) 1910.2±63.88ns 1913.7±93.33ns +0.18%
String Object Access (Execution) 9.4±0.30µs 9.7±0.35µs +3.19%
String Object Access (Parser) 16.6±1.28µs 16.4±0.56µs -1.20%
String comparison (Compiler) 2.8±0.08µs 2.8±0.12µs 0.00%
String comparison (Execution) 7.3±0.30µs 7.6±0.23µs +4.11%
String comparison (Parser) 13.0±0.44µs 13.2±1.02µs +1.54%
String concatenation (Compiler) 2.2±0.07µs 2.2±0.07µs 0.00%
String concatenation (Execution) 6.7±0.22µs 6.9±0.38µs +2.99%
String concatenation (Parser) 8.9±0.32µs 8.9±0.38µs 0.00%
String copy (Compiler) 1760.9±60.17ns 1780.4±68.75ns +1.11%
String copy (Execution) 6.1±0.24µs 6.2±0.22µs +1.64%
String copy (Parser) 6.6±0.17µs 6.7±0.54µs +1.52%
Symbols (Compiler) 1230.5±29.38ns 1218.0±38.77ns -1.02%
Symbols (Execution) 5.9±0.22µs 5.9±0.20µs 0.00%
Symbols (Parser) 5.1±0.14µs 5.1±0.13µs 0.00%

@jedel1043
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Mar 4, 2022
This PR add `Number.parseInt` and `Number.parseFloat` which according to spec are clones of the global objects `parseInt` and `parseFloat`.

It also fixes the last failing test of  the `NativeError` feature with this we get 100% spec complaint `NativeError`s 🎉 

It changes the following:
- Add `Number.parseInt()`
- Add `Number.parseFloat()`
- Fix length of `AggregateError`
- Fix length of `Reflect.setPrototypeOf`
@bors
Copy link

bors bot commented Mar 4, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Implement Number.parseInt and Number.parseFloat [Merged by Bors] - Implement Number.parseInt and Number.parseFloat Mar 4, 2022
@bors bors bot closed this Mar 4, 2022
@bors bors bot deleted the fix/global-parse-functions branch March 4, 2022 17:36
@Razican Razican removed the bug Something isn't working label Mar 14, 2022
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants