Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a234d44

Browse filesBrowse files
committed
deps: backport a715957 from V8 upstream
This commit does not include the changes to `src/heap/scavenger.cc`. These changes would revert the changes that should have come in 086bd5aede, meaning that there is no issue with that change missing in the previous commit. Original commit message: Iterate handles with special left-trim visitor BUG=chromium:620553 LOG=N R=hpayer@chromium.org Review-Url: https://codereview.chromium.org/2102243002 Cr-Commit-Position: refs/heads/master@{#37366} PR-URL: #10668 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
1 parent ce66c8e commit a234d44
Copy full SHA for a234d44

File tree

Expand file treeCollapse file tree

4 files changed

+45
-33
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+45
-33
lines changed
Open diff view settings
Collapse file

‎deps/v8/src/heap/heap-inl.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/heap-inl.h
-25Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -398,31 +398,6 @@ void Heap::CopyBlock(Address dst, Address src, int byte_size) {
398398
static_cast<size_t>(byte_size / kPointerSize));
399399
}
400400

401-
bool Heap::PurgeLeftTrimmedObject(Object** object) {
402-
HeapObject* current = reinterpret_cast<HeapObject*>(*object);
403-
const MapWord map_word = current->map_word();
404-
if (current->IsFiller() && !map_word.IsForwardingAddress()) {
405-
#ifdef DEBUG
406-
// We need to find a FixedArrayBase map after walking the fillers.
407-
while (current->IsFiller()) {
408-
Address next = reinterpret_cast<Address>(current);
409-
if (current->map() == one_pointer_filler_map()) {
410-
next += kPointerSize;
411-
} else if (current->map() == two_pointer_filler_map()) {
412-
next += 2 * kPointerSize;
413-
} else {
414-
next += current->Size();
415-
}
416-
current = reinterpret_cast<HeapObject*>(next);
417-
}
418-
DCHECK(current->IsFixedArrayBase());
419-
#endif // DEBUG
420-
*object = nullptr;
421-
return true;
422-
}
423-
return false;
424-
}
425-
426401
void Heap::MoveBlock(Address dst, Address src, int byte_size) {
427402
DCHECK(IsAligned(byte_size, kPointerSize));
428403

Collapse file

‎deps/v8/src/heap/heap.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/heap.cc
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5316,6 +5316,49 @@ void Heap::IterateSmiRoots(ObjectVisitor* v) {
53165316
v->Synchronize(VisitorSynchronization::kSmiRootList);
53175317
}
53185318

5319+
// We cannot avoid stale handles to left-trimmed objects, but can only make
5320+
// sure all handles still needed are updated. Filter out a stale pointer
5321+
// and clear the slot to allow post processing of handles (needed because
5322+
// the sweeper might actually free the underlying page).
5323+
class FixStaleLeftTrimmedHandlesVisitor : public ObjectVisitor {
5324+
public:
5325+
explicit FixStaleLeftTrimmedHandlesVisitor(Heap* heap) : heap_(heap) {
5326+
USE(heap_);
5327+
}
5328+
5329+
void VisitPointer(Object** p) override { FixHandle(p); }
5330+
5331+
void VisitPointers(Object** start, Object** end) override {
5332+
for (Object** p = start; p < end; p++) FixHandle(p);
5333+
}
5334+
5335+
private:
5336+
inline void FixHandle(Object** p) {
5337+
HeapObject* current = reinterpret_cast<HeapObject*>(*p);
5338+
if (!current->IsHeapObject()) return;
5339+
const MapWord map_word = current->map_word();
5340+
if (!map_word.IsForwardingAddress() && current->IsFiller()) {
5341+
#ifdef DEBUG
5342+
// We need to find a FixedArrayBase map after walking the fillers.
5343+
while (current->IsFiller()) {
5344+
Address next = reinterpret_cast<Address>(current);
5345+
if (current->map() == heap_->one_pointer_filler_map()) {
5346+
next += kPointerSize;
5347+
} else if (current->map() == heap_->two_pointer_filler_map()) {
5348+
next += 2 * kPointerSize;
5349+
} else {
5350+
next += current->Size();
5351+
}
5352+
current = reinterpret_cast<HeapObject*>(next);
5353+
}
5354+
DCHECK(current->IsFixedArrayBase());
5355+
#endif // DEBUG
5356+
*p = nullptr;
5357+
}
5358+
}
5359+
5360+
Heap* heap_;
5361+
};
53195362

53205363
void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
53215364
v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]);
@@ -5339,6 +5382,8 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
53395382
v->Synchronize(VisitorSynchronization::kCompilationCache);
53405383

53415384
// Iterate over local handles in handle scopes.
5385+
FixStaleLeftTrimmedHandlesVisitor left_trim_visitor(this);
5386+
isolate_->handle_scope_implementer()->Iterate(&left_trim_visitor);
53425387
isolate_->handle_scope_implementer()->Iterate(v);
53435388
isolate_->IterateDeferredHandles(v);
53445389
v->Synchronize(VisitorSynchronization::kHandleScope);
Collapse file

‎deps/v8/src/heap/heap.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/heap.h
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,12 +590,6 @@ class Heap {
590590
// jslimit_/real_jslimit_ variable in the StackGuard.
591591
void SetStackLimits();
592592

593-
// We cannot avoid stale handles to left-trimmed objects, but can only make
594-
// sure all handles still needed are updated. Filter out a stale pointer
595-
// and clear the slot to allow post processing of handles (needed because
596-
// the sweeper might actually free the underlying page).
597-
inline bool PurgeLeftTrimmedObject(Object** object);
598-
599593
// Notifies the heap that is ok to start marking or other activities that
600594
// should not happen during deserialization.
601595
void NotifyDeserializationComplete();
Collapse file

‎deps/v8/src/heap/mark-compact.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/mark-compact.cc
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,6 @@ class RootMarkingVisitor : public ObjectVisitor {
16501650

16511651
HeapObject* object = ShortCircuitConsString(p);
16521652

1653-
if (collector_->heap()->PurgeLeftTrimmedObject(p)) return;
1654-
16551653
MarkBit mark_bit = Marking::MarkBitFrom(object);
16561654
if (Marking::IsBlackOrGrey(mark_bit)) return;
16571655

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.