From 2e2484257d4d48fa9afd80953e959cb0e4e044f1 Mon Sep 17 00:00:00 2001 From: ayeteadoe Date: Sat, 19 Jul 2025 13:49:30 -0700 Subject: [PATCH] LibJS: Enable EXPLICIT_SYMBOL_EXPORT and annotate minimum symbol set --- Libraries/LibJS/AST.h | 3 ++- Libraries/LibJS/Bytecode/Executable.h | 3 ++- Libraries/LibJS/Bytecode/Interpreter.h | 3 ++- Libraries/LibJS/CMakeLists.txt | 2 +- Libraries/LibJS/Console.h | 5 ++-- Libraries/LibJS/CyclicModule.h | 3 ++- Libraries/LibJS/Heap/Cell.h | 3 ++- Libraries/LibJS/Lexer.h | 3 ++- Libraries/LibJS/Module.h | 3 ++- Libraries/LibJS/Parser.cpp | 2 +- Libraries/LibJS/Parser.h | 3 ++- Libraries/LibJS/ParserError.h | 3 ++- Libraries/LibJS/Print.h | 3 ++- Libraries/LibJS/Runtime/AbstractOperations.h | 21 ++++++++-------- Libraries/LibJS/Runtime/Agent.h | 3 ++- Libraries/LibJS/Runtime/Array.h | 3 ++- Libraries/LibJS/Runtime/ArrayBuffer.h | 13 +++++----- Libraries/LibJS/Runtime/BigInt.h | 3 ++- Libraries/LibJS/Runtime/BigIntObject.h | 3 ++- Libraries/LibJS/Runtime/BooleanObject.h | 3 ++- Libraries/LibJS/Runtime/Completion.h | 5 ++-- Libraries/LibJS/Runtime/DataView.h | 9 ++++--- Libraries/LibJS/Runtime/Date.h | 25 ++++++++++--------- .../LibJS/Runtime/ECMAScriptFunctionObject.h | 3 ++- Libraries/LibJS/Runtime/Environment.h | 3 ++- Libraries/LibJS/Runtime/Error.h | 7 +++--- Libraries/LibJS/Runtime/ExecutionContext.h | 3 ++- .../LibJS/Runtime/FinalizationRegistry.h | 3 ++- Libraries/LibJS/Runtime/GlobalEnvironment.h | 3 ++- Libraries/LibJS/Runtime/GlobalObject.h | 5 ++-- Libraries/LibJS/Runtime/IndexedProperties.h | 5 ++-- .../LibJS/Runtime/Intl/MathematicalValue.h | 3 ++- Libraries/LibJS/Runtime/Intl/NumberFormat.h | 1 + Libraries/LibJS/Runtime/Intrinsics.h | 3 ++- Libraries/LibJS/Runtime/Iterator.h | 19 +++++++------- Libraries/LibJS/Runtime/JSONObject.h | 3 ++- Libraries/LibJS/Runtime/JobCallback.h | 3 ++- Libraries/LibJS/Runtime/Map.h | 3 ++- Libraries/LibJS/Runtime/NativeFunction.h | 3 ++- Libraries/LibJS/Runtime/NumberObject.h | 3 ++- Libraries/LibJS/Runtime/Object.h | 3 ++- Libraries/LibJS/Runtime/PrimitiveString.h | 3 ++- Libraries/LibJS/Runtime/Promise.h | 3 ++- Libraries/LibJS/Runtime/PromiseCapability.h | 3 ++- Libraries/LibJS/Runtime/PropertyDescriptor.h | 3 ++- Libraries/LibJS/Runtime/Realm.h | 3 ++- Libraries/LibJS/Runtime/RegExpObject.h | 3 ++- Libraries/LibJS/Runtime/Set.h | 3 ++- Libraries/LibJS/Runtime/SetIterator.h | 3 ++- Libraries/LibJS/Runtime/Shape.h | 3 ++- Libraries/LibJS/Runtime/StringObject.h | 3 ++- Libraries/LibJS/Runtime/Symbol.h | 3 ++- Libraries/LibJS/Runtime/TypedArray.h | 13 +++++----- Libraries/LibJS/Runtime/VM.h | 3 ++- Libraries/LibJS/Runtime/Value.h | 9 ++++--- Libraries/LibJS/Script.h | 3 ++- Libraries/LibJS/SourceCode.h | 3 ++- Libraries/LibJS/SourceRange.h | 3 ++- Libraries/LibJS/SourceTextModule.h | 3 ++- Libraries/LibJS/SyntaxHighlighter.h | 3 ++- Libraries/LibWeb/CMakeLists.txt | 15 ----------- 61 files changed, 167 insertions(+), 124 deletions(-) diff --git a/Libraries/LibJS/AST.h b/Libraries/LibJS/AST.h index 450351644c7..1f1b81063c6 100644 --- a/Libraries/LibJS/AST.h +++ b/Libraries/LibJS/AST.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -292,7 +293,7 @@ public: } }; -class ScopeNode : public Statement { +class JS_API ScopeNode : public Statement { public: template T& append(SourceRange range, Args&&... args) diff --git a/Libraries/LibJS/Bytecode/Executable.h b/Libraries/LibJS/Bytecode/Executable.h index ecffacf1df4..950ae61cb6e 100644 --- a/Libraries/LibJS/Bytecode/Executable.h +++ b/Libraries/LibJS/Bytecode/Executable.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,7 @@ struct SourceRecord { u32 source_end_offset {}; }; -class Executable final : public Cell { +class JS_API Executable final : public Cell { GC_CELL(Executable, Cell); GC_DECLARE_ALLOCATOR(Executable); diff --git a/Libraries/LibJS/Bytecode/Interpreter.h b/Libraries/LibJS/Bytecode/Interpreter.h index 385cd650f6b..8e305741b42 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Libraries/LibJS/Bytecode/Interpreter.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,7 @@ namespace JS::Bytecode { class InstructionStreamIterator; -class Interpreter { +class JS_API Interpreter { public: explicit Interpreter(VM&); ~Interpreter(); diff --git a/Libraries/LibJS/CMakeLists.txt b/Libraries/LibJS/CMakeLists.txt index e0141bb5ef2..076a12cba29 100644 --- a/Libraries/LibJS/CMakeLists.txt +++ b/Libraries/LibJS/CMakeLists.txt @@ -266,7 +266,7 @@ set(SOURCES Token.cpp ) -ladybird_lib(LibJS js) +ladybird_lib(LibJS js EXPLICIT_SYMBOL_EXPORT) target_link_libraries(LibJS PRIVATE LibCore LibCrypto LibFileSystem LibRegex LibSyntax LibGC) # Link LibUnicode publicly to ensure ICU data (which is in libicudata.a) is available in any process using LibJS. diff --git a/Libraries/LibJS/Console.h b/Libraries/LibJS/Console.h index 3f799e55a44..ad9e26d5db8 100644 --- a/Libraries/LibJS/Console.h +++ b/Libraries/LibJS/Console.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -23,7 +24,7 @@ namespace JS { class ConsoleClient; // https://console.spec.whatwg.org -class Console : public Cell { +class JS_API Console : public Cell { GC_CELL(Console, Cell); GC_DECLARE_ALLOCATOR(Console); @@ -105,7 +106,7 @@ private: Vector m_group_stack; }; -class ConsoleClient : public Cell { +class JS_API ConsoleClient : public Cell { GC_CELL(ConsoleClient, Cell); GC_DECLARE_ALLOCATOR(ConsoleClient); diff --git a/Libraries/LibJS/CyclicModule.h b/Libraries/LibJS/CyclicModule.h index 2bdd1e84a74..51e8fa815e0 100644 --- a/Libraries/LibJS/CyclicModule.h +++ b/Libraries/LibJS/CyclicModule.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -23,7 +24,7 @@ enum class ModuleStatus { }; // 16.2.1.5 Cyclic Module Records, https://tc39.es/ecma262/#cyclic-module-record -class CyclicModule : public Module { +class JS_API CyclicModule : public Module { GC_CELL(CyclicModule, Module); GC_DECLARE_ALLOCATOR(CyclicModule); diff --git a/Libraries/LibJS/Heap/Cell.h b/Libraries/LibJS/Heap/Cell.h index 7c04a550abd..0467e5bba11 100644 --- a/Libraries/LibJS/Heap/Cell.h +++ b/Libraries/LibJS/Heap/Cell.h @@ -7,11 +7,12 @@ #pragma once #include +#include #include namespace JS { -class Cell : public GC::Cell { +class JS_API Cell : public GC::Cell { GC_CELL(Cell, GC::Cell); public: diff --git a/Libraries/LibJS/Lexer.h b/Libraries/LibJS/Lexer.h index 052e7910bc3..6b6a2646be5 100644 --- a/Libraries/LibJS/Lexer.h +++ b/Libraries/LibJS/Lexer.h @@ -12,10 +12,11 @@ #include #include #include +#include namespace JS { -class Lexer { +class JS_API Lexer { public: explicit Lexer(StringView source, StringView filename = "(unknown)"sv, size_t line_number = 1, size_t line_column = 0); diff --git a/Libraries/LibJS/Module.h b/Libraries/LibJS/Module.h index c94c26df135..9dd50e9e92d 100644 --- a/Libraries/LibJS/Module.h +++ b/Libraries/LibJS/Module.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -150,6 +151,6 @@ private: class CyclicModule; struct GraphLoadingState; -void finish_loading_imported_module(ImportedModuleReferrer, ModuleRequest const&, ImportedModulePayload, ThrowCompletionOr> const&); +JS_API void finish_loading_imported_module(ImportedModuleReferrer, ModuleRequest const&, ImportedModulePayload, ThrowCompletionOr> const&); } diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp index 3776b59688a..7458131a86f 100644 --- a/Libraries/LibJS/Parser.cpp +++ b/Libraries/LibJS/Parser.cpp @@ -5205,7 +5205,7 @@ Parser::ForbiddenTokens Parser::ForbiddenTokens::forbid(std::initializer_list Parser::parse_function_node(u16, Optional const&); +template JS_API NonnullRefPtr Parser::parse_function_node(u16, Optional const&); template NonnullRefPtr Parser::parse_function_node(u16, Optional const&); NonnullRefPtr Parser::create_identifier_and_register_in_current_scope(SourceRange range, FlyString string, Optional declaration_kind) diff --git a/Libraries/LibJS/Parser.h b/Libraries/LibJS/Parser.h index fbba6b28017..c9d983ce939 100644 --- a/Libraries/LibJS/Parser.h +++ b/Libraries/LibJS/Parser.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,7 @@ struct FunctionNodeParseOptions { class ScopePusher; -class Parser { +class JS_API Parser { public: struct EvalInitialState { bool in_eval_function_context { false }; diff --git a/Libraries/LibJS/ParserError.h b/Libraries/LibJS/ParserError.h index eb48518aa60..63de0058f9b 100644 --- a/Libraries/LibJS/ParserError.h +++ b/Libraries/LibJS/ParserError.h @@ -11,11 +11,12 @@ #include #include #include +#include #include namespace JS { -struct ParserError { +struct JS_API ParserError { String message; Optional position; diff --git a/Libraries/LibJS/Print.h b/Libraries/LibJS/Print.h index 4522febf53c..f384d05c941 100644 --- a/Libraries/LibJS/Print.h +++ b/Libraries/LibJS/Print.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include namespace JS { @@ -20,6 +21,6 @@ struct PrintContext { bool raw_strings { false }; }; -ErrorOr print(JS::Value value, PrintContext&); +JS_API ErrorOr print(JS::Value value, PrintContext&); } diff --git a/Libraries/LibJS/Runtime/AbstractOperations.h b/Libraries/LibJS/Runtime/AbstractOperations.h index f9450e60d0f..d82bc4578d3 100644 --- a/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Libraries/LibJS/Runtime/AbstractOperations.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -24,29 +25,29 @@ namespace JS { GC::Ref new_declarative_environment(Environment&); -GC::Ref new_object_environment(Object&, bool is_with_environment, Environment*); +JS_API GC::Ref new_object_environment(Object&, bool is_with_environment, Environment*); GC::Ref new_function_environment(ECMAScriptFunctionObject&, Object* new_target); GC::Ref new_private_environment(VM& vm, PrivateEnvironment* outer); GC::Ref get_this_environment(VM&); bool can_be_held_weakly(Value); Object* get_super_constructor(VM&); ThrowCompletionOr require_object_coercible(VM&, Value); -ThrowCompletionOr call_impl(VM&, Value function, Value this_value, ReadonlySpan arguments = {}); -ThrowCompletionOr call_impl(VM&, FunctionObject& function, Value this_value, ReadonlySpan arguments = {}); -ThrowCompletionOr> construct_impl(VM&, FunctionObject&, ReadonlySpan arguments = {}, FunctionObject* new_target = nullptr); -ThrowCompletionOr length_of_array_like(VM&, Object const&); +JS_API ThrowCompletionOr call_impl(VM&, Value function, Value this_value, ReadonlySpan arguments = {}); +JS_API ThrowCompletionOr call_impl(VM&, FunctionObject& function, Value this_value, ReadonlySpan arguments = {}); +JS_API ThrowCompletionOr> construct_impl(VM&, FunctionObject&, ReadonlySpan arguments = {}, FunctionObject* new_target = nullptr); +JS_API ThrowCompletionOr length_of_array_like(VM&, Object const&); ThrowCompletionOr> create_list_from_array_like(VM&, Value, Function(Value)> = {}); ThrowCompletionOr species_constructor(VM&, Object const&, FunctionObject& default_constructor); -ThrowCompletionOr get_function_realm(VM&, FunctionObject const&); +JS_API ThrowCompletionOr get_function_realm(VM&, FunctionObject const&); ThrowCompletionOr initialize_bound_name(VM&, FlyString const&, Value, Environment*); bool is_compatible_property_descriptor(bool extensible, PropertyDescriptor const&, Optional const& current); bool validate_and_apply_property_descriptor(Object*, PropertyKey const&, bool extensible, PropertyDescriptor const&, Optional const& current); -ThrowCompletionOr get_prototype_from_constructor(VM&, FunctionObject const& constructor, GC::Ref (Intrinsics::*intrinsic_default_prototype)()); +JS_API ThrowCompletionOr get_prototype_from_constructor(VM&, FunctionObject const& constructor, GC::Ref (Intrinsics::*intrinsic_default_prototype)()); Object* create_unmapped_arguments_object(VM&, ReadonlySpan arguments); Object* create_mapped_arguments_object(VM&, FunctionObject&, NonnullRefPtr const&, ReadonlySpan arguments, Environment&); // 2.1.1 DisposeCapability Records, https://tc39.es/proposal-explicit-resource-management/#sec-disposecapability-records -struct DisposeCapability { +struct JS_API DisposeCapability { void visit_edges(GC::Cell::Visitor&) const; Vector disposable_resource_stack; // [[DisposableResourceStack]] @@ -61,8 +62,8 @@ struct DisposableResource { GC::Ptr dispose_method; // [[DisposeMethod]] }; -DisposeCapability new_dispose_capability(); -ThrowCompletionOr add_disposable_resource(VM&, DisposeCapability&, Value, Environment::InitializeBindingHint, GC::Ptr = {}); +JS_API DisposeCapability new_dispose_capability(); +JS_API ThrowCompletionOr add_disposable_resource(VM&, DisposeCapability&, Value, Environment::InitializeBindingHint, GC::Ptr = {}); ThrowCompletionOr create_disposable_resource(VM&, Value, Environment::InitializeBindingHint, GC::Ptr = {}); ThrowCompletionOr> get_dispose_method(VM&, Value, Environment::InitializeBindingHint); Completion dispose(VM&, Value, Environment::InitializeBindingHint, GC::Ptr method); diff --git a/Libraries/LibJS/Runtime/Agent.h b/Libraries/LibJS/Runtime/Agent.h index 87f05eb94ed..228980b13d8 100644 --- a/Libraries/LibJS/Runtime/Agent.h +++ b/Libraries/LibJS/Runtime/Agent.h @@ -9,12 +9,13 @@ #include #include +#include #include namespace JS { // https://tc39.es/ecma262/#sec-agents -class Agent { +class JS_API Agent { public: enum class CanBlock { Yes, diff --git a/Libraries/LibJS/Runtime/Array.h b/Libraries/LibJS/Runtime/Array.h index c0997ba090c..6ce9add9c7b 100644 --- a/Libraries/LibJS/Runtime/Array.h +++ b/Libraries/LibJS/Runtime/Array.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,7 @@ namespace JS { -class Array : public Object { +class JS_API Array : public Object { JS_OBJECT(Array, Object); GC_DECLARE_ALLOCATOR(Array); diff --git a/Libraries/LibJS/Runtime/ArrayBuffer.h b/Libraries/LibJS/Runtime/ArrayBuffer.h index 636dd4235de..d37d218535e 100644 --- a/Libraries/LibJS/Runtime/ArrayBuffer.h +++ b/Libraries/LibJS/Runtime/ArrayBuffer.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -54,7 +55,7 @@ struct DataBlock { Shared is_shared = { Shared::No }; }; -class ArrayBuffer : public Object { +class JS_API ArrayBuffer : public Object { JS_OBJECT(ArrayBuffer, Object); GC_DECLARE_ALLOCATOR(ArrayBuffer); @@ -145,14 +146,14 @@ private: Value m_detach_key; }; -ThrowCompletionOr create_byte_data_block(VM& vm, size_t size); -void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count); +JS_API ThrowCompletionOr create_byte_data_block(VM& vm, size_t size); +JS_API void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count); ThrowCompletionOr allocate_array_buffer(VM&, FunctionObject& constructor, size_t byte_length, Optional const& max_byte_length = {}); ThrowCompletionOr array_buffer_copy_and_detach(VM&, ArrayBuffer& array_buffer, Value new_length, PreserveResizability preserve_resizability); -ThrowCompletionOr detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional key = {}); +JS_API ThrowCompletionOr detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional key = {}); ThrowCompletionOr> get_array_buffer_max_byte_length_option(VM&, Value options); -ThrowCompletionOr clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length); -ThrowCompletionOr> allocate_shared_array_buffer(VM&, FunctionObject& constructor, size_t byte_length); +JS_API ThrowCompletionOr clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length); +JS_API ThrowCompletionOr> allocate_shared_array_buffer(VM&, FunctionObject& constructor, size_t byte_length); // 25.1.3.2 ArrayBufferByteLength ( arrayBuffer, order ), https://tc39.es/ecma262/#sec-arraybufferbytelength inline size_t array_buffer_byte_length(ArrayBuffer const& array_buffer, ArrayBuffer::Order) diff --git a/Libraries/LibJS/Runtime/BigInt.h b/Libraries/LibJS/Runtime/BigInt.h index a4e3b09b638..cd65bfcabd3 100644 --- a/Libraries/LibJS/Runtime/BigInt.h +++ b/Libraries/LibJS/Runtime/BigInt.h @@ -11,11 +11,12 @@ #include #include #include +#include #include namespace JS { -class BigInt final : public Cell { +class JS_API BigInt final : public Cell { GC_CELL(BigInt, Cell); GC_DECLARE_ALLOCATOR(BigInt); diff --git a/Libraries/LibJS/Runtime/BigIntObject.h b/Libraries/LibJS/Runtime/BigIntObject.h index 49f5d6021a8..217a22aeb20 100644 --- a/Libraries/LibJS/Runtime/BigIntObject.h +++ b/Libraries/LibJS/Runtime/BigIntObject.h @@ -6,12 +6,13 @@ #pragma once +#include #include #include namespace JS { -class BigIntObject final : public Object { +class JS_API BigIntObject final : public Object { JS_OBJECT(BigIntObject, Object); GC_DECLARE_ALLOCATOR(BigIntObject); diff --git a/Libraries/LibJS/Runtime/BooleanObject.h b/Libraries/LibJS/Runtime/BooleanObject.h index 21fb5f5e146..eebb85885f5 100644 --- a/Libraries/LibJS/Runtime/BooleanObject.h +++ b/Libraries/LibJS/Runtime/BooleanObject.h @@ -6,11 +6,12 @@ #pragma once +#include #include namespace JS { -class BooleanObject : public Object { +class JS_API BooleanObject : public Object { JS_OBJECT(BooleanObject, Object); GC_DECLARE_ALLOCATOR(BooleanObject); diff --git a/Libraries/LibJS/Runtime/Completion.h b/Libraries/LibJS/Runtime/Completion.h index c1a45a06956..0dfbb77f248 100644 --- a/Libraries/LibJS/Runtime/Completion.h +++ b/Libraries/LibJS/Runtime/Completion.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -49,7 +50,7 @@ namespace JS { }) // 6.2.3 The Completion Record Specification Type, https://tc39.es/ecma262/#sec-completion-record-specification-type -class [[nodiscard]] Completion { +class [[nodiscard]] JS_API Completion { public: enum class Type { Empty, @@ -345,6 +346,6 @@ inline Completion normal_completion(Value value) } // 6.2.4.2 ThrowCompletion ( value ), https://tc39.es/ecma262/#sec-throwcompletion -Completion throw_completion(Value); +JS_API Completion throw_completion(Value); } diff --git a/Libraries/LibJS/Runtime/DataView.h b/Libraries/LibJS/Runtime/DataView.h index e451c022bf2..b95ebbe480d 100644 --- a/Libraries/LibJS/Runtime/DataView.h +++ b/Libraries/LibJS/Runtime/DataView.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -13,7 +14,7 @@ namespace JS { -class DataView : public Object { +class JS_API DataView : public Object { JS_OBJECT(DataView, Object); GC_DECLARE_ALLOCATOR(DataView); @@ -42,8 +43,8 @@ struct DataViewWithBufferWitness { ByteLength cached_buffer_byte_length; // [[CachedBufferByteLength]] }; -DataViewWithBufferWitness make_data_view_with_buffer_witness_record(DataView const&, ArrayBuffer::Order); -u32 get_view_byte_length(DataViewWithBufferWitness const&); -bool is_view_out_of_bounds(DataViewWithBufferWitness const&); +JS_API DataViewWithBufferWitness make_data_view_with_buffer_witness_record(DataView const&, ArrayBuffer::Order); +JS_API u32 get_view_byte_length(DataViewWithBufferWitness const&); +JS_API bool is_view_out_of_bounds(DataViewWithBufferWitness const&); } diff --git a/Libraries/LibJS/Runtime/Date.h b/Libraries/LibJS/Runtime/Date.h index f96ae10e658..1d19d872993 100644 --- a/Libraries/LibJS/Runtime/Date.h +++ b/Libraries/LibJS/Runtime/Date.h @@ -8,12 +8,13 @@ #pragma once #include +#include #include #include namespace JS { -class Date final : public Object { +class JS_API Date final : public Object { JS_OBJECT(Date, Object); GC_DECLARE_ALLOCATOR(Date); @@ -68,27 +69,27 @@ double time_within_day(double); u16 days_in_year(i32); double day_from_year(i32); double time_from_year(i32); -i32 year_from_time(double); +JS_API i32 year_from_time(double); u16 day_within_year(double); bool in_leap_year(double); -u8 month_from_time(double); -u8 date_from_time(double); +JS_API u8 month_from_time(double); +JS_API u8 date_from_time(double); u8 week_day(double); -u8 hour_from_time(double); -u8 min_from_time(double); -u8 sec_from_time(double); -u16 ms_from_time(double); +JS_API u8 hour_from_time(double); +JS_API u8 min_from_time(double); +JS_API u8 sec_from_time(double); +JS_API u16 ms_from_time(double); Crypto::SignedBigInteger get_utc_epoch_nanoseconds(Temporal::ISODateTime const&); Vector get_named_time_zone_epoch_nanoseconds(StringView time_zone_identifier, Temporal::ISODateTime const&); Unicode::TimeZoneOffset get_named_time_zone_offset_nanoseconds(StringView time_zone_identifier, Crypto::SignedBigInteger const& epoch_nanoseconds); Unicode::TimeZoneOffset get_named_time_zone_offset_milliseconds(StringView time_zone_identifier, double epoch_milliseconds); String system_time_zone_identifier(); -void clear_system_time_zone_cache(); +JS_API void clear_system_time_zone_cache(); double local_time(double time); double utc_time(double time); -double make_time(double hour, double min, double sec, double ms); -double make_day(double year, double month, double date); -double make_date(double day, double time); +JS_API double make_time(double hour, double min, double sec, double ms); +JS_API double make_day(double year, double month, double date); +JS_API double make_date(double day, double time); double time_clip(double time); bool is_offset_time_zone_identifier(StringView offset_string); ThrowCompletionOr parse_date_time_utc_offset(VM&, StringView offset_string); diff --git a/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h b/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h index ec1ce60ea8a..8b0cca22f80 100644 --- a/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h +++ b/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -98,7 +99,7 @@ public: }; // 10.2 ECMAScript Function Objects, https://tc39.es/ecma262/#sec-ecmascript-function-objects -class ECMAScriptFunctionObject final : public FunctionObject { +class JS_API ECMAScriptFunctionObject final : public FunctionObject { JS_OBJECT(ECMAScriptFunctionObject, FunctionObject); GC_DECLARE_ALLOCATOR(ECMAScriptFunctionObject); diff --git a/Libraries/LibJS/Runtime/Environment.h b/Libraries/LibJS/Runtime/Environment.h index 38607f3cc80..c69700123d8 100644 --- a/Libraries/LibJS/Runtime/Environment.h +++ b/Libraries/LibJS/Runtime/Environment.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -19,7 +20,7 @@ struct Variable { #define JS_ENVIRONMENT(class_, base_class) GC_CELL(class_, base_class) -class Environment : public Cell { +class JS_API Environment : public Cell { GC_CELL(Environment, Cell); public: diff --git a/Libraries/LibJS/Runtime/Error.h b/Libraries/LibJS/Runtime/Error.h index aba2732a833..a3f1146b424 100644 --- a/Libraries/LibJS/Runtime/Error.h +++ b/Libraries/LibJS/Runtime/Error.h @@ -8,13 +8,14 @@ #pragma once #include +#include #include #include #include namespace JS { -struct TracebackFrame { +struct JS_API TracebackFrame { FlyString function_name; [[nodiscard]] SourceRange const& source_range() const; @@ -26,7 +27,7 @@ enum CompactTraceback { Yes, }; -class Error : public Object { +class JS_API Error : public Object { JS_OBJECT(Error, Object); GC_DECLARE_ALLOCATOR(Error); @@ -62,7 +63,7 @@ inline bool Object::fast_is() const { return is_error_object(); } // our way of implementing the [[ErrorData]] internal slot, which is // used in Object.prototype.toString(). #define DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName) \ - class ClassName final : public Error { \ + class JS_API ClassName final : public Error { \ JS_OBJECT(ClassName, Error); \ GC_DECLARE_ALLOCATOR(ClassName); \ \ diff --git a/Libraries/LibJS/Runtime/ExecutionContext.h b/Libraries/LibJS/Runtime/ExecutionContext.h index 66b3a56230d..cb10fbcde97 100644 --- a/Libraries/LibJS/Runtime/ExecutionContext.h +++ b/Libraries/LibJS/Runtime/ExecutionContext.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -32,7 +33,7 @@ struct CachedSourceRange : public RefCounted { }; // 9.4 Execution Contexts, https://tc39.es/ecma262/#sec-execution-contexts -struct ExecutionContext { +struct JS_API ExecutionContext { static NonnullOwnPtr create(u32 registers_and_constants_and_locals_count, u32 arguments_count); [[nodiscard]] NonnullOwnPtr copy() const; diff --git a/Libraries/LibJS/Runtime/FinalizationRegistry.h b/Libraries/LibJS/Runtime/FinalizationRegistry.h index ff090143298..8b933818882 100644 --- a/Libraries/LibJS/Runtime/FinalizationRegistry.h +++ b/Libraries/LibJS/Runtime/FinalizationRegistry.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -17,7 +18,7 @@ namespace JS { -class FinalizationRegistry final +class JS_API FinalizationRegistry final : public Object , public GC::WeakContainer { JS_OBJECT(FinalizationRegistry, Object); diff --git a/Libraries/LibJS/Runtime/GlobalEnvironment.h b/Libraries/LibJS/Runtime/GlobalEnvironment.h index 4008cf53218..4c4220d0fbc 100644 --- a/Libraries/LibJS/Runtime/GlobalEnvironment.h +++ b/Libraries/LibJS/Runtime/GlobalEnvironment.h @@ -6,11 +6,12 @@ #pragma once +#include #include namespace JS { -class GlobalEnvironment final : public Environment { +class JS_API GlobalEnvironment final : public Environment { JS_ENVIRONMENT(GlobalEnvironment, Environment); GC_DECLARE_ALLOCATOR(GlobalEnvironment); diff --git a/Libraries/LibJS/Runtime/GlobalObject.h b/Libraries/LibJS/Runtime/GlobalObject.h index d21e4839e82..48afccadbcc 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Libraries/LibJS/Runtime/GlobalObject.h @@ -8,12 +8,13 @@ #pragma once #include +#include #include #include namespace JS { -class GlobalObject : public Object { +class JS_API GlobalObject : public Object { JS_OBJECT(GlobalObject, Object); GC_DECLARE_ALLOCATOR(GlobalObject); @@ -43,7 +44,7 @@ private: JS_DECLARE_NATIVE_FUNCTION(unescape); }; -void set_default_global_bindings(Realm&); +JS_API void set_default_global_bindings(Realm&); template<> inline bool Object::fast_is() const { return is_global_object(); } diff --git a/Libraries/LibJS/Runtime/IndexedProperties.h b/Libraries/LibJS/Runtime/IndexedProperties.h index 51c82e081d6..1a557153f54 100644 --- a/Libraries/LibJS/Runtime/IndexedProperties.h +++ b/Libraries/LibJS/Runtime/IndexedProperties.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -128,7 +129,7 @@ private: HashMap m_sparse_elements; }; -class IndexedPropertyIterator { +class JS_API IndexedPropertyIterator { public: IndexedPropertyIterator(IndexedProperties const&, u32 starting_index, bool skip_empty); @@ -148,7 +149,7 @@ private: bool m_skip_empty { false }; }; -class IndexedProperties { +class JS_API IndexedProperties { public: IndexedProperties() = default; diff --git a/Libraries/LibJS/Runtime/Intl/MathematicalValue.h b/Libraries/LibJS/Runtime/Intl/MathematicalValue.h index 0510f37c28c..23f5451d48b 100644 --- a/Libraries/LibJS/Runtime/Intl/MathematicalValue.h +++ b/Libraries/LibJS/Runtime/Intl/MathematicalValue.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -16,7 +17,7 @@ namespace JS::Intl { // https://tc39.es/ecma402/#intl-mathematical-value -class MathematicalValue { +class JS_API MathematicalValue { public: enum class Symbol { PositiveInfinity, diff --git a/Libraries/LibJS/Runtime/Intl/NumberFormat.h b/Libraries/LibJS/Runtime/Intl/NumberFormat.h index e44320bb539..fad9379fca3 100644 --- a/Libraries/LibJS/Runtime/Intl/NumberFormat.h +++ b/Libraries/LibJS/Runtime/Intl/NumberFormat.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/Libraries/LibJS/Runtime/Intrinsics.h b/Libraries/LibJS/Runtime/Intrinsics.h index 3f69abfa3f0..135d6c10f52 100644 --- a/Libraries/LibJS/Runtime/Intrinsics.h +++ b/Libraries/LibJS/Runtime/Intrinsics.h @@ -8,12 +8,13 @@ #pragma once #include +#include #include #include namespace JS { -class Intrinsics final : public Cell { +class JS_API Intrinsics final : public Cell { GC_CELL(Intrinsics, Cell); GC_DECLARE_ALLOCATOR(Intrinsics); diff --git a/Libraries/LibJS/Runtime/Iterator.h b/Libraries/LibJS/Runtime/Iterator.h index 3c480f1d10a..7b290af3d32 100644 --- a/Libraries/LibJS/Runtime/Iterator.h +++ b/Libraries/LibJS/Runtime/Iterator.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -102,18 +103,18 @@ using IterationResultOrDone = Variant; }) ThrowCompletionOr> get_iterator_direct(VM&, Object&); -ThrowCompletionOr> get_iterator_from_method(VM&, Value, GC::Ref); -ThrowCompletionOr> get_iterator(VM&, Value, IteratorHint); +JS_API ThrowCompletionOr> get_iterator_from_method(VM&, Value, GC::Ref); +JS_API ThrowCompletionOr> get_iterator(VM&, Value, IteratorHint); ThrowCompletionOr> get_iterator_flattenable(VM&, Value, PrimitiveHandling); -ThrowCompletionOr> iterator_next(VM&, IteratorRecord&, Optional = {}); -ThrowCompletionOr iterator_complete(VM&, Object& iterator_result); -ThrowCompletionOr iterator_value(VM&, Object& iterator_result); -ThrowCompletionOr iterator_step(VM&, IteratorRecord&); -ThrowCompletionOr> iterator_step_value(VM&, IteratorRecord&); +JS_API ThrowCompletionOr> iterator_next(VM&, IteratorRecord&, Optional = {}); +JS_API ThrowCompletionOr iterator_complete(VM&, Object& iterator_result); +JS_API ThrowCompletionOr iterator_value(VM&, Object& iterator_result); +JS_API ThrowCompletionOr iterator_step(VM&, IteratorRecord&); +JS_API ThrowCompletionOr> iterator_step_value(VM&, IteratorRecord&); Completion iterator_close(VM&, IteratorRecord const&, Completion); Completion async_iterator_close(VM&, IteratorRecord const&, Completion); -GC::Ref create_iterator_result_object(VM&, Value, bool done); -ThrowCompletionOr> iterator_to_list(VM&, IteratorRecord&); +JS_API GC::Ref create_iterator_result_object(VM&, Value, bool done); +JS_API ThrowCompletionOr> iterator_to_list(VM&, IteratorRecord&); ThrowCompletionOr setter_that_ignores_prototype_properties(VM&, Value this_, Object const& home, PropertyKey const& property, Value value); using IteratorValueCallback = Function(Value)>; diff --git a/Libraries/LibJS/Runtime/JSONObject.h b/Libraries/LibJS/Runtime/JSONObject.h index d390fbdfa30..23f142b886c 100644 --- a/Libraries/LibJS/Runtime/JSONObject.h +++ b/Libraries/LibJS/Runtime/JSONObject.h @@ -6,11 +6,12 @@ #pragma once +#include #include namespace JS { -class JSONObject final : public Object { +class JS_API JSONObject final : public Object { JS_OBJECT(JSONObject, Object); GC_DECLARE_ALLOCATOR(JSONObject); diff --git a/Libraries/LibJS/Runtime/JobCallback.h b/Libraries/LibJS/Runtime/JobCallback.h index 5279492a1ca..e7a6b6a6060 100644 --- a/Libraries/LibJS/Runtime/JobCallback.h +++ b/Libraries/LibJS/Runtime/JobCallback.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,7 @@ namespace JS { // 9.5.1 JobCallback Records, https://tc39.es/ecma262/#sec-jobcallback-records -class JobCallback : public JS::Cell { +class JS_API JobCallback : public JS::Cell { GC_CELL(JobCallback, JS::Cell); GC_DECLARE_ALLOCATOR(JobCallback); diff --git a/Libraries/LibJS/Runtime/Map.h b/Libraries/LibJS/Runtime/Map.h index bc020407c72..09897012de0 100644 --- a/Libraries/LibJS/Runtime/Map.h +++ b/Libraries/LibJS/Runtime/Map.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,7 @@ namespace JS { -class Map : public Object { +class JS_API Map : public Object { JS_OBJECT(Map, Object); GC_DECLARE_ALLOCATOR(Map); diff --git a/Libraries/LibJS/Runtime/NativeFunction.h b/Libraries/LibJS/Runtime/NativeFunction.h index 50c3b0629b3..8acda6b1e13 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Libraries/LibJS/Runtime/NativeFunction.h @@ -11,13 +11,14 @@ #include #include #include +#include #include #include #include namespace JS { -class NativeFunction : public FunctionObject { +class JS_API NativeFunction : public FunctionObject { JS_OBJECT(NativeFunction, FunctionObject); GC_DECLARE_ALLOCATOR(NativeFunction); diff --git a/Libraries/LibJS/Runtime/NumberObject.h b/Libraries/LibJS/Runtime/NumberObject.h index dd4444d4742..4919789762f 100644 --- a/Libraries/LibJS/Runtime/NumberObject.h +++ b/Libraries/LibJS/Runtime/NumberObject.h @@ -6,11 +6,12 @@ #pragma once +#include #include namespace JS { -class NumberObject : public Object { +class JS_API NumberObject : public Object { JS_OBJECT(NumberObject, Object); GC_DECLARE_ALLOCATOR(NumberObject); diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h index 8512a7bd430..bb71a43d2f3 100644 --- a/Libraries/LibJS/Runtime/Object.h +++ b/Libraries/LibJS/Runtime/Object.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,7 @@ struct CacheablePropertyMetadata { GC::Ptr prototype; }; -class Object : public Cell +class JS_API Object : public Cell , public Weakable { GC_CELL(Object, Cell); GC_DECLARE_ALLOCATOR(Object); diff --git a/Libraries/LibJS/Runtime/PrimitiveString.h b/Libraries/LibJS/Runtime/PrimitiveString.h index 59438d696c1..f55c68ec928 100644 --- a/Libraries/LibJS/Runtime/PrimitiveString.h +++ b/Libraries/LibJS/Runtime/PrimitiveString.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,7 @@ namespace JS { -class PrimitiveString : public Cell { +class JS_API PrimitiveString : public Cell { GC_CELL(PrimitiveString, Cell); GC_DECLARE_ALLOCATOR(PrimitiveString); diff --git a/Libraries/LibJS/Runtime/Promise.h b/Libraries/LibJS/Runtime/Promise.h index 13e3be9e160..0ef3fc2474f 100644 --- a/Libraries/LibJS/Runtime/Promise.h +++ b/Libraries/LibJS/Runtime/Promise.h @@ -7,13 +7,14 @@ #pragma once #include +#include #include namespace JS { ThrowCompletionOr promise_resolve(VM&, Object& constructor, Value); -class Promise : public Object { +class JS_API Promise : public Object { JS_OBJECT(Promise, Object); GC_DECLARE_ALLOCATOR(Promise); diff --git a/Libraries/LibJS/Runtime/PromiseCapability.h b/Libraries/LibJS/Runtime/PromiseCapability.h index 7a405ea985c..75148c42880 100644 --- a/Libraries/LibJS/Runtime/PromiseCapability.h +++ b/Libraries/LibJS/Runtime/PromiseCapability.h @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -65,6 +66,6 @@ private: __TRY_OR_REJECT(vm, capability, expression, MUST) // 27.2.1.5 NewPromiseCapability ( C ), https://tc39.es/ecma262/#sec-newpromisecapability -ThrowCompletionOr> new_promise_capability(VM& vm, Value constructor); +JS_API ThrowCompletionOr> new_promise_capability(VM& vm, Value constructor); } diff --git a/Libraries/LibJS/Runtime/PropertyDescriptor.h b/Libraries/LibJS/Runtime/PropertyDescriptor.h index 700f8d5218e..a3262ed21f3 100644 --- a/Libraries/LibJS/Runtime/PropertyDescriptor.h +++ b/Libraries/LibJS/Runtime/PropertyDescriptor.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -18,7 +19,7 @@ namespace JS { Value from_property_descriptor(VM&, Optional const&); ThrowCompletionOr to_property_descriptor(VM&, Value); -class PropertyDescriptor { +class JS_API PropertyDescriptor { public: [[nodiscard]] bool is_accessor_descriptor() const; [[nodiscard]] bool is_data_descriptor() const; diff --git a/Libraries/LibJS/Runtime/Realm.h b/Libraries/LibJS/Runtime/Realm.h index f9c369abfec..8aaa66ec381 100644 --- a/Libraries/LibJS/Runtime/Realm.h +++ b/Libraries/LibJS/Runtime/Realm.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,7 @@ namespace JS { // 9.3 Realms, https://tc39.es/ecma262/#realm-record -class Realm final : public Cell { +class JS_API Realm final : public Cell { GC_CELL(Realm, Cell); GC_DECLARE_ALLOCATOR(Realm); diff --git a/Libraries/LibJS/Runtime/RegExpObject.h b/Libraries/LibJS/Runtime/RegExpObject.h index 397a0d53b22..b0958610099 100644 --- a/Libraries/LibJS/Runtime/RegExpObject.h +++ b/Libraries/LibJS/Runtime/RegExpObject.h @@ -10,12 +10,13 @@ #include #include #include +#include #include #include namespace JS { -ThrowCompletionOr> regexp_create(VM&, Value pattern, Value flags); +JS_API ThrowCompletionOr> regexp_create(VM&, Value pattern, Value flags); ThrowCompletionOr> regexp_alloc(VM&, FunctionObject& new_target); Result, String> regex_flags_from_string(StringView flags); diff --git a/Libraries/LibJS/Runtime/Set.h b/Libraries/LibJS/Runtime/Set.h index 3c369ed7961..20d7447e8d7 100644 --- a/Libraries/LibJS/Runtime/Set.h +++ b/Libraries/LibJS/Runtime/Set.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -13,7 +14,7 @@ namespace JS { -class Set : public Object { +class JS_API Set : public Object { JS_OBJECT(Set, Object); GC_DECLARE_ALLOCATOR(Set); diff --git a/Libraries/LibJS/Runtime/SetIterator.h b/Libraries/LibJS/Runtime/SetIterator.h index d22019523ce..31d85270607 100644 --- a/Libraries/LibJS/Runtime/SetIterator.h +++ b/Libraries/LibJS/Runtime/SetIterator.h @@ -6,13 +6,14 @@ #pragma once +#include #include #include #include namespace JS { -class SetIterator final : public Object +class JS_API SetIterator final : public Object , public BuiltinIterator { JS_OBJECT(SetIterator, Object); GC_DECLARE_ALLOCATOR(SetIterator); diff --git a/Libraries/LibJS/Runtime/Shape.h b/Libraries/LibJS/Runtime/Shape.h index c8fc44b8795..0075e1fa449 100644 --- a/Libraries/LibJS/Runtime/Shape.h +++ b/Libraries/LibJS/Runtime/Shape.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,7 @@ private: size_t padding { 0 }; }; -class Shape final : public Cell +class JS_API Shape final : public Cell , public Weakable { GC_CELL(Shape, Cell); GC_DECLARE_ALLOCATOR(Shape); diff --git a/Libraries/LibJS/Runtime/StringObject.h b/Libraries/LibJS/Runtime/StringObject.h index 9d95a91e17f..35c4a566407 100644 --- a/Libraries/LibJS/Runtime/StringObject.h +++ b/Libraries/LibJS/Runtime/StringObject.h @@ -6,11 +6,12 @@ #pragma once +#include #include namespace JS { -class StringObject : public Object { +class JS_API StringObject : public Object { JS_OBJECT(StringObject, Object); GC_DECLARE_ALLOCATOR(StringObject); diff --git a/Libraries/LibJS/Runtime/Symbol.h b/Libraries/LibJS/Runtime/Symbol.h index 02b66a7d1df..4159622bc76 100644 --- a/Libraries/LibJS/Runtime/Symbol.h +++ b/Libraries/LibJS/Runtime/Symbol.h @@ -9,11 +9,12 @@ #include #include +#include #include namespace JS { -class Symbol final : public Cell { +class JS_API Symbol final : public Cell { GC_CELL(Symbol, Cell); GC_DECLARE_ALLOCATOR(Symbol); diff --git a/Libraries/LibJS/Runtime/TypedArray.h b/Libraries/LibJS/Runtime/TypedArray.h index 4473b4fb5f8..3a9aa410c2b 100644 --- a/Libraries/LibJS/Runtime/TypedArray.h +++ b/Libraries/LibJS/Runtime/TypedArray.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -91,10 +92,10 @@ struct TypedArrayWithBufferWitness { ByteLength cached_buffer_byte_length; // [[CachedBufferByteLength]] }; -TypedArrayWithBufferWitness make_typed_array_with_buffer_witness_record(TypedArrayBase const&, ArrayBuffer::Order); -u32 typed_array_byte_length(TypedArrayWithBufferWitness const&); -u32 typed_array_length(TypedArrayWithBufferWitness const&); -bool is_typed_array_out_of_bounds(TypedArrayWithBufferWitness const&); +JS_API TypedArrayWithBufferWitness make_typed_array_with_buffer_witness_record(TypedArrayBase const&, ArrayBuffer::Order); +JS_API u32 typed_array_byte_length(TypedArrayWithBufferWitness const&); +JS_API u32 typed_array_length(TypedArrayWithBufferWitness const&); +JS_API bool is_typed_array_out_of_bounds(TypedArrayWithBufferWitness const&); bool is_typed_array_fixed_length(TypedArrayBase const&); bool is_valid_integer_index_slow_case(TypedArrayBase const&, CanonicalIndex property_index); @@ -507,14 +508,14 @@ protected: } }; -ThrowCompletionOr typed_array_from(VM&, Value); +JS_API ThrowCompletionOr typed_array_from(VM&, Value); ThrowCompletionOr typed_array_create(VM&, FunctionObject& constructor, GC::RootVector arguments); ThrowCompletionOr typed_array_create_same_type(VM&, TypedArrayBase const& exemplar, GC::RootVector arguments); ThrowCompletionOr validate_typed_array(VM&, Object const&, ArrayBuffer::Order); ThrowCompletionOr compare_typed_array_elements(VM&, Value x, Value y, FunctionObject* comparefn); #define JS_DECLARE_TYPED_ARRAY(ClassName, snake_name, PrototypeName, ConstructorName, Type) \ - class ClassName : public TypedArray { \ + class JS_API ClassName : public TypedArray { \ JS_OBJECT(ClassName, TypedArray); \ GC_DECLARE_ALLOCATOR(ClassName); \ \ diff --git a/Libraries/LibJS/Runtime/VM.h b/Libraries/LibJS/Runtime/VM.h index 9d9e3420ffb..067b8c22ae1 100644 --- a/Libraries/LibJS/Runtime/VM.h +++ b/Libraries/LibJS/Runtime/VM.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,7 @@ enum class CompilationType { Timer, }; -class VM : public RefCounted { +class JS_API VM : public RefCounted { public: static NonnullRefPtr create(); ~VM(); diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h index 7e22d96cbc3..9bd32de16e1 100644 --- a/Libraries/LibJS/Runtime/Value.h +++ b/Libraries/LibJS/Runtime/Value.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -85,7 +86,7 @@ static constexpr u64 SHIFTED_INT32_TAG = INT32_TAG << GC::TAG_SHIFT; // options from 8 tags to 15 but since we currently only use 5 for both sign bits // this is not needed. -class Value : public GC::NanBoxedValue { +class JS_API Value : public GC::NanBoxedValue { public: enum class PreferredType { Default, @@ -524,8 +525,8 @@ ThrowCompletionOr ordinary_has_instance(VM&, Value lhs, Value rhs); ThrowCompletionOr is_loosely_equal(VM&, Value lhs, Value rhs); bool is_strictly_equal(Value lhs, Value rhs); -bool same_value(Value lhs, Value rhs); -bool same_value_zero(Value lhs, Value rhs); +JS_API bool same_value(Value lhs, Value rhs); +JS_API bool same_value_zero(Value lhs, Value rhs); bool same_value_non_number(Value lhs, Value rhs); ThrowCompletionOr is_less_than(VM&, Value lhs, Value rhs, bool left_first); @@ -535,7 +536,7 @@ enum class NumberToStringMode { WithExponent, WithoutExponent, }; -[[nodiscard]] String number_to_string(double, NumberToStringMode = NumberToStringMode::WithExponent); +[[nodiscard]] JS_API String number_to_string(double, NumberToStringMode = NumberToStringMode::WithExponent); [[nodiscard]] ByteString number_to_byte_string(double, NumberToStringMode = NumberToStringMode::WithExponent); double string_to_number(StringView); diff --git a/Libraries/LibJS/Script.h b/Libraries/LibJS/Script.h index aabb896d31c..19dc04829a8 100644 --- a/Libraries/LibJS/Script.h +++ b/Libraries/LibJS/Script.h @@ -9,13 +9,14 @@ #include #include #include +#include #include #include namespace JS { // 16.1.4 Script Records, https://tc39.es/ecma262/#sec-script-records -class Script final : public Cell { +class JS_API Script final : public Cell { GC_CELL(Script, Cell); GC_DECLARE_ALLOCATOR(Script); diff --git a/Libraries/LibJS/SourceCode.h b/Libraries/LibJS/SourceCode.h index 229f7443a40..1213ddd1c7e 100644 --- a/Libraries/LibJS/SourceCode.h +++ b/Libraries/LibJS/SourceCode.h @@ -8,12 +8,13 @@ #include #include +#include #include #include namespace JS { -class SourceCode : public RefCounted { +class JS_API SourceCode : public RefCounted { public: static NonnullRefPtr create(String filename, String code); diff --git a/Libraries/LibJS/SourceRange.h b/Libraries/LibJS/SourceRange.h index e0fe5baa7da..05017b8e3a2 100644 --- a/Libraries/LibJS/SourceRange.h +++ b/Libraries/LibJS/SourceRange.h @@ -10,12 +10,13 @@ #include #include #include +#include #include #include namespace JS { -struct SourceRange { +struct JS_API SourceRange { [[nodiscard]] bool contains(Position const& position) const { return position.offset <= end.offset && position.offset >= start.offset; } NonnullRefPtr code; diff --git a/Libraries/LibJS/SourceTextModule.h b/Libraries/LibJS/SourceTextModule.h index 3b16d9543fa..ef155898af9 100644 --- a/Libraries/LibJS/SourceTextModule.h +++ b/Libraries/LibJS/SourceTextModule.h @@ -8,13 +8,14 @@ #pragma once #include +#include #include #include namespace JS { // 16.2.1.6 Source Text Module Records, https://tc39.es/ecma262/#sec-source-text-module-records -class SourceTextModule final : public CyclicModule { +class JS_API SourceTextModule final : public CyclicModule { GC_CELL(SourceTextModule, CyclicModule); GC_DECLARE_ALLOCATOR(SourceTextModule); diff --git a/Libraries/LibJS/SyntaxHighlighter.h b/Libraries/LibJS/SyntaxHighlighter.h index 5a4a2b2d5f7..6b4922b37d2 100644 --- a/Libraries/LibJS/SyntaxHighlighter.h +++ b/Libraries/LibJS/SyntaxHighlighter.h @@ -6,11 +6,12 @@ #pragma once +#include #include namespace JS { -class SyntaxHighlighter : public Syntax::Highlighter { +class JS_API SyntaxHighlighter : public Syntax::Highlighter { public: SyntaxHighlighter() = default; virtual ~SyntaxHighlighter() override = default; diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index e5980162759..b04be4db6b2 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -1054,19 +1054,4 @@ if (ENABLE_SWIFT) ) target_link_libraries(LibWeb PRIVATE AK Collections) add_swift_target_properties(LibWeb LAGOM_LIBRARIES AK LibGfx LibGC) -elseif (WIN32) - # FIXME: This is a hack to get around lld-link error undefined symbol JS::BigInt::cell_allocator - # LibJS BigInt.obj and other .obj's it depends on is given directly to LibWeb linker - target_link_libraries(LibWeb PRIVATE - $,INCLUDE,BigInt> - $,INCLUDE,ErrorType> - ) - - # FIXME: This is a hack to get around lld-link error undefined symbol JS::GlobalEnvironment::cell_allocator - # LibJS GlobalEnvironment.obj and other .obj's it depends on is given directly to LibWeb linker - target_link_libraries(LibWeb PRIVATE - $,INCLUDE,GlobalEnvironment> - $,INCLUDE,ObjectEnvironment> - $,INCLUDE,DeclarativeEnvironment> - ) endif()