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

Implement Array.of #1116

Closed
wants to merge 1 commit into from
Closed

Implement Array.of #1116

wants to merge 1 commit into from

Conversation

camc
Copy link
Contributor

@camc camc commented Feb 4, 2021

This Pull Request checks off part of #36.

It changes the following:

  • Adds Array.of static method
  • Adds Array.of tests

@github-actions
Copy link

github-actions bot commented Feb 4, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,497 78,497 0
Passed 24,986 24,997 +11
Ignored 15,587 15,587 0
Failed 37,924 37,913 -11
Panics 16 17 +1
Conformance 31.83 31.84 +0.01%

@codecov
Copy link

codecov bot commented Feb 4, 2021

Codecov Report

Merging #1116 (39c909e) into master (9b1264f) will increase coverage by 0.00%.
The diff coverage is 63.63%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1116   +/-   ##
=======================================
  Coverage   58.64%   58.64%           
=======================================
  Files         176      176           
  Lines       12523    12534   +11     
=======================================
+ Hits         7344     7351    +7     
- Misses       5179     5183    +4     
Impacted Files Coverage Δ
boa/src/builtins/array/mod.rs 76.25% <63.63%> (-0.26%) ⬇️

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 9b1264f...39c909e. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Feb 4, 2021

Benchmark for 4442fb3

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 362.6±4.74ns 362.8±1.11ns -0.06%
Arithmetic operations (Full) 235.5±2.44µs 236.0±0.42µs -0.21%
Array access (Execution) 6.2±0.04µs 6.3±0.07µs -1.59%
Array access (Full) 260.6±2.29µs 256.6±1.39µs +1.56%
Array creation (Execution) 2.9±0.02ms 2.9±0.03ms 0.00%
Array creation (Full) 3.2±0.03ms 3.3±0.02ms -3.03%
Array pop (Execution) 933.9±7.14µs 941.2±18.77µs -0.78%
Array pop (Full) 1432.2±13.81µs 1427.1±8.40µs +0.36%
Boolean Object Access (Execution) 5.3±0.04µs 5.2±0.02µs +1.92%
Boolean Object Access (Full) 253.8±1.73µs 254.6±1.07µs -0.31%
Clean js (Execution) 673.1±11.22µs 683.7±3.38µs -1.55%
Clean js (Full) 992.0±17.66µs 992.9±10.54µs -0.09%
Clean js (Parser) 40.6±0.31µs 40.5±0.18µs +0.25%
Create Realm 451.7±6.34ns 454.2±5.56ns -0.55%
Dynamic Object Property Access (Execution) 5.1±0.05µs 5.1±0.04µs 0.00%
Dynamic Object Property Access (Full) 254.8±2.21µs 251.7±1.55µs +1.23%
Expression (Parser) 6.8±0.09µs 6.9±0.02µs -1.45%
Fibonacci (Execution) 849.7±4.95µs 837.1±6.04µs +1.51%
Fibonacci (Full) 1127.7±14.20µs 1136.4±3.46µs -0.77%
For loop (Execution) 23.1±0.13µs 22.7±0.18µs +1.76%
For loop (Full) 281.5±2.67µs 276.4±0.90µs +1.85%
For loop (Parser) 19.1±0.12µs 19.1±0.17µs 0.00%
Goal Symbols (Parser) 13.5±0.15µs 13.6±0.08µs -0.74%
Hello World (Parser) 3.6±0.03µs 3.6±0.01µs 0.00%
Long file (Parser) 799.9±6.59ns 796.8±1.42ns +0.39%
Mini js (Execution) 604.0±7.14µs 610.8±3.87µs -1.11%
Mini js (Full) 908.4±9.36µs 895.6±3.73µs +1.43%
Mini js (Parser) 35.8±0.28µs 35.6±0.31µs +0.56%
Number Object Access (Execution) 4.2±0.03µs 4.0±0.02µs +5.00%
Number Object Access (Full) 251.3±0.55µs 247.3±0.51µs +1.62%
Object Creation (Execution) 4.3±0.02µs 4.3±0.05µs 0.00%
Object Creation (Full) 248.9±3.90µs 247.2±1.69µs +0.69%
RegExp (Execution) 9.7±0.10µs 9.6±0.06µs +1.04%
RegExp (Full) 258.3±2.79µs 257.3±0.37µs +0.39%
RegExp Literal (Execution) 11.1±0.16µs 10.9±0.07µs +1.83%
RegExp Literal (Full) 261.0±2.71µs 259.2±0.34µs +0.69%
RegExp Literal Creation (Execution) 9.7±0.07µs 9.5±0.08µs +2.11%
RegExp Literal Creation (Full) 258.0±2.72µs 252.1±1.35µs +2.34%
Static Object Property Access (Execution) 4.6±0.04µs 4.6±0.04µs 0.00%
Static Object Property Access (Full) 250.8±2.66µs 248.8±2.28µs +0.80%
String Object Access (Execution) 7.3±0.15µs 7.0±0.03µs +4.29%
String Object Access (Full) 254.5±2.82µs 255.0±0.89µs -0.20%
String comparison (Execution) 6.5±0.06µs 6.6±0.03µs -1.52%
String comparison (Full) 254.8±2.29µs 254.2±0.60µs +0.24%
String concatenation (Execution) 5.3±0.08µs 5.3±0.02µs 0.00%
String concatenation (Full) 247.7±2.17µs 248.6±0.55µs -0.36%
String copy (Execution) 4.0±0.02µs 4.0±0.01µs 0.00%
String copy (Full) 244.7±1.39µs 240.9±0.81µs +1.58%
Symbols (Execution) 3.4±0.04µs 3.4±0.01µs 0.00%
Symbols (Full) 237.9±1.85µs 237.5±0.81µs +0.17%

@RageKnify RageKnify added the builtins PRs and Issues related to builtins/intrinsics label Feb 7, 2021
@RageKnify RageKnify added this to the v0.12.0 milestone Feb 7, 2021
Copy link
Contributor

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

Current implementation is not spec compliant, we should be able to use other constructors.
Try to follow the spec and add a comment before each step identifying it. (Some steps can be ignored, for example 6 isn't important, you should instead iterate with args.iter().enumerate()).
If you need any help you can write here in the PR or talk in the Discord.

An ugly example that can be added as a test.

let a = Array.of.call(Date, "a", undefined, 3);
// check all of the following values
a instanceof Date  // true
a[0]  // "a"
a[1]  // undefined
a[2]  // 3

@camc camc closed this Feb 13, 2021
@RageKnify RageKnify removed this from the v0.12.0 milestone May 31, 2021
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants