summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebAssembly
AgeCommit message (Collapse)Author
2022-01-06LibJS: Replace the custom unwind mechanism with completions :^)Linus Groh
This includes: - Parsing proper LabelledStatements with try_parse_labelled_statement() - Removing LabelableStatement - Implementing the LoopEvaluation semantics via loop_evaluation() in each IterationStatement subclass; and IterationStatement evaluation via {For,ForIn,ForOf,ForAwaitOf,While,DoWhile}Statement::execute() - Updating ReturnStatement, BreakStatement and ContinueStatement to return the appropriate completion types - Basically reimplementing TryStatement and SwitchStatement according to the spec, using completions - Honoring result completion types in AsyncBlockStart and OrdinaryCallEvaluateBody - Removing any uses of the VM unwind mechanism - most importantly, VM::throw_exception() now exclusively sets an exception and no longer triggers any unwinding mechanism. However, we already did a good job updating all of LibWeb and userland applications to not use it, and the few remaining uses elsewhere don't rely on unwinding AFAICT.
2022-01-03LibJS: Return Optional<T> from Completion::{value,target}(), not TLinus Groh
In the end this is a nicer API than having separate has_{value,target}() and having to check those first, and then making another Optional from the unwrapped value: completion.has_value() ? completion.value() : Optional<Value> {} // ^^^^^^^^^^^^^^^^^^ // Implicit creation of non-empty Optional<Value> This way we need to unwrap the optional ourselves, but can easily pass it to something else as well. This is in anticipation of the AST using completions :^)
2021-12-05LibWeb: Cast unused smart-pointer return values to voidSam Atkins
2021-11-11LibWeb: Implement WebAssembly::validate()Ali Mohammad Pur
...and make sure to validate the module in WebAssembly::compile()
2021-10-31LibWeb: Convert WebAssemblyTablePrototype funcs to ThrowCompletionOrIdan Horowitz
2021-10-31LibWeb: Convert WebAssemblyMemoryPrototype funcs to ThrowCompletionOrIdan Horowitz
2021-10-31LibWeb: Convert WebAssemblyInstancePrototype funcs to ThrowCompletionOrIdan Horowitz
2021-10-31LibWeb: Convert WebAssemblyObject functions to ThrowCompletionOrIdan Horowitz
2021-10-31LibWeb: Convert WebAssemblyObject AOs to ThrowCompletionOrIdan Horowitz
2021-10-31LibWeb: Make GlobalObject the first parameter of WebAssembly AOsIdan Horowitz
Let's be consistent with the rest of LibJS (and the rest of the file).
2021-10-21LibJS: Convert NativeFunction::{call,construct}() to ThrowCompletionOrLinus Groh
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-20LibJS: Rename define_native_function => define_old_native_functionIdan Horowitz
This method will eventually be removed once all native functions are converted to ThrowCompletionOr
2021-10-20LibJS: Convert NativeFunction callback to ThrowCompletionOrIdan Horowitz
2021-10-20LibJS: Add ThrowCompletionOr versions of the JS native function macrosIdan Horowitz
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-18LibJS: Convert to_u32() to ThrowCompletionOrIdan Horowitz
2021-10-18LibJS: Convert to_i32() to ThrowCompletionOrIdan Horowitz
2021-10-17LibJS: Convert to_double() to ThrowCompletionOrIdan Horowitz
2021-10-17LibJS: Convert to_bigint() to ThrowCompletionOrIdan Horowitz
2021-10-13LibJS: Convert to_object() to ThrowCompletionOrLinus Groh
2021-10-09LibWeb: Fix WebAssembly.Memory.prototype.buffer buildLinus Groh
2021-10-09LibJS: Use AllocateArrayBuffer where the spec tells us toLinus Groh
2021-10-03LibJS: Convert set_integrity_level() to ThrowCompletionOrLinus Groh
2021-10-03LibJS: Convert Object::get() to ThrowCompletionOrLinus Groh
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-09-30LibWeb: Add the Web::Crypto namespace, built-in, and getRandomValuesIdan Horowitz
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-23LibJS: Convert Value::invoke and VM::call to ThrowCompletionOrIdan Horowitz
2021-09-12LibWeb: Use ErrorType::NotAnObjectOfType instead of NotATimothy Flynn
2021-09-11LibJS+LibWeb+Spreadsheet: Upcall visit_edges() via Base typedefAndreas Kling
Let's use Base::visit_edges() when calling the base class, to prevent accidentally skipping over anyone in the inheritance chain.
2021-09-05LibWeb+LibWasm: Implement the WebAssembly.Table objectAli Mohammad Pur
2021-08-01LibWeb: Remove unused header includesBrian Gianforcaro
2021-08-01LibJS: Remove unused includes out of Cell.h, move to the usersBrian Gianforcaro
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-07-23LibWeb: Manually convert the js bigint to a wasm i64 valueAli Mohammad Pur
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-23LibWeb: Read the correct types in WebAssembly's to_js_value()Ali Mohammad Pur
A wasm value containing an F64 does not contain a float, etc.
2021-07-17LibWasm+Everywhere: Make the instruction count limit configurableAli Mohammad Pur
...and enable it for LibWeb and test-wasm. Note that `wasm` will not be limited by this.
2021-07-17Revert "LibWasm: Some more performance stuff (#8812)"Ali Mohammad Pur
This reverts commit 35394dbfaa23b44a293da85b20a63a10f73572c3. I pushed the wrong button again, hopefully this will be the last of such incidents.
2021-07-17LibWasm: Some more performance stuff (#8812)Ali Mohammad Pur
* 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-06LibJS: Remove the non-standard put helper and replace it's usagesIdan Horowitz
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-06LibJS: Remove the default length & attributes from define_native_*Idan Horowitz
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-06LibJS: Add define_direct_property and remove the define_property helperIdan Horowitz
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-05LibWeb: Use JS_DECLARE_NATIVE_FUNCTION for WebAssembly accessorsLinus Groh
2021-07-05LibWeb: Make WebAssembly.Memory.prototype.buffer an accessor propertyLinus Groh
2021-07-05LibWeb: Make WebAssembly.Instance.prototype.exports an accessor propertyLinus Groh
2021-07-05LibWeb: Use "WebAssembly.Foo" in exception error messagesLinus Groh
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-04LibWeb/WebAssembly+test-wasm: Use get_without_side_effects() moreLinus Groh
2021-07-02LibWasm: Give traps a reason and display it when neededAli Mohammad Pur
This makes debugging wasm code a bit easier, as we now know what fails instead of just "too bad, something went wrong".
2021-07-02LibWeb: Add the WebAssembly.Module constructorAli Mohammad Pur
2021-07-02LibWeb: Add the WebAssembly.Instance constructorAli Mohammad Pur
2021-07-02LibWeb: Use the correct name to refer to WebAssembly.Memory.prototypeAli Mohammad Pur
Otherwise `instanceof` wouldn't return the correct result.
2021-07-02LibWeb: Split the WebAssemblyInstance object logic into multiple filesAli Mohammad Pur
Now that we're adding a constructor to it, let's split it up like the rest of LibWeb does.
2021-06-27LibJS: Rename Function => FunctionObjectAndreas Kling
2021-06-22LibWeb: Implement the WebAssembly Memory object and Memory importsAli Mohammad Pur