summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebAssembly
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-10-19 20:18:01 +0300
committerLinus Groh <mail@linusgroh.de>2021-10-20 12:27:19 +0100
commit20163c058485dc524402c46f21bbe65a860bf9c5 (patch)
tree35e6942b65f8138ee073efcec6dae987d9ab0377 /Userland/Libraries/LibWeb/WebAssembly
parent3355b52cca1e1a8478ea5dbbd193120af4c83ca6 (diff)
downloadserenity-20163c058485dc524402c46f21bbe65a860bf9c5.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly')
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp4
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h4
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp6
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h6
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp8
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h8
8 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
index 1db0997d0f..0d2f71f6af 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.cpp
@@ -16,7 +16,7 @@ void WebAssemblyInstancePrototype::initialize(JS::GlobalObject& global_object)
define_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
{
auto this_value = vm.this_value(global_object);
auto* this_object = TRY_OR_DISCARD(this_value.to_object(global_object));
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h
index fff25310e1..4417787135 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObjectPrototype.h
@@ -25,7 +25,7 @@ public:
virtual void initialize(JS::GlobalObject&) override;
private:
- JS_DECLARE_NATIVE_FUNCTION(exports_getter);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(exports_getter);
static JS::Handle<WebAssemblyInstancePrototype> s_instance;
};
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
index bc4020ce7a..ec85d245bd 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.cpp
@@ -17,7 +17,7 @@ void WebAssemblyMemoryPrototype::initialize(JS::GlobalObject& global_object)
define_native_function("grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
{
auto page_count = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
@@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
return JS::Value(static_cast<u32>(previous_size));
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter)
{
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyMemoryObject>(this_object)) {
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h
index 74fd7b0322..00f54c8692 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h
@@ -27,8 +27,8 @@ public:
virtual void initialize(JS::GlobalObject&) override;
private:
- JS_DECLARE_NATIVE_FUNCTION(grow);
- JS_DECLARE_NATIVE_FUNCTION(buffer_getter);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(grow);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(buffer_getter);
};
}
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index 51e21fbdde..1c4b72c4c2 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -87,7 +87,7 @@ void WebAssemblyObject::visit_edges(Visitor& visitor)
}
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::validate)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyObject::validate)
{
// FIXME: Implement this once module validation is implemented in LibWasm.
dbgln("Hit WebAssemblyObject::validate() stub!");
@@ -127,7 +127,7 @@ Result<size_t, JS::Value> parse_module(JS::GlobalObject& global_object, JS::Obje
return WebAssemblyObject::s_compiled_modules.size() - 1;
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::compile)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyObject::compile)
{
// FIXME: This shouldn't block!
auto buffer_or_error = vm.argument(0).to_object(global_object);
@@ -308,7 +308,7 @@ Result<size_t, JS::Value> WebAssemblyObject::instantiate_module(Wasm::Module con
return s_instantiated_modules.size() - 1;
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::instantiate)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyObject::instantiate)
{
// FIXME: This shouldn't block!
auto buffer_or_error = vm.argument(0).to_object(global_object);
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
index 2c0eae4349..4bc959472f 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
@@ -60,9 +60,9 @@ public:
static Wasm::AbstractMachine s_abstract_machine;
private:
- JS_DECLARE_NATIVE_FUNCTION(validate);
- JS_DECLARE_NATIVE_FUNCTION(compile);
- JS_DECLARE_NATIVE_FUNCTION(instantiate);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(validate);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(compile);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(instantiate);
};
class WebAssemblyMemoryObject final : public JS::Object {
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
index 7493579e2e..ffc0d8b3d8 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.cpp
@@ -19,7 +19,7 @@ void WebAssemblyTablePrototype::initialize(JS::GlobalObject& global_object)
define_native_function("set", set, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
{
auto delta = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
@@ -56,7 +56,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
return JS::Value(static_cast<u32>(initial_size));
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
{
auto index = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
@@ -84,7 +84,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::get)
return to_js_value(wasm_value, global_object);
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
{
auto index = TRY_OR_DISCARD(vm.argument(0).to_u32(global_object));
@@ -121,7 +121,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::set)
return JS::js_undefined();
}
-JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::length_getter)
+JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyTablePrototype::length_getter)
{
auto* this_object = TRY_OR_DISCARD(vm.this_value(global_object).to_object(global_object));
if (!is<WebAssemblyTableObject>(this_object)) {
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h
index e3075c63ae..9e034e70c0 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h
@@ -27,10 +27,10 @@ public:
virtual void initialize(JS::GlobalObject& global_object) override;
private:
- JS_DECLARE_NATIVE_FUNCTION(grow);
- JS_DECLARE_NATIVE_FUNCTION(get);
- JS_DECLARE_NATIVE_FUNCTION(set);
- JS_DECLARE_NATIVE_FUNCTION(length_getter);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(grow);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(get);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(set);
+ JS_DECLARE_OLD_NATIVE_FUNCTION(length_getter);
};
}