diff --git a/common.gypi b/common.gypi index cae7c10a647237..b2381e557572ff 100644 --- a/common.gypi +++ b/common.gypi @@ -35,7 +35,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.22', + 'v8_embedder_string': '-node.23', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 10b444e862f74e..3ae5667f31e522 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -2181,6 +2181,7 @@ enum StateTag { COMPILER, OTHER, EXTERNAL, + ATOMICS_WAIT, IDLE }; diff --git a/deps/v8/src/execution/futex-emulation.cc b/deps/v8/src/execution/futex-emulation.cc index 8c3b54c2a7e6af..05c32300d0fab0 100644 --- a/deps/v8/src/execution/futex-emulation.cc +++ b/deps/v8/src/execution/futex-emulation.cc @@ -9,6 +9,7 @@ #include "src/base/macros.h" #include "src/base/platform/time.h" #include "src/execution/isolate.h" +#include "src/execution/vm-state-inl.h" #include "src/handles/handles-inl.h" #include "src/numbers/conversions.h" #include "src/objects/bigint.h" @@ -132,6 +133,7 @@ template Object FutexEmulation::Wait(Isolate* isolate, Handle array_buffer, size_t addr, T value, double rel_timeout_ms) { + VMState state(isolate); DCHECK_LT(addr, array_buffer->byte_length()); bool use_timeout = rel_timeout_ms != V8_INFINITY; diff --git a/deps/v8/src/execution/vm-state-inl.h b/deps/v8/src/execution/vm-state-inl.h index 87dc185f2da204..178191776438b5 100644 --- a/deps/v8/src/execution/vm-state-inl.h +++ b/deps/v8/src/execution/vm-state-inl.h @@ -14,11 +14,9 @@ namespace v8 { namespace internal { -// -// VMState class implementation. A simple stack of VM states held by the -// logger and partially threaded through the call stack. States are pushed by -// VMState construction and popped by destruction. -// +// VMState class implementation. A simple stack of VM states held by the logger +// and partially threaded through the call stack. States are pushed by VMState +// construction and popped by destruction. inline const char* StateToString(StateTag state) { switch (state) { case JS: @@ -35,6 +33,8 @@ inline const char* StateToString(StateTag state) { return "OTHER"; case EXTERNAL: return "EXTERNAL"; + case ATOMICS_WAIT: + return "ATOMICS_WAIT"; case IDLE: return "IDLE"; } diff --git a/deps/v8/src/execution/vm-state.h b/deps/v8/src/execution/vm-state.h index 38b70f5a95cd4a..2ccde290d59225 100644 --- a/deps/v8/src/execution/vm-state.h +++ b/deps/v8/src/execution/vm-state.h @@ -11,11 +11,10 @@ namespace v8 { namespace internal { -// Logging and profiling. A StateTag represents a possible state of -// the VM. The logger maintains a stack of these. Creating a VMState -// object enters a state by pushing on the stack, and destroying a -// VMState object leaves a state by popping the current state from the -// stack. +// Logging and profiling. A StateTag represents a possible state of the VM. The +// logger maintains a stack of these. Creating a VMState object enters a state +// by pushing on the stack, and destroying a VMState object leaves a state by +// popping the current state from the stack. template class VMState { public: diff --git a/deps/v8/src/profiler/profile-generator.cc b/deps/v8/src/profiler/profile-generator.cc index 11821035d5ce01..e420603e4fc3c1 100644 --- a/deps/v8/src/profiler/profile-generator.cc +++ b/deps/v8/src/profiler/profile-generator.cc @@ -1014,6 +1014,7 @@ CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { case PARSER: case COMPILER: case BYTECODE_COMPILER: + case ATOMICS_WAIT: // DOM events handlers are reported as OTHER / EXTERNAL entries. // To avoid confusing people, let's put all these entries into // one bucket. diff --git a/deps/v8/src/profiler/sampling-heap-profiler.cc b/deps/v8/src/profiler/sampling-heap-profiler.cc index f5aa1dc3a052a6..e7d780e084a4b6 100644 --- a/deps/v8/src/profiler/sampling-heap-profiler.cc +++ b/deps/v8/src/profiler/sampling-heap-profiler.cc @@ -178,6 +178,9 @@ SamplingHeapProfiler::AllocationNode* SamplingHeapProfiler::AddStack() { case IDLE: name = "(IDLE)"; break; + // Treat atomics wait as a normal JS event; we don't care about the + // difference for allocations. + case ATOMICS_WAIT: case JS: name = "(JS)"; break; diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index a2a409f167540c..15522cb84bfd2f 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -25979,6 +25979,8 @@ void AtomicsWaitCallbackForTesting( CHECK_EQ(timeout_in_ms, info->expected_timeout); CHECK_EQ(value, info->expected_value); CHECK_EQ(offset_in_bytes, info->expected_offset); + CHECK_EQ(v8::StateTag::ATOMICS_WAIT, + reinterpret_cast(info->isolate)->current_vm_state()); auto ThrowSomething = [&]() { info->isolate->ThrowException(v8::Integer::New(info->isolate, 42));