Skip to content

Commit

Permalink
LibJS: Port to Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
stasoid authored and ADKaster committed Feb 6, 2025
1 parent a291a7f commit 52d0341
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions Libraries/LibJS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions Libraries/LibJS/Contrib/Test262/AgentObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 52d0341

Please sign in to comment.