node icon indicating copy to clipboard operation
node copied to clipboard

deps: update V8 to 12.5

Open targos opened this issue 1 year ago • 18 comments

I know, it never ends 😅

targos avatar Apr 23 '24 05:04 targos

Review requested:

  • [ ] @nodejs/gyp
  • [ ] @nodejs/security-wg
  • [ ] @nodejs/v8-update

nodejs-github-bot avatar Apr 23 '24 05:04 nodejs-github-bot

@nodejs/platform-windows there's one little error for now:

D:\a\node\node\deps\v8\src\flags\flag-definitions.h(3061,1): error C1070: mismatched #if/#endif pair in file 'D:\a\node\node\deps\v8\src\flags\flag-definitions.h' [D:\a\node\node\tools\v8_gypfiles\torque_base.vcxproj]

targos avatar Apr 23 '24 06:04 targos

@targos, with these changes the compilation passes (should probably become part of https://github.com/nodejs/node/pull/52651/commits/0b738c9aa7a41cb3b6c2a00f8a59cefc8c7e8e95)

From f52e086c0142311f1c4b8b2ccf160050d8f2bdd5 Mon Sep 17 00:00:00 2001
From: StefanStojanovic <[email protected]>
Date: Wed, 24 Apr 2024 16:30:39 +0200
Subject: [PATCH 1/1] V8 v12.5 Win fix

---
 deps/v8/src/api/api.cc               | 6 ++----
 deps/v8/src/flags/flag-definitions.h | 3 ++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc
index e99e7d9d135..bd2254d82a7 100644
--- a/deps/v8/src/api/api.cc
+++ b/deps/v8/src/api/api.cc
@@ -6323,8 +6323,7 @@ void v8::Object::SetAlignedPointerInInternalFields(int argc, int indices[],
 // static
 void* v8::Object::Unwrap(v8::Isolate* isolate, i::Address wrapper_obj,
                          CppHeapPointerTag tag) {
-  return i::JSApiWrapper(i::JSObject::cast(i::Tagged<i::Object>(
-                             reinterpret_cast<i::Address>(wrapper_obj))))
+  return i::JSApiWrapper(i::JSObject::cast(i::Tagged<i::Object>((wrapper_obj))))
       .GetCppHeapWrappable(reinterpret_cast<i::Isolate*>(isolate),
                            static_cast<i::ExternalPointerTag>(tag));
 }
@@ -6332,8 +6331,7 @@ void* v8::Object::Unwrap(v8::Isolate* isolate, i::Address wrapper_obj,
 // static
 void v8::Object::Wrap(v8::Isolate* isolate, i::Address wrapper_obj,
                       CppHeapPointerTag tag, void* wrappable) {
-  return i::JSApiWrapper(i::JSObject::cast(i::Tagged<i::Object>(
-                             reinterpret_cast<i::Address>(wrapper_obj))))
+  return i::JSApiWrapper(i::JSObject::cast(i::Tagged<i::Object>((wrapper_obj))))
       .SetCppHeapWrappable(reinterpret_cast<i::Isolate*>(isolate), wrappable,
                            static_cast<i::ExternalPointerTag>(tag));
 }
diff --git a/deps/v8/src/flags/flag-definitions.h b/deps/v8/src/flags/flag-definitions.h
index 68d98ae63e2..cd469b7537e 100644
--- a/deps/v8/src/flags/flag-definitions.h
+++ b/deps/v8/src/flags/flag-definitions.h
@@ -848,10 +848,11 @@ DEFINE_INT(invocation_count_for_feedback_allocation, 8,
 // Tiering: Maglev.
 #if defined(ANDROID)
 DEFINE_INT(invocation_count_for_maglev, 1000,
+           "invocation count required for optimizing with Maglev")
 #else
 DEFINE_INT(invocation_count_for_maglev, 400,
-#endif  // ANDROID
            "invocation count required for optimizing with Maglev")
+#endif  // ANDROID
 DEFINE_INT(invocation_count_for_maglev_osr, 100,
            "invocation count required for maglev OSR")
 DEFINE_BOOL(osr_from_maglev, false,
-- 
2.44.0.windows.1

However, there is another issue I got when running basic debug build sanity check (fails with Release too) .\Debug\node.exe deps\npm\node_modules\node-gyp\bin\node-gyp rebuild --directory=test\addons\hello-world --nodedir="E:\work\node".

Here is the log
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info chdir test\addons\hello-world      
gyp info find Python using Python version 3.10.11 found at "C:\Program Files\Python310\python.exe"
gyp info find VS using VS2022 (17.9.34728.123) found at:
gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
gyp info find VS run with --verbose for detailed information
gyp WARN read config.gypi ENOENT: no such file or directory, open 'E:\work\node\include\node\config.gypi'
gyp info spawn C:\Program Files\Python310\python.exe
gyp info spawn args [
gyp info spawn args 'E:\\work\\node_main\\deps\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'E:\\work\\node_main\\test\\addons\\hello-world\\build\\config.gypi',      
gyp info spawn args '-I',
gyp info spawn args 'E:\\work\\node_main\\deps\\npm\\node_modules\\node-gyp\\addon.gypi',      
gyp info spawn args '-I',
gyp info spawn args 'E:\\work\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=E:\\work\\node',
gyp info spawn args '-Dnode_gyp_dir=E:\\work\\node_main\\deps\\npm\\node_modules\\node-gyp',   
gyp info spawn args '-Dnode_lib_file=E:\\\\work\\\\node\\\\$(Configuration)\\\\node.lib',      
gyp info spawn args '-Dmodule_root_dir=E:\\work\\node_main\\test\\addons\\hello-world',        
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'E:\\work\\node_main\\test\\addons\\hello-world\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard while converting to MSBuild.
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard_C while converting to MSBuild.
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard while converting to MSBuild.  
Warning: unrecognized setting VCCLCompilerTool/LanguageStandard_C while converting to MSBuild.
gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build\\binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Debug;Platform=x64'
gyp info spawn args ]

binding.cc
E:\work\node\deps\v8\include\v8-handle-base.h(10,28): error C2429: language feature 'nested-namespace-definition' requires compiler flag '/std:c++17' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

E:\work\node\deps\v8\include\v8-template.h(973,47): error C2039: 'string_view': is not a member of 'std' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\array(19,1):
see declaration of 'std'

E:\work\node\deps\v8\include\v8-template.h(973,58): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

E:\work\node\deps\v8\include\v8-template.h(973,47): error C2146: syntax error: missing '>' before identifier 'string_view' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\string_view(12): warning STL4038: The contents of <string_view> are available only with C++17 or later. [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\optional(11): warning STL4038: The contents of <optional> are available only with C++17 or later. [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
E:\work\node\src\node.h(687,8): error C2039: 'optional': is not a member of 'std' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\ostream(25,1):
see declaration of 'std'

E:\work\node\src\node.h(687,16): error C2143: syntax error: missing ';' before '<' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

E:\work\node\src\node.h(687,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

E:\work\node\src\node.h(687,49): error C2238: unexpected token(s) preceding ';' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

E:\work\node\src\node.h(759,10): error C2039: 'string_view': is not a member of 'std' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\ostream(25,1):
see declaration of 'std'

E:\work\node\src\node.h(759,10): error C2061: syntax error: identifier 'string_view' [E:\work\node_main\test\addons\hello-world\build\binding.vcxproj]
(compiling source file '../binding.cc')

gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.<anonymous> (E:\work\node_main\deps\npm\node_modules\node-gyp\lib\build.js:209:23)
gyp ERR! stack at ChildProcess.emit (node:events:520:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "E:\\work\\node_main\\Debug\\node.exe" "E:\\work\\node_main\\deps\\npm\\node_modules\\node-gyp\\bin\\node-gyp" "rebuild" "--directory=test\\addons\\hello-world" "--nodedir=E:\\work\\node"
gyp ERR! cwd E:\work\node_main\test\addons\hello-world
gyp ERR! node -v v22.0.0-pre
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok

Based on the errors, looks like not using std:c++17 is an issue, but I'm not sure what changes from V8 v12.5 caused this.

StefanStojanovic avatar Apr 24 '24 14:04 StefanStojanovic

Failed to start CI
   ⚠  No approving reviews found
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/8828072238

github-actions[bot] avatar Apr 25 '24 06:04 github-actions[bot]

CI: https://ci.nodejs.org/job/node-test-pull-request/58690/

nodejs-github-bot avatar Apr 25 '24 06:04 nodejs-github-bot

@StefanStojanovic Not sure what's wrong with your local tests but Windows CI is green!

targos avatar Apr 25 '24 08:04 targos

@StefanStojanovic Not sure what's wrong with your local tests but Windows CI is green!

This makes me both happy and sad... 😂 Hopefully it was something on my machine, I'll see if I can reproduce it again.

StefanStojanovic avatar Apr 25 '24 16:04 StefanStojanovic

CI: https://ci.nodejs.org/job/node-test-pull-request/59341/

nodejs-github-bot avatar May 22 '24 06:05 nodejs-github-bot

V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=benchmark-ubuntu2204-intel-64,v8test=v8test/5993/

nodejs-github-bot avatar May 22 '24 06:05 nodejs-github-bot

V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel8-s390x,v8test=v8test/5993/

nodejs-github-bot avatar May 22 '24 06:05 nodejs-github-bot

V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel8-ppc64le,v8test=v8test/5993/

nodejs-github-bot avatar May 22 '24 06:05 nodejs-github-bot

09:04:45 [1745/2474] ccache g++ -MD -MF obj/v8_base_without_compiler/turboshaft-graph-interface.o.d -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -D_GLIBCXX_ASSERTIONS=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DENABLE_GDB_JIT_INTERFACE -DV8_INTL_SUPPORT -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_SHARED_RO_HEAP -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_ENABLE_SPARKPLUG -DV8_ENABLE_TURBOFAN -DV8_ENABLE_WEBASSEMBLY -DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_USE_ZLIB -DV8_ENABLE_MAGLEV_GRAPH_PRINTER -DV8_ENABLE_EXTENSIBLE_RO_SNAPSHOT -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX -DCPPGC_SLIM_WRITE_BARRIER -DV8_TARGET_ARCH_PPC64 -DV8_TARGET_ARCH_PPC_LE -DABSL_ALLOCATOR_NOTHROW=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -I../.. -Igen -I../../include -I../../third_party/abseil-cpp -Igen/include -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/fp16/src/include -I../../third_party/zlib -Wall -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -Wno-comments -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Werror -fno-ident -fno-strict-aliasing -fstack-protector -funwind-tables -fPIC -pipe -pthread -m64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fno-omit-frame-pointer -g0 -ffp-contract=off -Wno-invalid-offsetof -Wno-strict-overflow -Wno-return-type -Wno-int-in-bool-context -Wno-deprecated -Wno-stringop-overflow -Wno-stringop-overread -Wno-restrict -Wno-array-bounds -Wno-nonnull -Wno-dangling-pointer -O3 -fdata-sections -ffunction-sections -fno-math-errno -fvisibility=default -Wno-narrowing -Wno-class-memaccess -std=gnu++2a -fno-exceptions -fno-rtti -c ../../src/wasm/turboshaft-graph-interface.cc -o obj/v8_base_without_compiler/turboshaft-graph-interface.o
09:04:45 FAILED: obj/v8_base_without_compiler/turboshaft-graph-interface.o 
09:04:45 ccache g++ -MD -MF obj/v8_base_without_compiler/turboshaft-graph-interface.o.d -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -D_GLIBCXX_ASSERTIONS=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DENABLE_GDB_JIT_INTERFACE -DV8_INTL_SUPPORT -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_SHARED_RO_HEAP -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_ENABLE_SPARKPLUG -DV8_ENABLE_TURBOFAN -DV8_ENABLE_WEBASSEMBLY -DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_USE_ZLIB -DV8_ENABLE_MAGLEV_GRAPH_PRINTER -DV8_ENABLE_EXTENSIBLE_RO_SNAPSHOT -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX -DCPPGC_SLIM_WRITE_BARRIER -DV8_TARGET_ARCH_PPC64 -DV8_TARGET_ARCH_PPC_LE -DABSL_ALLOCATOR_NOTHROW=1 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -I../.. -Igen -I../../include -I../../third_party/abseil-cpp -Igen/include -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/fp16/src/include -I../../third_party/zlib -Wall -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -Wno-comments -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Werror -fno-ident -fno-strict-aliasing -fstack-protector -funwind-tables -fPIC -pipe -pthread -m64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fno-omit-frame-pointer -g0 -ffp-contract=off -Wno-invalid-offsetof -Wno-strict-overflow -Wno-return-type -Wno-int-in-bool-context -Wno-deprecated -Wno-stringop-overflow -Wno-stringop-overread -Wno-restrict -Wno-array-bounds -Wno-nonnull -Wno-dangling-pointer -O3 -fdata-sections -ffunction-sections -fno-math-errno -fvisibility=default -Wno-narrowing -Wno-class-memaccess -std=gnu++2a -fno-exceptions -fno-rtti -c ../../src/wasm/turboshaft-graph-interface.cc -o obj/v8_base_without_compiler/turboshaft-graph-interface.o
09:04:45 In file included from ../../src/wasm/turboshaft-graph-interface.h:13,
09:04:45                  from ../../src/wasm/turboshaft-graph-interface.cc:5:
09:04:45 ../../src/compiler/turboshaft/assembler.h: In static member function ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = v8::internal::compiler::turboshaft::V<v8::internal::compiler::turboshaft::WordWithBits<32> >; _Functor = v8::internal::wasm::TurboshaftGraphBuildingInterface::ArrayFillImpl(v8::internal::wasm::WasmGraphBuilderBase::V<v8::internal::WasmArray>, v8::internal::wasm::WasmGraphBuilderBase::V<v8::internal::compiler::turboshaft::WordWithBits<32> >, v8::internal::wasm::WasmGraphBuilderBase::V<v8::internal::compiler::turboshaft::Any>, v8::internal::wasm::WasmGraphBuilderBase::OpIndex, const v8::internal::wasm::ArrayType*, bool)::<lambda()>; _ArgTypes = {}]’:
09:04:45 ../../src/compiler/turboshaft/assembler.h:684:16: error: ‘<anonymous>’ is used uninitialized in this function [-Werror=uninitialized]
09:04:45   684 |     return Get();
09:04:45       |                ^
09:04:45 At global scope:
09:04:45 cc1plus: note: unrecognized command-line option ‘-Wno-dangling-pointer’ may have been intended to silence earlier diagnostics
09:04:45 cc1plus: note: unrecognized command-line option ‘-Wno-stringop-overread’ may have been intended to silence earlier diagnostics
09:04:45 cc1plus: all warnings being treated as errors

@nodejs/platform-ppc

targos avatar May 22 '24 07:05 targos

@targos that's likely a bug in gcc10, this should fix it: https://chromium-review.googlesource.com/c/v8/v8/+/5509746

miladfarca avatar May 22 '24 11:05 miladfarca

@miladfarca Oh yeah I forgot to look at the floating patches we already have in deps/v8. Thanks!

targos avatar May 22 '24 12:05 targos

CI: https://ci.nodejs.org/job/node-test-pull-request/59350/

nodejs-github-bot avatar May 22 '24 12:05 nodejs-github-bot

V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=benchmark-ubuntu2204-intel-64,v8test=v8test/5996/

nodejs-github-bot avatar May 22 '24 12:05 nodejs-github-bot

V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel8-s390x,v8test=v8test/5996/

nodejs-github-bot avatar May 22 '24 12:05 nodejs-github-bot

V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel8-ppc64le,v8test=v8test/5996/

nodejs-github-bot avatar May 22 '24 12:05 nodejs-github-bot