Skip to content

Commit 76d1b5d

Browse files
targosBethGriggs
authored andcommitted
deps: patch V8 to 9.4.146.24
Refs: v8/v8@9.4.146.19...9.4.146.24 PR-URL: #40616 Refs: v8/v8@9.4.146.19...9.4.146.23 Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent b3a1276 commit 76d1b5d

12 files changed

+159
-17
lines changed

deps/v8/OWNERS

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ per-file codereview.settings=file:INFRA_OWNERS
2727
per-file AUTHORS=file:COMMON_OWNERS
2828
per-file WATCHLISTS=file:COMMON_OWNERS
2929

30+
# Needed by the auto_tag builder
31+
per-file WATCHLISTS=v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com
32+
per-file DEPS=v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com
33+
3034
per-file ...-mips*=file:MIPS_OWNERS
3135
per-file ...-mips64*=file:MIPS_OWNERS
3236
per-file ...-ppc*=file:PPC_OWNERS

deps/v8/include/OWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ per-file v8-inspector.h=file:../src/inspector/OWNERS
1111
per-file v8-inspector-protocol.h=file:../src/inspector/OWNERS
1212
per-file js_protocol.pdl=file:../src/inspector/OWNERS
1313

14+
# Needed by the auto_tag builder
15+
per-file v8-version.h=v8-ci-autoroll-builder@chops-service-accounts.iam.gserviceaccount.com
16+
1417
# For branch updates:
1518
per-file v8-version.h=file:../INFRA_OWNERS
1619

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 9
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 146
14-
#define V8_PATCH_LEVEL 19
14+
#define V8_PATCH_LEVEL 24
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/execution/isolate-inl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bool Isolate::has_pending_message() {
5050
}
5151

5252
Object Isolate::pending_exception() {
53-
DCHECK(has_pending_exception());
53+
CHECK(has_pending_exception());
5454
DCHECK(!thread_local_top()->pending_exception_.IsException(this));
5555
return thread_local_top()->pending_exception_;
5656
}

deps/v8/src/heap/cppgc/marker.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ void MarkerBase::EnterAtomicPause(MarkingConfig::StackState stack_state) {
243243
}
244244
config_.stack_state = stack_state;
245245
config_.marking_type = MarkingConfig::MarkingType::kAtomic;
246+
mutator_marking_state_.set_in_atomic_pause();
246247

247248
// Lock guards against changes to {Weak}CrossThreadPersistent handles, that
248249
// may conflict with marking. E.g., a WeakCrossThreadPersistent may be
@@ -421,7 +422,9 @@ bool MarkerBase::ProcessWorklistsWithDeadline(
421422
size_t marked_bytes_deadline, v8::base::TimeTicks time_deadline) {
422423
StatsCollector::EnabledScope stats_scope(
423424
heap().stats_collector(), StatsCollector::kMarkTransitiveClosure);
425+
bool saved_did_discover_new_ephemeron_pairs;
424426
do {
427+
mutator_marking_state_.ResetDidDiscoverNewEphemeronPairs();
425428
if ((config_.marking_type == MarkingConfig::MarkingType::kAtomic) ||
426429
schedule_.ShouldFlushEphemeronPairs()) {
427430
mutator_marking_state_.FlushDiscoveredEphemeronPairs();
@@ -509,6 +512,8 @@ bool MarkerBase::ProcessWorklistsWithDeadline(
509512
}
510513
}
511514

515+
saved_did_discover_new_ephemeron_pairs =
516+
mutator_marking_state_.DidDiscoverNewEphemeronPairs();
512517
{
513518
StatsCollector::EnabledScope stats_scope(
514519
heap().stats_collector(), StatsCollector::kMarkProcessEphemerons);
@@ -522,7 +527,8 @@ bool MarkerBase::ProcessWorklistsWithDeadline(
522527
return false;
523528
}
524529
}
525-
} while (!mutator_marking_state_.marking_worklist().IsLocalAndGlobalEmpty());
530+
} while (!mutator_marking_state_.marking_worklist().IsLocalAndGlobalEmpty() ||
531+
saved_did_discover_new_ephemeron_pairs);
526532
return true;
527533
}
528534

deps/v8/src/heap/cppgc/marking-state.h

+35-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "include/cppgc/trace-trait.h"
1111
#include "include/cppgc/visitor.h"
12+
#include "src/base/logging.h"
1213
#include "src/heap/cppgc/compaction-worklists.h"
1314
#include "src/heap/cppgc/globals.h"
1415
#include "src/heap/cppgc/heap-object-header.h"
@@ -115,6 +116,16 @@ class MarkingStateBase {
115116
movable_slots_worklist_.reset();
116117
}
117118

119+
bool DidDiscoverNewEphemeronPairs() const {
120+
return discovered_new_ephemeron_pairs_;
121+
}
122+
123+
void ResetDidDiscoverNewEphemeronPairs() {
124+
discovered_new_ephemeron_pairs_ = false;
125+
}
126+
127+
void set_in_atomic_pause() { in_atomic_pause_ = true; }
128+
118129
protected:
119130
inline void MarkAndPush(HeapObjectHeader&, TraceDescriptor);
120131

@@ -150,6 +161,9 @@ class MarkingStateBase {
150161
movable_slots_worklist_;
151162

152163
size_t marked_bytes_ = 0;
164+
bool in_ephemeron_processing_ = false;
165+
bool discovered_new_ephemeron_pairs_ = false;
166+
bool in_atomic_pause_ = false;
153167
};
154168

155169
MarkingStateBase::MarkingStateBase(HeapBase& heap,
@@ -286,20 +300,35 @@ void MarkingStateBase::ProcessWeakContainer(const void* object,
286300
void MarkingStateBase::ProcessEphemeron(const void* key, const void* value,
287301
TraceDescriptor value_desc,
288302
Visitor& visitor) {
289-
// Filter out already marked keys. The write barrier for WeakMember
290-
// ensures that any newly set value after this point is kept alive and does
291-
// not require the callback.
292-
if (HeapObjectHeader::FromObject(key).IsMarked<AccessMode::kAtomic>()) {
303+
// ProcessEphemeron is not expected to find new ephemerons recursively, which
304+
// would break the main marking loop.
305+
DCHECK(!in_ephemeron_processing_);
306+
in_ephemeron_processing_ = true;
307+
// Keys are considered live even in incremental/concurrent marking settings
308+
// because the write barrier for WeakMember ensures that any newly set value
309+
// after this point is kept alive and does not require the callback.
310+
const bool key_in_construction =
311+
HeapObjectHeader::FromObject(key).IsInConstruction<AccessMode::kAtomic>();
312+
const bool key_considered_as_live =
313+
key_in_construction
314+
? in_atomic_pause_
315+
: HeapObjectHeader::FromObject(key).IsMarked<AccessMode::kAtomic>();
316+
DCHECK_IMPLIES(
317+
key_in_construction && in_atomic_pause_,
318+
HeapObjectHeader::FromObject(key).IsMarked<AccessMode::kAtomic>());
319+
if (key_considered_as_live) {
293320
if (value_desc.base_object_payload) {
294321
MarkAndPush(value_desc.base_object_payload, value_desc);
295322
} else {
296323
// If value_desc.base_object_payload is nullptr, the value is not GCed and
297324
// should be immediately traced.
298325
value_desc.callback(&visitor, value);
299326
}
300-
return;
327+
} else {
328+
discovered_ephemeron_pairs_worklist_.Push({key, value, value_desc});
329+
discovered_new_ephemeron_pairs_ = true;
301330
}
302-
discovered_ephemeron_pairs_worklist_.Push({key, value, value_desc});
331+
in_ephemeron_processing_ = false;
303332
}
304333

305334
void MarkingStateBase::AccountMarkedBytes(const HeapObjectHeader& header) {

deps/v8/src/ic/accessor-assembler.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,8 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase(
846846
Comment("module export");
847847
TNode<UintPtrT> index =
848848
DecodeWord<LoadHandler::ExportsIndexBits>(handler_word);
849-
TNode<Module> module = LoadObjectField<Module>(
850-
CAST(p->receiver()), JSModuleNamespace::kModuleOffset);
849+
TNode<Module> module =
850+
LoadObjectField<Module>(CAST(holder), JSModuleNamespace::kModuleOffset);
851851
TNode<ObjectHashTable> exports =
852852
LoadObjectField<ObjectHashTable>(module, Module::kExportsOffset);
853853
TNode<Cell> cell = CAST(LoadFixedArrayElement(exports, index));

deps/v8/src/ic/ic.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,13 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
989989
// We found the accessor, so the entry must exist.
990990
DCHECK(entry.is_found());
991991
int index = ObjectHashTable::EntryToValueIndex(entry);
992-
return LoadHandler::LoadModuleExport(isolate(), index);
992+
Handle<Smi> smi_handler =
993+
LoadHandler::LoadModuleExport(isolate(), index);
994+
if (holder_is_lookup_start_object) {
995+
return smi_handler;
996+
}
997+
return LoadHandler::LoadFromPrototype(isolate(), map, holder,
998+
smi_handler);
993999
}
9941000

9951001
Handle<Object> accessors = lookup->GetAccessors();

deps/v8/src/wasm/module-compiler.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -3052,13 +3052,13 @@ void CompilationStateImpl::InitializeCompilationProgressAfterDeserialization(
30523052
}
30533053
compilation_progress_.assign(module->num_declared_functions,
30543054
kProgressAfterDeserialization);
3055-
uint32_t num_imported_functions = module->num_imported_functions;
30563055
for (auto func_index : missing_functions) {
30573056
if (FLAG_wasm_lazy_compilation) {
3058-
native_module_->UseLazyStub(num_imported_functions + func_index);
3057+
native_module_->UseLazyStub(func_index);
30593058
}
3060-
compilation_progress_[func_index] = SetupCompilationProgressForFunction(
3061-
lazy_module, module, enabled_features, func_index);
3059+
compilation_progress_[declared_function_index(module, func_index)] =
3060+
SetupCompilationProgressForFunction(lazy_module, module,
3061+
enabled_features, func_index);
30623062
}
30633063
}
30643064
auto builder = std::make_unique<CompilationUnitBuilder>(native_module_);

deps/v8/test/mjsunit/wasm/test-serialization-with-lazy-compilation.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const num_functions = 2;
1010

1111
function create_builder() {
1212
const builder = new WasmModuleBuilder();
13+
builder.addImport("foo", "bar", kSig_i_v);
1314
for (let i = 0; i < num_functions; ++i) {
1415
builder.addFunction('f' + i, kSig_i_v)
1516
.addBody(wasmI32Const(i))
@@ -37,7 +38,7 @@ gc();
3738
print(arguments.callee.name);
3839
const module = %DeserializeWasmModule(serialized_module, wire_bytes);
3940

40-
const instance = new WebAssembly.Instance(module);
41+
const instance = new WebAssembly.Instance(module, {foo: {bar: () => 1}});
4142
assertEquals(0, instance.exports.f0());
4243
assertEquals(1, instance.exports.f1());
4344
})();

deps/v8/test/unittests/heap/cppgc/ephemeron-pair-unittest.cc

+45
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,50 @@ TEST_F(EphemeronPairTest, EphemeronPairWithEmptyMixinValue) {
242242
FinishMarking();
243243
}
244244

245+
namespace {
246+
247+
class KeyWithCallback final : public GarbageCollected<KeyWithCallback> {
248+
public:
249+
template <typename Callback>
250+
explicit KeyWithCallback(Callback callback) {
251+
callback(this);
252+
}
253+
void Trace(Visitor*) const {}
254+
};
255+
256+
class EphemeronHolderForKeyWithCallback final
257+
: public GarbageCollected<EphemeronHolderForKeyWithCallback> {
258+
public:
259+
EphemeronHolderForKeyWithCallback(KeyWithCallback* key, GCed* value)
260+
: ephemeron_pair_(key, value) {}
261+
void Trace(cppgc::Visitor* visitor) const { visitor->Trace(ephemeron_pair_); }
262+
263+
private:
264+
const EphemeronPair<KeyWithCallback, GCed> ephemeron_pair_;
265+
};
266+
267+
} // namespace
268+
269+
TEST_F(EphemeronPairTest, EphemeronPairWithKeyInConstruction) {
270+
GCed* value = MakeGarbageCollected<GCed>(GetAllocationHandle());
271+
Persistent<EphemeronHolderForKeyWithCallback> holder;
272+
InitializeMarker(*Heap::From(GetHeap()), GetPlatformHandle().get());
273+
FinishSteps();
274+
MakeGarbageCollected<KeyWithCallback>(
275+
GetAllocationHandle(), [this, &holder, value](KeyWithCallback* thiz) {
276+
// The test doesn't use conservative stack scanning to retain key to
277+
// avoid retaining value as a side effect.
278+
EXPECT_TRUE(HeapObjectHeader::FromObject(thiz).TryMarkAtomic());
279+
holder = MakeGarbageCollected<EphemeronHolderForKeyWithCallback>(
280+
GetAllocationHandle(), thiz, value);
281+
// Finishing marking at this point will leave an ephemeron pair
282+
// reachable where the key is still in construction. The GC needs to
283+
// mark the value for such pairs as live in the atomic pause as they key
284+
// is considered live.
285+
FinishMarking();
286+
});
287+
EXPECT_TRUE(HeapObjectHeader::FromObject(value).IsMarked());
288+
}
289+
245290
} // namespace internal
246291
} // namespace cppgc

deps/v8/test/unittests/heap/cppgc/marker-unittest.cc

+48
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
#include <memory>
88

99
#include "include/cppgc/allocation.h"
10+
#include "include/cppgc/ephemeron-pair.h"
1011
#include "include/cppgc/internal/pointer-policies.h"
1112
#include "include/cppgc/member.h"
1213
#include "include/cppgc/persistent.h"
1314
#include "include/cppgc/trace-trait.h"
1415
#include "src/heap/cppgc/heap-object-header.h"
1516
#include "src/heap/cppgc/marking-visitor.h"
17+
#include "src/heap/cppgc/object-allocator.h"
1618
#include "src/heap/cppgc/stats-collector.h"
1719
#include "test/unittests/heap/cppgc/tests.h"
1820
#include "testing/gtest/include/gtest/gtest.h"
@@ -44,6 +46,8 @@ class MarkerTest : public testing::TestWithHeap {
4446

4547
Marker* marker() const { return marker_.get(); }
4648

49+
void ResetMarker() { marker_.reset(); }
50+
4751
private:
4852
std::unique_ptr<Marker> marker_;
4953
};
@@ -346,6 +350,50 @@ TEST_F(MarkerTest, SentinelNotClearedOnWeakPersistentHandling) {
346350
EXPECT_EQ(kSentinelPointer, root->weak_child());
347351
}
348352

353+
namespace {
354+
355+
class SimpleObject final : public GarbageCollected<SimpleObject> {
356+
public:
357+
void Trace(Visitor*) const {}
358+
};
359+
360+
class ObjectWithEphemeronPair final
361+
: public GarbageCollected<ObjectWithEphemeronPair> {
362+
public:
363+
explicit ObjectWithEphemeronPair(AllocationHandle& handle)
364+
: ephemeron_pair_(MakeGarbageCollected<SimpleObject>(handle),
365+
MakeGarbageCollected<SimpleObject>(handle)) {}
366+
367+
void Trace(Visitor* visitor) const {
368+
// First trace the ephemeron pair. The key is not yet marked as live, so the
369+
// pair should be recorded for later processing. Then strongly mark the key.
370+
// Marking the key will not trigger another worklist processing iteration,
371+
// as it merely continues the same loop for regular objects and will leave
372+
// the main marking worklist empty. If recording the ephemeron pair doesn't
373+
// as well, we will get a crash when destroying the marker.
374+
visitor->Trace(ephemeron_pair_);
375+
visitor->Trace(const_cast<const SimpleObject*>(ephemeron_pair_.key.Get()));
376+
}
377+
378+
private:
379+
const EphemeronPair<SimpleObject, SimpleObject> ephemeron_pair_;
380+
};
381+
382+
} // namespace
383+
384+
TEST_F(MarkerTest, MarkerProcessesAllEphemeronPairs) {
385+
static const Marker::MarkingConfig config = {
386+
MarkingConfig::CollectionType::kMajor,
387+
MarkingConfig::StackState::kNoHeapPointers,
388+
MarkingConfig::MarkingType::kAtomic};
389+
Persistent<ObjectWithEphemeronPair> obj =
390+
MakeGarbageCollected<ObjectWithEphemeronPair>(GetAllocationHandle(),
391+
GetAllocationHandle());
392+
InitializeMarker(*Heap::From(GetHeap()), GetPlatformHandle().get(), config);
393+
marker()->FinishMarking(MarkingConfig::StackState::kNoHeapPointers);
394+
ResetMarker();
395+
}
396+
349397
// Incremental Marking
350398

351399
class IncrementalMarkingTest : public testing::TestWithHeap {

0 commit comments

Comments
 (0)