| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d97872d commit 5bef743
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | #define V8_MAJOR_VERSION 9 | |
| 12 | 12 | #define V8_MINOR_VERSION 5 | |
| 13 | 13 | #define V8_BUILD_NUMBER 172 | |
| 14 | - #define V8_PATCH_LEVEL 21 | ||
| 14 | + #define V8_PATCH_LEVEL 25 | ||
| 15 | 15 | ||
| 16 | 16 | // Use 1 for candidates and 0 otherwise. | |
| 17 | 17 | // (Boolean macro values are not supported by all preprocessors.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -343,8 +343,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode { | |||
| 343 | 343 | __ CallRecordWriteStubSaveRegisters(object_, scratch1_, | |
| 344 | 344 | remembered_set_action, save_fp_mode, | |
| 345 | 345 | StubCallMode::kCallWasmRuntimeStub); | |
| 346 | - } else { | ||
| 347 | 346 | #endif // V8_ENABLE_WEBASSEMBLY | |
| 347 | + } else { | ||
| 348 | 348 | __ CallRecordWriteStubSaveRegisters(object_, scratch1_, | |
| 349 | 349 | remembered_set_action, save_fp_mode); | |
| 350 | 350 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,7 +50,7 @@ bool Isolate::has_pending_message() { | |||
| 50 | 50 | } | |
| 51 | 51 | ||
| 52 | 52 | Object Isolate::pending_exception() { | |
| 53 | - DCHECK(has_pending_exception()); | ||
| 53 | + CHECK(has_pending_exception()); | ||
| 54 | 54 | DCHECK(!thread_local_top()->pending_exception_.IsException(this)); | |
| 55 | 55 | return thread_local_top()->pending_exception_; | |
| 56 | 56 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -243,6 +243,7 @@ void MarkerBase::EnterAtomicPause(MarkingConfig::StackState stack_state) { | |||
| 243 | 243 | } | |
| 244 | 244 | config_.stack_state = stack_state; | |
| 245 | 245 | config_.marking_type = MarkingConfig::MarkingType::kAtomic; | |
| 246 | + mutator_marking_state_.set_in_atomic_pause(); | ||
| 246 | 247 | ||
| 247 | 248 | // Lock guards against changes to {Weak}CrossThreadPersistent handles, that | |
| 248 | 249 | // may conflict with marking. E.g., a WeakCrossThreadPersistent may be | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | 10 | #include "include/cppgc/trace-trait.h" | |
| 11 | 11 | #include "include/cppgc/visitor.h" | |
| 12 | + #include "src/base/logging.h" | ||
| 12 | 13 | #include "src/heap/cppgc/compaction-worklists.h" | |
| 13 | 14 | #include "src/heap/cppgc/globals.h" | |
| 14 | 15 | #include "src/heap/cppgc/heap-object-header.h" | |
@@ -123,6 +124,8 @@ class MarkingStateBase { | |||
| 123 | 124 | discovered_new_ephemeron_pairs_ = false; | |
| 124 | 125 | } | |
| 125 | 126 | ||
| 127 | + void set_in_atomic_pause() { in_atomic_pause_ = true; } | ||
| 128 | + | ||
| 126 | 129 | protected: | |
| 127 | 130 | inline void MarkAndPush(HeapObjectHeader&, TraceDescriptor); | |
| 128 | 131 | ||
@@ -160,6 +163,7 @@ class MarkingStateBase { | |||
| 160 | 163 | size_t marked_bytes_ = 0; | |
| 161 | 164 | bool in_ephemeron_processing_ = false; | |
| 162 | 165 | bool discovered_new_ephemeron_pairs_ = false; | |
| 166 | + bool in_atomic_pause_ = false; | ||
| 163 | 167 | }; | |
| 164 | 168 | ||
| 165 | 169 | MarkingStateBase::MarkingStateBase(HeapBase& heap, | |
@@ -300,12 +304,19 @@ void MarkingStateBase::ProcessEphemeron(const void* key, const void* value, | |||
| 300 | 304 | // would break the main marking loop. | |
| 301 | 305 | DCHECK(!in_ephemeron_processing_); | |
| 302 | 306 | in_ephemeron_processing_ = true; | |
| 303 | - // Filter out already marked keys. The write barrier for WeakMember | ||
| 304 | - // ensures that any newly set value after this point is kept alive and does | ||
| 305 | - // not require the callback. | ||
| 306 | - if (!HeapObjectHeader::FromObject(key) | ||
| 307 | - .IsInConstruction<AccessMode::kAtomic>() && | ||
| 308 | - HeapObjectHeader::FromObject(key).IsMarked<AccessMode::kAtomic>()) { | ||
| 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) { | ||
| 309 | 320 | if (value_desc.base_object_payload) { | |
| 310 | 321 | MarkAndPush(value_desc.base_object_payload, value_desc); | |
| 311 | 322 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -846,8 +846,8 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase( | |||
| 846 | 846 | Comment("module export"); | |
| 847 | 847 | TNode<UintPtrT> index = | |
| 848 | 848 | 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); | ||
| 851 | 851 | TNode<ObjectHashTable> exports = | |
| 852 | 852 | LoadObjectField<ObjectHashTable>(module, Module::kExportsOffset); | |
| 853 | 853 | TNode<Cell> cell = CAST(LoadFixedArrayElement(exports, index)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -989,7 +989,13 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) { | |||
| 989 | 989 | // We found the accessor, so the entry must exist. | |
| 990 | 990 | DCHECK(entry.is_found()); | |
| 991 | 991 | 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); | ||
| 993 | 999 | } | |
| 994 | 1000 | ||
| 995 | 1001 | Handle<Object> accessors = lookup->GetAccessors(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,5 +242,50 @@ TEST_F(EphemeronPairTest, EphemeronPairWithEmptyMixinValue) { | |||
| 242 | 242 | FinishMarking(); | |
| 243 | 243 | } | |
| 244 | 244 | ||
| 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 | + | ||
| 245 | 290 | } // namespace internal | |
| 246 | 291 | } // namespace cppgc | |
| Back | FazBrowse Home | New Git URL |
0 commit comments