Skip to content

Rename Response based compile + instantiate *Streaming. #1068

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
May 18, 2017

Conversation

flagxor
Copy link
Member

@flagxor flagxor commented May 18, 2017

No description provided.

Copy link
Member

@lukewagner lukewagner left a comment

Choose a reason for hiding this comment

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

Thanks!

@lukewagner
Copy link
Member

Oh right, we also need to (in this PR or another) address @domenic's root issue in #1040 which is that (compile|instantiate)Streaming should not be defined as having two overloads but rather taking some argument v and unconditionally Promise.resolve(v) and then throwing if the resolved value isn't a Response.

@flagxor flagxor force-pushed the streaming branch 2 times, most recently from 597f1f2 to c1d3317 Compare May 18, 2017 18:09
@flagxor
Copy link
Member Author

flagxor commented May 18, 2017

PTAL

Revised to address @domenic 's concern + using the syntax suggested by TAG.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

A couple nits, but this does take care of the major issues, wooho!

@@ -113,7 +113,12 @@ If neither of the following overloads match, then the returned `Promise` is
with a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).

```
Promise<{module:WebAssembly.Module, instance:WebAssembly.Instance}>
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I guess the TAG suggested this change? I'm not sure it makes things clearer, given that you haven't switched wholesale to Web IDL (yet?), so it's just halfway between.

Probably WebAssembly.Module/Instance below, at the very least?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Web.md Outdated
```

Developers can set the argument `source` with either a promise that resolves
with a
`source` is unconditionally passed through `Promise.resolve(source)`.
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to add "using the built-in value of Promise.resolve" just so that nobody thinks that monkeypatching Promise.resolve = function () { } should affect this implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@mtrofin
Copy link
Contributor

mtrofin commented May 18, 2017

How about "{compile|instantiate}Stream" rather than "..Streaming"?

"Streaming" suggests implementation detail, which may not be what necessarily happens. For example, if the engine doesn't AOT but only lazily JIT, "compileStreaming" would be incorrect.

"Stream", on the other hand, refers to the parameter, and is factually true regardless of the implementation.

@flagxor
Copy link
Member Author

flagxor commented May 18, 2017

Can folks please chime in on if we like compileStream + instantiateStream better.
(I think I like it)

@domenic
Copy link
Member

domenic commented May 18, 2017

"Stream", on the other hand, refers to the parameter, and is factually true regardless of the implementation.

Unfortunately it is not true. A Response is not a Stream. It contains a ReadableStream as its body in some implementations (eventually all).

But even if it were a Stream, we don't generally add the type name of arguments to the name of methods. E.g. we don't have compileBufferSource.

@flagxor
Copy link
Member Author

flagxor commented May 18, 2017

Dominic makes a good point on the name. Leaving that as is.

Clarify how the source parameter is resolved.
Clarify how the result of instantiate* is described.
@flagxor flagxor merged commit 89cfa62 into WebAssembly:master May 18, 2017
kisg pushed a commit to paul99/v8mips that referenced this pull request May 19, 2017
As per spec, (WebAssembly/design#1068), we
don't have compile/instantiate overloads anymore, instead, we
have explicitly named members.

This change introduces the new APIs, implements instantiateStreaming
based on compileStreaming, and uses the existing embedder mechanism.
It does not yet remove the functionality from compile/instantiate -
we do that after we adopt the new APIs on the blink side.

Also, it temporarily handles exceptions on the v8 side, which is also
something we'll move to the blink side.

Bug: 
Change-Id: I77673b1c0d395dfcf13b2f25464fd5dfd99c8d82
Reviewed-on: https://chromium-review.googlesource.com/508852
Commit-Queue: Brad Nelson <[email protected]>
Reviewed-by: Brad Nelson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#45411}
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.

6 participants