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

Remove interoperability between TypedArrays and DataView instances #411

Closed
wants to merge 1 commit into from

Conversation

leobalter
Copy link
Member

Apply this change to prevent this - probably unwanted - interoperability.

This change help optimizing implementations.

@anba
Copy link
Contributor

anba commented Feb 25, 2016

Does anyone know the history behind the previous design? The change notes for rev19 only say:

Changed branding for DataView to make them more polymorphic with Typed Arrays WRT buffer access and ArrayBuffer.isView

@leobalter
Copy link
Member Author

From what I saw on the specs, TypedArray and Dataview instance methods are very optimized to work for their respective constructors. I might be wrong, but this interoperability is not necessary and might avoid further optimization.

It would be valuable to have feedback on @anba's question, maybe there's a missing piece I haven't found yet.

@littledan
Copy link
Member

@allenwb What do you think?

@allenwb
Copy link
Member

allenwb commented Mar 15, 2016

I'll take a closer look in a bit. A good starting place for understanding the motivation is to look at the change markup for Rev19 and see the before and after.

@bterlson
Copy link
Member

ping @allenwb? :)

@allenwb
Copy link
Member

allenwb commented Mar 20, 2016

OK, I verified that this is indeed a bug and the proposed fix looks exactly right.

@leobalter
Copy link
Member Author

Thank you, @allenwb!

@littledan
Copy link
Member

I like this change. Suggestion: maybe completely disjoint internal slot names to make the distinction even more clear.

@allenwb
Copy link
Member

allenwb commented Mar 22, 2016

the common [[ViewedArrayBuffer]] is used to make ArrayBuffer.isView work ... or anything else that wants to work with any view over an ArrayBuffer. For example, output primitives might accept either an Typed Array or a DataView.

@leobalter
Copy link
Member Author

I left the Assert steps for [[ViewedArrayBuffer]] for a historical reason, but they're not really necessary as probably won't cause any trouble.

I can remove them if necessary.

@bterlson
Copy link
Member

The asserts are fine I think. Let's leave them!

@bterlson bterlson closed this in 1d7f90e Mar 25, 2016
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.

5 participants