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

lib: enforce use of Array from primordials #30635

Closed
wants to merge 1 commit into from

Conversation

targos
Copy link
Member

@targos targos commented Nov 25, 2019

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Nov 25, 2019
ReflectConstruct(original, args, new.target) :
ReflectApply(original, this, args);
}
}[name], null);
Copy link
Member Author

@targos targos Nov 25, 2019

Choose a reason for hiding this comment

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

This change is necessary, for two reasons:

  • Some of the arrays we create are returned to the user
  • Without it I'd also have to change calls to array methods

Also, It's probably better not to wrap the primordial functions for performance reasons, especially when we migrate String() and Number() calls in the future.

Copy link
Member

Choose a reason for hiding this comment

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

hmm, wait, but why is Object.setPrototypeOf(..., null) removed here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because if we stop wrapping the functions, it becomes useless, as there is nothing left to set the prototype of (we can't do that directly on the original functions).

Copy link
Member

Choose a reason for hiding this comment

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

I see. To me making the Array namespace less mutable takes precedence over keeping these functions away from prototype poisoning, so LGTM.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

joyeecheung
joyeecheung previously approved these changes Nov 27, 2019
Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

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

Rubber Stamp LGTM

ReflectConstruct(original, args, new.target) :
ReflectApply(original, this, args);
}
}[name], null);
Copy link
Member

Choose a reason for hiding this comment

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

I see. To me making the Array namespace less mutable takes precedence over keeping these functions away from prototype poisoning, so LGTM.

targos added a commit that referenced this pull request Nov 27, 2019
PR-URL: #30635
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@targos
Copy link
Member Author

targos commented Nov 27, 2019

Landed in 141a6e3

@targos targos closed this Nov 27, 2019
@targos targos deleted the primordials-array branch November 27, 2019 18:32
targos added a commit that referenced this pull request Dec 1, 2019
PR-URL: #30635
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Dec 3, 2019
targos added a commit that referenced this pull request Jan 14, 2020
PR-URL: #30635
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
PR-URL: #30635
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants