LibJS: Port to Windows

This commit is contained in:
stasoid 2024-12-14 17:38:54 +05:00 committed by Andrew Kaster
parent a291a7f770
commit 52d0341c5d
Notes: github-actions[bot] 2025-02-06 22:17:49 +00:00
2 changed files with 10 additions and 4 deletions

View file

@ -275,8 +275,14 @@ if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i.86.*")
target_link_libraries(LibJS PRIVATE atomic)
endif()
# This flag has no effect on Windows
if (NOT WIN32)
if (WIN32)
# FIXME: Windows on ARM
target_link_libraries(LibJS PRIVATE clang_rt.builtins-x86_64.lib)
# FIXME: This is a hack to get around lld-link error undefined symbol GC::HeapBlockBase::block_size
# LibGC HeapBlock.obj is given directly to LibJS linker
target_link_libraries(LibJS PRIVATE $<FILTER:$<TARGET_OBJECTS:LibGC>,INCLUDE,HeapBlock>)
else()
# This flag has no effect on Windows
target_compile_options(LibJS PRIVATE -fno-omit-frame-pointer)
endif()

View file

@ -5,10 +5,10 @@
*/
#include <AK/Time.h>
#include <LibCore/System.h>
#include <LibJS/Contrib/Test262/AgentObject.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h>
#include <unistd.h>
namespace JS::Test262 {
@ -41,7 +41,7 @@ JS_DEFINE_NATIVE_FUNCTION(AgentObject::monotonic_now)
JS_DEFINE_NATIVE_FUNCTION(AgentObject::sleep)
{
auto milliseconds = TRY(vm.argument(0).to_i32(vm));
::usleep(milliseconds * 1000);
(void)Core::System::sleep_ms(milliseconds);
return js_undefined();
}