mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00
LibJS: Add minimum changes to build on Windows and run js.exe
This commit adds the minimal export macros needed to run js.exe on windows. A followup commit is planned to move to explicit export entirely. A static_assert for the size of a struct is also ifdef'ed out as the semantics around object layout and inheritance are different on MSVC abi and the struct IteratorRecord ends up being 40 bytes not 32.
This commit is contained in:
parent
e67495e141
commit
96c197faf1
Notes:
github-actions[bot]
2025-05-29 09:27:44 +00:00
Author: https://github.com/R-Goc
Commit: 96c197faf1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4774
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
6 changed files with 14 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
#include <LibJS/Bytecode/Label.h>
|
||||
#include <LibJS/Bytecode/Op.h>
|
||||
#include <LibJS/Export.h>
|
||||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/Accessor.h>
|
||||
#include <LibJS/Runtime/Array.h>
|
||||
|
@ -1789,7 +1790,7 @@ inline ThrowCompletionOr<Value> delete_by_value_with_this(Bytecode::Interpreter&
|
|||
return Value(TRY(reference.delete_(vm)));
|
||||
}
|
||||
|
||||
class PropertyNameIterator final
|
||||
class JS_API PropertyNameIterator final
|
||||
: public Object
|
||||
, public BuiltinIterator {
|
||||
JS_OBJECT(PropertyNameIterator, Object);
|
||||
|
|
|
@ -104,7 +104,7 @@ private:
|
|||
ExecutionContext* m_running_execution_context { nullptr };
|
||||
};
|
||||
|
||||
extern bool g_dump_bytecode;
|
||||
JS_API extern bool g_dump_bytecode;
|
||||
|
||||
ThrowCompletionOr<GC::Ref<Bytecode::Executable>> compile(VM&, ASTNode const&, JS::FunctionKind kind, FlyString const& name);
|
||||
ThrowCompletionOr<GC::Ref<Bytecode::Executable>> compile(VM&, ECMAScriptFunctionObject const&);
|
||||
|
|
|
@ -290,3 +290,7 @@ else()
|
|||
endif()
|
||||
|
||||
target_link_libraries(LibJS PUBLIC JSClangPlugin)
|
||||
|
||||
# TODO: Use lagom_generate_export_header and annotate entire LibJS with export macros
|
||||
include(GenerateExportHeader)
|
||||
generate_export_header(LibJS EXPORT_MACRO_NAME JS_API EXPORT_FILE_NAME "Export.h")
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibJS/Contrib/Test262/262Object.h>
|
||||
#include <LibJS/Export.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace JS::Test262 {
|
||||
|
||||
class GlobalObject final : public JS::GlobalObject {
|
||||
class JS_API GlobalObject final : public JS::GlobalObject {
|
||||
JS_OBJECT(GlobalObject, JS::GlobalObject);
|
||||
GC_DECLARE_ALLOCATOR(GlobalObject);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibJS/Export.h>
|
||||
|
||||
#define JS_ENUMERATE_ERROR_TYPES(M) \
|
||||
M(AccessorBadField, "Accessor descriptor's '{}' field must be a function or undefined") \
|
||||
|
@ -306,7 +307,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
class ErrorType {
|
||||
class JS_API ErrorType {
|
||||
public:
|
||||
#define __ENUMERATE_JS_ERROR(name, message) \
|
||||
static const ErrorType name;
|
||||
|
|
|
@ -37,7 +37,10 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
};
|
||||
|
||||
// msvc abi semantics about layout with inheritance differ from Sys-V
|
||||
#if !defined(AK_OS_WINDOWS)
|
||||
static_assert(sizeof(IteratorRecord) == 32);
|
||||
#endif
|
||||
|
||||
class Iterator : public Object {
|
||||
JS_OBJECT(Iterator, Object);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue