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 Object.assign( target, ...sources ) #1235

Merged
merged 2 commits into from May 11, 2021
Merged

Conversation

HalidOdat
Copy link
Member

No description provided.

@HalidOdat HalidOdat added enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics labels May 8, 2021
@HalidOdat HalidOdat added this to the v0.12.0 milestone May 8, 2021
@HalidOdat HalidOdat changed the title Implement Object.assign( target, ...source ) Implement Object.assign( target, ...source ) May 8, 2021
@github-actions
Copy link

github-actions bot commented May 8, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,497 78,497 0
Passed 25,529 25,555 +26
Ignored 15,587 15,587 0
Failed 37,381 37,355 -26
Panics 14 13 -1
Conformance 32.52 32.56 +0.03%

@github-actions
Copy link

github-actions bot commented May 8, 2021

Benchmark for 33dcee8

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 365.0±28.07ns 387.7±18.48ns -5.86%
Arithmetic operations (Full) 270.2±13.92µs 275.9±20.69µs -2.07%
Array access (Execution) 7.2±0.37µs 6.9±0.33µs +4.35%
Array access (Full) 298.6±19.65µs 305.4±19.85µs -2.23%
Array creation (Execution) 2.9±0.14ms 2.9±0.13ms 0.00%
Array creation (Full) 3.0±0.17ms 3.1±0.17ms -3.23%
Array pop (Execution) 916.2±41.18µs 907.4±47.28µs +0.97%
Array pop (Full) 1405.4±70.50µs 1409.1±88.79µs -0.26%
Boolean Object Access (Execution) 5.4±0.34µs 5.5±0.24µs -1.82%
Boolean Object Access (Full) 297.1±24.12µs 289.9±18.25µs +2.48%
Clean js (Execution) 688.9±36.52µs 685.3±46.91µs +0.53%
Clean js (Full) 979.1±54.90µs 986.3±44.36µs -0.73%
Clean js (Parser) 41.3±2.67µs 41.4±3.25µs -0.24%
Create Realm 443.4±21.63ns 458.6±42.75ns -3.31%
Dynamic Object Property Access (Execution) 5.8±0.32µs 5.8±0.37µs 0.00%
Dynamic Object Property Access (Full) 302.8±23.74µs 297.4±15.08µs +1.82%
Expression (Parser) 6.8±0.58µs 6.8±0.45µs 0.00%
Fibonacci (Execution) 943.9±72.41µs 943.4±51.07µs +0.05%
Fibonacci (Full) 1159.4±52.42µs 1119.3±73.41µs +3.58%
For loop (Execution) 23.8±1.38µs 24.5±1.68µs -2.86%
For loop (Full) 311.6±18.38µs 301.5±15.94µs +3.35%
For loop (Parser) 19.4±1.91µs 20.1±1.25µs -3.48%
Goal Symbols (Parser) 14.0±1.11µs 13.6±0.86µs +2.94%
Hello World (Parser) 3.6±0.21µs 3.7±0.21µs -2.70%
Long file (Parser) 791.8±37.45ns 778.7±80.33ns +1.68%
Mini js (Execution) 613.6±25.89µs 635.6±39.26µs -3.46%
Mini js (Full) 897.3±55.89µs 929.7±49.87µs -3.48%
Mini js (Parser) 35.6±2.67µs 35.5±2.70µs +0.28%
Number Object Access (Execution) 4.3±0.30µs 4.3±0.46µs 0.00%
Number Object Access (Full) 287.8±14.51µs 280.1±17.59µs +2.75%
Object Creation (Execution) 4.8±0.24µs 4.8±0.27µs 0.00%
Object Creation (Full) 295.1±21.49µs 296.3±17.67µs -0.40%
RegExp (Execution) 11.7±0.64µs 11.9±0.69µs -1.68%
RegExp (Full) 311.6±42.77µs 294.6±18.18µs +5.77%
RegExp Literal (Execution) 11.7±0.73µs 12.4±0.95µs -5.65%
RegExp Literal (Full) 308.8±18.63µs 305.5±21.47µs +1.08%
RegExp Literal Creation (Execution) 10.6±1.07µs 10.5±0.50µs +0.95%
RegExp Literal Creation (Full) 298.1±24.54µs 297.9±30.38µs +0.07%
Static Object Property Access (Execution) 5.1±0.43µs 5.1±0.25µs 0.00%
Static Object Property Access (Full) 299.0±23.41µs 295.7±20.26µs +1.12%
String Object Access (Execution) 7.7±0.46µs 8.2±0.83µs -6.10%
String Object Access (Full) 302.2±21.31µs 293.6±50.38µs +2.93%
String comparison (Execution) 7.0±0.38µs 7.1±0.35µs -1.41%
String comparison (Full) 297.3±17.16µs 287.4±15.44µs +3.44%
String concatenation (Execution) 5.8±0.40µs 6.3±0.70µs -7.94%
String concatenation (Full) 300.6±16.24µs 291.8±14.93µs +3.02%
String copy (Execution) 4.4±0.23µs 4.3±0.23µs +2.33%
String copy (Full) 284.1±19.00µs 277.2±13.74µs +2.49%
Symbols (Execution) 3.8±0.21µs 3.8±0.29µs 0.00%
Symbols (Full) 271.8±16.29µs 275.3±12.37µs -1.27%

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.

Code looks fine, but it'd be nice to have the usual doc comment pointing to the spec and to MDN.
The function above it, property_is_enumerable is also missing it, it'd be nice if you could do that too.

@HalidOdat HalidOdat requested a review from RageKnify May 8, 2021 19:56
@HalidOdat HalidOdat changed the title Implement Object.assign( target, ...source ) Implement Object.assign( target, ...sources ) May 8, 2021
@github-actions
Copy link

github-actions bot commented May 8, 2021

Benchmark for b667a76

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 361.4±11.70ns 365.6±6.25ns -1.15%
Arithmetic operations (Full) 242.2±5.22µs 247.0±3.15µs -1.94%
Array access (Execution) 6.0±0.17µs 6.1±0.13µs -1.64%
Array access (Full) 260.0±9.08µs 265.3±4.04µs -2.00%
Array creation (Execution) 2.7±0.09ms 2.8±0.05ms -3.57%
Array creation (Full) 3.1±0.10ms 3.2±0.05ms -3.13%
Array pop (Execution) 879.7±21.70µs 897.1±13.89µs -1.94%
Array pop (Full) 1359.5±48.87µs 1385.7±17.19µs -1.89%
Boolean Object Access (Execution) 5.1±0.19µs 5.2±0.09µs -1.92%
Boolean Object Access (Full) 261.6±6.43µs 261.8±4.63µs -0.08%
Clean js (Execution) 651.0±14.96µs 660.5±8.38µs -1.44%
Clean js (Full) 945.9±17.94µs 959.8±10.45µs -1.45%
Clean js (Parser) 39.6±0.87µs 40.7±0.31µs -2.70%
Create Realm 431.1±11.75ns 427.0±10.32ns +0.96%
Dynamic Object Property Access (Execution) 5.0±0.13µs 5.1±0.05µs -1.96%
Dynamic Object Property Access (Full) 264.5±7.02µs 262.8±3.84µs +0.65%
Expression (Parser) 6.6±0.19µs 6.7±0.12µs -1.49%
Fibonacci (Execution) 755.9±24.00µs 764.1±16.99µs -1.07%
Fibonacci (Full) 1014.0±29.60µs 1044.5±17.58µs -2.92%
For loop (Execution) 21.9±0.50µs 21.9±0.74µs 0.00%
For loop (Full) 274.5±9.59µs 282.6±4.77µs -2.87%
For loop (Parser) 19.5±0.40µs 19.7±0.19µs -1.02%
Goal Symbols (Parser) 13.6±0.33µs 13.7±0.23µs -0.73%
Hello World (Parser) 3.7±0.09µs 3.8±0.04µs -2.63%
Long file (Parser) 773.7±13.97ns 781.7±15.74ns -1.02%
Mini js (Execution) 581.1±18.97µs 585.6±13.64µs -0.77%
Mini js (Full) 881.6±13.10µs 887.3±7.76µs -0.64%
Mini js (Parser) 35.0±1.14µs 35.6±0.32µs -1.69%
Number Object Access (Execution) 4.0±0.11µs 4.1±0.07µs -2.44%
Number Object Access (Full) 258.0±6.73µs 258.3±4.73µs -0.12%
Object Creation (Execution) 4.1±0.16µs 4.3±0.04µs -4.65%
Object Creation (Full) 256.6±7.78µs 259.0±4.45µs -0.93%
RegExp (Execution) 10.7±0.20µs 11.7±0.13µs -8.55%
RegExp (Full) 268.8±7.47µs 271.2±4.65µs -0.88%
RegExp Literal (Execution) 10.5±0.29µs 11.7±0.10µs -10.26%
RegExp Literal (Full) 267.6±7.46µs 273.0±3.31µs -1.98%
RegExp Literal Creation (Execution) 9.2±0.24µs 10.4±0.12µs -11.54%
RegExp Literal Creation (Full) 268.0±5.38µs 266.7±6.67µs +0.49%
Static Object Property Access (Execution) 4.4±0.13µs 4.6±0.04µs -4.35%
Static Object Property Access (Full) 262.0±6.81µs 260.9±3.74µs +0.42%
String Object Access (Execution) 7.1±0.19µs 7.4±0.15µs -4.05%
String Object Access (Full) 263.8±4.30µs 267.2±6.16µs -1.27%
String comparison (Execution) 6.4±0.19µs 6.6±0.07µs -3.03%
String comparison (Full) 266.1±3.68µs 268.7±3.00µs -0.97%
String concatenation (Execution) 5.3±0.15µs 5.3±0.06µs 0.00%
String concatenation (Full) 256.2±5.76µs 261.6±2.13µs -2.06%
String copy (Execution) 3.8±0.10µs 3.9±0.04µs -2.56%
String copy (Full) 251.1±6.39µs 253.1±2.99µs -0.79%
Symbols (Execution) 3.3±0.08µs 3.3±0.09µs 0.00%
Symbols (Full) 238.2±7.18µs 242.5±3.99µs -1.77%

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.

I think there is a potential small bug when the function is called with no arguments, but let me know if it's not the case.

boa/src/builtins/object/mod.rs Show resolved Hide resolved
@HalidOdat HalidOdat merged commit ca81ab0 into master May 11, 2021
@HalidOdat HalidOdat deleted the feature/object-assign branch May 11, 2021 14:40
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.

None yet

4 participants