mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Use FlyString in PropertyKey instead of DeprecatedFlyString
This required dealing with *substantial* fallout.
This commit is contained in:
parent
fc744e3f3f
commit
46a5710238
Notes:
github-actions[bot]
2025-03-24 22:28:26 +00:00
Author: https://github.com/awesomekling
Commit: 46a5710238
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4067
Reviewed-by: https://github.com/trflynn89
110 changed files with 985 additions and 987 deletions
|
@ -54,7 +54,7 @@ void Instance::initialize(JS::Realm& realm)
|
|||
[&](Wasm::FunctionAddress const& address) {
|
||||
Optional<GC::Ptr<JS::FunctionObject>> object = m_function_instances.get(address);
|
||||
if (!object.has_value()) {
|
||||
object = Detail::create_native_function(vm, address, export_.name(), this);
|
||||
object = Detail::create_native_function(vm, address, MUST(String::from_byte_string(export_.name())), this);
|
||||
m_function_instances.set(address, *object);
|
||||
}
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ JS::ThrowCompletionOr<NonnullRefPtr<CompiledWebAssemblyModule>> compile_a_webass
|
|||
|
||||
GC_DEFINE_ALLOCATOR(ExportedWasmFunction);
|
||||
|
||||
GC::Ref<ExportedWasmFunction> ExportedWasmFunction::create(JS::Realm& realm, DeprecatedFlyString const& name, Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)> behavior, Wasm::FunctionAddress exported_address)
|
||||
GC::Ref<ExportedWasmFunction> ExportedWasmFunction::create(JS::Realm& realm, FlyString const& name, Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)> behavior, Wasm::FunctionAddress exported_address)
|
||||
{
|
||||
auto& vm = realm.vm();
|
||||
auto prototype = realm.intrinsics().function_prototype();
|
||||
|
@ -383,13 +383,13 @@ GC::Ref<ExportedWasmFunction> ExportedWasmFunction::create(JS::Realm& realm, Dep
|
|||
prototype);
|
||||
}
|
||||
|
||||
ExportedWasmFunction::ExportedWasmFunction(DeprecatedFlyString name, GC::Ptr<GC::Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)>> behavior, Wasm::FunctionAddress exported_address, JS::Object& prototype)
|
||||
ExportedWasmFunction::ExportedWasmFunction(FlyString name, GC::Ptr<GC::Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)>> behavior, Wasm::FunctionAddress exported_address, JS::Object& prototype)
|
||||
: NativeFunction(move(name), move(behavior), prototype)
|
||||
, m_exported_address(exported_address)
|
||||
{
|
||||
}
|
||||
|
||||
JS::NativeFunction* create_native_function(JS::VM& vm, Wasm::FunctionAddress address, ByteString const& name, Instance* instance)
|
||||
JS::NativeFunction* create_native_function(JS::VM& vm, Wasm::FunctionAddress address, String const& name, Instance* instance)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
Optional<Wasm::FunctionType> type;
|
||||
|
@ -545,7 +545,7 @@ JS::Value to_js_value(JS::VM& vm, Wasm::Value& wasm_value, Wasm::ValueType type)
|
|||
[](Wasm::HostFunction& host_function) {
|
||||
return host_function.name();
|
||||
});
|
||||
return create_native_function(vm, address, name);
|
||||
return create_native_function(vm, address, MUST(String::from_byte_string(name)));
|
||||
}
|
||||
case Wasm::ValueType::ExternReference: {
|
||||
auto ref_ = wasm_value.to<Wasm::Reference>();
|
||||
|
|
|
@ -71,13 +71,13 @@ class ExportedWasmFunction final : public JS::NativeFunction {
|
|||
GC_DECLARE_ALLOCATOR(ExportedWasmFunction);
|
||||
|
||||
public:
|
||||
static GC::Ref<ExportedWasmFunction> create(JS::Realm&, DeprecatedFlyString const& name, ESCAPING Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)>, Wasm::FunctionAddress);
|
||||
static GC::Ref<ExportedWasmFunction> create(JS::Realm&, FlyString const& name, ESCAPING Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)>, Wasm::FunctionAddress);
|
||||
virtual ~ExportedWasmFunction() override = default;
|
||||
|
||||
Wasm::FunctionAddress exported_address() const { return m_exported_address; }
|
||||
|
||||
protected:
|
||||
ExportedWasmFunction(DeprecatedFlyString name, GC::Ptr<GC::Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)>>, Wasm::FunctionAddress, Object& prototype);
|
||||
ExportedWasmFunction(FlyString name, GC::Ptr<GC::Function<JS::ThrowCompletionOr<JS::Value>(JS::VM&)>>, Wasm::FunctionAddress, Object& prototype);
|
||||
|
||||
private:
|
||||
Wasm::FunctionAddress m_exported_address;
|
||||
|
@ -87,7 +87,7 @@ WebAssemblyCache& get_cache(JS::Realm&);
|
|||
|
||||
JS::ThrowCompletionOr<NonnullOwnPtr<Wasm::ModuleInstance>> instantiate_module(JS::VM&, Wasm::Module const&, GC::Ptr<JS::Object> import_object);
|
||||
JS::ThrowCompletionOr<NonnullRefPtr<CompiledWebAssemblyModule>> compile_a_webassembly_module(JS::VM&, ByteBuffer);
|
||||
JS::NativeFunction* create_native_function(JS::VM&, Wasm::FunctionAddress address, ByteString const& name, Instance* instance = nullptr);
|
||||
JS::NativeFunction* create_native_function(JS::VM&, Wasm::FunctionAddress address, String const& name, Instance* instance = nullptr);
|
||||
JS::ThrowCompletionOr<Wasm::Value> to_webassembly_value(JS::VM&, JS::Value value, Wasm::ValueType const& type);
|
||||
Wasm::Value default_webassembly_value(JS::VM&, Wasm::ValueType type);
|
||||
JS::Value to_js_value(JS::VM&, Wasm::Value& wasm_value, Wasm::ValueType type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue