Skip to content

Remove unnecessary use of Runtime.getNativeFieldSize. NFC #15234

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
merged 1 commit into from
Oct 6, 2021

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Oct 5, 2021

No description provided.

@@ -480,7 +480,7 @@ function checkSafeHeap() {
}

function getHeapOffset(offset, type) {
if (Runtime.getNativeFieldSize(type) > 4 && type == 'i64') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This check was redundant since the field size of i64 is always greater than 4.

src/runtime.js Outdated
getNativeFieldSize: function(type) {
return Math.max(getNativeTypeSize(type), Runtime.QUANTUM_SIZE);
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again I'm not sure how to remove this function safely since its conceivable that somebody out there is using this in a library.js file.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine to remove this but please mention in the changelog, with an explanation of the replacement (call Runtime.getNativeTypeSize instead and max up to 4).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I decided to play it safe and not actually remove the function.. and instead try to come up with a consistent way to deprecate/remove stuff. See: #15242

@sbc100 sbc100 requested a review from kripken October 5, 2021 00:26
@sbc100 sbc100 force-pushed the remove_getNativeFieldSize branch from ac4186e to c9f8565 Compare October 5, 2021 19:29
@sbc100 sbc100 changed the title Remove unneeded Runtime.getNativeFieldSize function Remove unnecessary use of Runtime.getNativeFieldSize. NFC Oct 5, 2021
@sbc100 sbc100 force-pushed the remove_getNativeFieldSize branch from c9f8565 to 6fcfe54 Compare October 5, 2021 19:30
@sbc100 sbc100 enabled auto-merge (squash) October 5, 2021 19:31
@sbc100 sbc100 merged commit 6844a95 into main Oct 6, 2021
@sbc100 sbc100 deleted the remove_getNativeFieldSize branch October 6, 2021 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants