Sam Atkins
7196570f9b
LibWeb: Cast unused smart-pointer return values to void
2021-12-05 15:31:03 +01:00
Ali Mohammad Pur
2801323236
LibWeb: Implement WebAssembly::validate()
...
...and make sure to validate the module in WebAssembly::compile()
2021-11-11 09:20:04 +01:00
Idan Horowitz
aa61110bdd
LibWeb: Convert WebAssemblyTablePrototype funcs to ThrowCompletionOr
2021-10-31 18:20:37 +02:00
Idan Horowitz
f19512bf55
LibWeb: Convert WebAssemblyMemoryPrototype funcs to ThrowCompletionOr
2021-10-31 18:20:37 +02:00
Idan Horowitz
c7c914800c
LibWeb: Convert WebAssemblyInstancePrototype funcs to ThrowCompletionOr
2021-10-31 18:20:37 +02:00
Idan Horowitz
a8d39bc070
LibWeb: Convert WebAssemblyObject functions to ThrowCompletionOr
2021-10-31 18:20:37 +02:00
Idan Horowitz
3e8c76d5ab
LibWeb: Convert WebAssemblyObject AOs to ThrowCompletionOr
2021-10-31 18:20:37 +02:00
Idan Horowitz
a76cd669b1
LibWeb: Make GlobalObject the first parameter of WebAssembly AOs
...
Let's be consistent with the rest of LibJS (and the rest of the file).
2021-10-31 18:20:37 +02:00
Linus Groh
5832de62fe
LibJS: Convert NativeFunction::{call,construct}() to ThrowCompletionOr
...
Both at the same time because many of them call construct() in call()
and I'm not keen on adding a bunch of temporary plumbing to turn
exceptions into throw completions.
Also changes the return value of construct() to Object* instead of Value
as it always needs to return an object; allowing an arbitrary Value is a
massive foot gun.
2021-10-21 09:02:23 +01:00
Idan Horowitz
40eb3a39d4
LibJS: Rename define_native_function => define_old_native_function
...
This method will eventually be removed once all native functions are
converted to ThrowCompletionOr
2021-10-20 12:27:19 +01:00
Idan Horowitz
ca27e5eff5
LibJS: Convert NativeFunction callback to ThrowCompletionOr
2021-10-20 12:27:19 +01:00
Idan Horowitz
20163c0584
LibJS: Add ThrowCompletionOr versions of the JS native function macros
...
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and
JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all
native functions were converted to the new format.
2021-10-20 12:27:19 +01:00
Idan Horowitz
cc94bba5c0
LibJS: Convert to_u32() to ThrowCompletionOr
2021-10-18 08:01:38 +03:00
Idan Horowitz
f6a5ff7b00
LibJS: Convert to_i32() to ThrowCompletionOr
2021-10-18 08:01:38 +03:00
Idan Horowitz
1639ed7e0a
LibJS: Convert to_double() to ThrowCompletionOr
2021-10-17 12:12:35 +01:00
Idan Horowitz
e87cea8248
LibJS: Convert to_bigint() to ThrowCompletionOr
2021-10-17 12:12:35 +01:00
Linus Groh
52976bfac6
LibJS: Convert to_object() to ThrowCompletionOr
2021-10-13 09:55:10 +01:00
Linus Groh
12b634a91e
LibWeb: Fix WebAssembly.Memory.prototype.buffer build
2021-10-09 13:03:40 +01:00
Linus Groh
5b61b60bbd
LibJS: Use AllocateArrayBuffer where the spec tells us to
2021-10-09 12:36:28 +01:00
Linus Groh
ed5a9aa038
LibJS: Convert set_integrity_level() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
b7e5f08e56
LibJS: Convert Object::get() to ThrowCompletionOr
...
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
2021-10-03 20:14:03 +01:00
Idan Horowitz
2c6c9b73c8
LibWeb: Add the Web::Crypto namespace, built-in, and getRandomValues
...
Since we don't support IDL typedefs or unions yet, the responsibility
of verifying the type of the argument is temporarily moved from the
generated Wrapper to the implementation.
2021-09-30 20:02:09 +02:00
Idan Horowitz
ab594e5f2f
LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr
2021-09-23 23:59:13 +03:00
Timothy Flynn
c59b97043e
LibWeb: Use ErrorType::NotAnObjectOfType instead of NotA
2021-09-12 00:16:39 +02:00
Andreas Kling
d42d655853
LibJS+LibWeb+Spreadsheet: Upcall visit_edges() via Base typedef
...
Let's use Base::visit_edges() when calling the base class, to prevent
accidentally skipping over anyone in the inheritance chain.
2021-09-11 14:10:11 +02:00
Ali Mohammad Pur
09dd397160
LibWeb+LibWasm: Implement the WebAssembly.Table object
2021-09-05 15:42:50 +04:30
Brian Gianforcaro
217179a39f
LibWeb: Remove unused header includes
2021-08-01 08:10:16 +02:00
Brian Gianforcaro
b10657a2b6
LibJS: Remove unused includes out of Cell.h, move to the users
...
Almost everything in LibJS includes Cell.h, don't force all code to
include AK/TypeCasts.h + AK/String.h. Instead include them where they
are actually used and required.
2021-08-01 08:10:16 +02:00
Ali Mohammad Pur
7b88857c5a
LibWeb: Manually convert the js bigint to a wasm i64 value
...
SignedBigInteger::export() generates sign-magnitude, but the native i64
type uses 2's comp, make this work by exporting it as unsigned and
tweaking the sign later.
2021-07-23 17:36:15 +04:30
Ali Mohammad Pur
03629a2b3c
LibWeb: Read the correct types in WebAssembly's to_js_value()
...
A wasm value containing an F64 does not contain a float, etc.
2021-07-23 17:36:15 +04:30
Ali Mohammad Pur
65cd5526cb
LibWasm+Everywhere: Make the instruction count limit configurable
...
...and enable it for LibWeb and test-wasm.
Note that `wasm` will not be limited by this.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
23b48f8fe1
Revert "LibWasm: Some more performance stuff ( #8812 )"
...
This reverts commit 35394dbfaa
.
I pushed the wrong button again, hopefully this will be the last of
such incidents.
2021-07-17 01:11:28 +04:30
Ali Mohammad Pur
35394dbfaa
LibWasm: Some more performance stuff ( #8812 )
...
* wasm: Don't try to print the function results if it traps
* LibWasm: Inline some very hot functions
These are mostly pretty small functions too, and they were about ~10%
of runtime.
* LibWasm+Everywhere: Make the instruction count limit configurable
...and enable it for LibWeb and test-wasm.
Note that `wasm` will not be limited by this.
* LibWasm: Remove a useless use of ScopeGuard
There are no multiple exit paths in that function, so we can just put
the ending logic right at the end of the function instead.
2021-07-17 01:04:37 +04:30
Idan Horowitz
e3ef241108
LibJS: Remove the non-standard put helper and replace it's usages
...
This removes all usages of the non-standard put helper method and
replaces all of it's usages with the specification required alternative
or with define_direct_property where appropriate.
2021-07-06 14:20:30 +01:00
Idan Horowitz
53f70e5208
LibJS: Remove the default length & attributes from define_native_*
...
These are usually incorrect, and people sometimes forget to add the
correct values as a result of them being optional, so they should just
be specified explicitly.
2021-07-06 14:20:30 +01:00
Idan Horowitz
a6b8291a9b
LibJS: Add define_direct_property and remove the define_property helper
...
This removes all usages of the non-standard define_property helper
method and replaces all it's usages with the specification required
alternative or with define_direct_property where appropriate.
2021-07-06 14:20:30 +01:00
Linus Groh
83f3f396ad
LibWeb: Use JS_DECLARE_NATIVE_FUNCTION for WebAssembly accessors
2021-07-05 12:43:24 +01:00
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