Permalink
Browse files

Define realm for ToWebAssemblyValue (#754)

* Define realm for ToWebAssemblyValue

At the moment it is not clearly defined which realm should be used for ToWebAssemblyValue. I think the only reasonable options are the realm of the WebAssembly.Instance constructor, and the current realm context at the time the ToWebAssemblyValue is called. 

In this PR I propose to use the realm of the WebAssembly.Instance constructor because this would match the semantics of asm.js and the JavaScript to asm.js interface. In asm.js, type conversion of parameters happens within the asm.js function and not in the JavaScript function which calls the asm.js function.

* Define the realm in Exported Function [[Call]]

* Relate calls to Exported Functions to JS builtins

* Forgot to delete old changes.
  • Loading branch information...
gahaas authored and titzer committed Aug 16, 2016
1 parent 51c105c commit 500f0ea178d8a9ec37be4858e7ba050cd2c0bb8a
Showing with 2 additions and 0 deletions.
  1. +2 −0 JS.md
View
2 JS.md
@@ -271,6 +271,8 @@ WebAssembly Exported Functions have a `[[Call]](this, argValues)` method defined
passing [[Instance]], [[FunctionIndex]], and `args`.
* Return [`ToJSValue`](#tojsvalue)`(ret)`.
`[[Call]](this, argValues)` executes in the [[Realm]] of the callee Exported Function. This corresponds to [the requirements of builtin function objects in JavaScript](https://tc39.github.io/ecma262/#sec-built-in-function-objects).
Exported Functions do not have a [[Construct]] method and thus it is not possible to
call one with the `new` operator.

0 comments on commit 500f0ea

Please sign in to comment.