Linus Groh
b5da876817
LibWeb: Make WebAssembly.Memory.prototype.buffer an accessor property
2021-07-05 12:33:29 +01:00
Linus Groh
b73b6fbd4c
LibWeb: Make WebAssembly.Instance.prototype.exports an accessor property
2021-07-05 12:33:08 +01:00
Linus Groh
79d8326370
LibWeb: Use "WebAssembly.Foo" in exception error messages
...
Not just "Foo" or "WebAssemblyFoo". This is how it's accessed from the
outside (JS).
Also fix one case of "not an" => "not a".
2021-07-05 12:32:51 +01:00
Linus Groh
1ac3d253c5
LibWeb/WebAssembly+test-wasm: Use get_without_side_effects() more
2021-07-04 22:07:36 +01:00
Ali Mohammad Pur
b538e15548
LibWasm: Give traps a reason and display it when needed
...
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
321db0159e
LibWeb: Add the WebAssembly.Module constructor
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
8acc8339d1
LibWeb: Add the WebAssembly.Instance constructor
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
de4cbc8f08
LibWeb: Use the correct name to refer to WebAssembly.Memory.prototype
...
Otherwise `instanceof` wouldn't return the correct result.
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
bfb3d9e9d0
LibWeb: Split the WebAssemblyInstance object logic into multiple files
...
Now that we're adding a constructor to it, let's split it up like the
rest of LibWeb does.
2021-07-02 04:53:01 +04:30
Andreas Kling
ba9d5c4d54
LibJS: Rename Function => FunctionObject
2021-06-27 22:36:04 +02:00
Ali Mohammad Pur
5c90c389c3
LibWeb: Implement the WebAssembly Memory object and Memory imports
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
e523e530fc
LibWeb: Cache the WebAssembly objects that we hand out to JS
...
The spec requires this behaviour, and it's generally faster to do this
instead of re-resolving and re-creating the instances anyway.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
a256997064
LibWeb: Use SignedBigInteger::create() to create wasm i64 values
...
...instead of the terrible from_base10(...to_base10()) hack.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
baa4195daa
LibWeb: Avoid resolving the wasm call address type on every invocation
...
This is a waste of time, and it's not a cheap operation.
2021-06-22 00:26:25 +04:30
Linus Groh
317b88a8c3
LibJS: Replace Object's create_empty() with create() taking a prototype
...
This now matches the spec's OrdinaryObjectCreate() across the board:
instead of implicitly setting the created object's prototype to
%Object.prototype% and then in many cases setting it to a nullptr right
away, it now has an 'Object* prototype' parameter with _no default
value_. This makes the code easier to compare with the spec, very clear
in terms of what prototype is being used as well as avoiding unnecessary
shape transitions.
Also fixes a couple of cases were we weren't setting the correct
prototype.
There's no reason to assume that the object would not be empty (as in
having own properties), so let's follow our existing pattern of
Type::create(...) and simply call it 'create'.
2021-06-16 22:49:04 +01:00
Idan Horowitz
f5a978c1aa
LibWeb: Set a detach key for ArrayBuffers returned from WASM
...
As required by the specification:
`Set buffer.[[ArrayBufferDetachKey]] to "WebAssembly.Memory".`
2021-06-11 13:38:25 +01:00
Ali Mohammad Pur
56bf80251c
LibWasm: Implement reference instructions (ref.{null,func,is_null})
2021-06-02 16:09:16 +04:30
Ali Mohammad Pur
cf8b75c2e5
LibWasm+LibWeb: Partially resolve memory exports
...
This allows the JS side to access the wasm memory, assuming it's
exported by the module.
This can be used to draw stuff on the wasm side and display them from
the js side, for example :^)
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
3926eab3b7
LibWasm+LibWeb: Implement (a very basic version of) the JS link/import
...
This allows Wasm code to call javascript functions.
2021-05-26 15:34:13 +04:30
Ali Mohammad Pur
a2af04837e
LibWeb: Implement a very basic WebAssembly JS API
...
This impl is *extremely* simple, and is missing a lot of things, it's
also not particularly spec-compliant in some places, but it's definitely
a start :^)
2021-05-26 15:34:13 +04:30