| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 75821ba commit 8cf3472
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3166,10 +3166,6 @@ FixedArrayBase* Heap::LeftTrimFixedArray(FixedArrayBase* object, | |||
| 3166 | 3166 | DCHECK(!lo_space()->Contains(object)); | |
| 3167 | 3167 | DCHECK(object->map() != fixed_cow_array_map()); | |
| 3168 | 3168 | ||
| 3169 | - // Ensure that the no handle-scope has more than one pointer to the same | ||
| 3170 | - // backing-store. | ||
| 3171 | - SLOW_DCHECK(CountHandlesForObject(object) <= 1); | ||
| 3172 | - | ||
| 3173 | 3169 | STATIC_ASSERT(FixedArrayBase::kMapOffset == 0); | |
| 3174 | 3170 | STATIC_ASSERT(FixedArrayBase::kLengthOffset == kPointerSize); | |
| 3175 | 3171 | STATIC_ASSERT(FixedArrayBase::kHeaderSize == 2 * kPointerSize); | |
@@ -5671,32 +5667,6 @@ void Heap::PrintHandles() { | |||
| 5671 | 5667 | ||
| 5672 | 5668 | #endif | |
| 5673 | 5669 | ||
| 5674 | - #ifdef ENABLE_SLOW_DCHECKS | ||
| 5675 | - | ||
| 5676 | - class CountHandleVisitor : public ObjectVisitor { | ||
| 5677 | - public: | ||
| 5678 | - explicit CountHandleVisitor(Object* object) : object_(object) {} | ||
| 5679 | - | ||
| 5680 | - void VisitPointers(Object** start, Object** end) override { | ||
| 5681 | - for (Object** p = start; p < end; p++) { | ||
| 5682 | - if (object_ == reinterpret_cast<Object*>(*p)) count_++; | ||
| 5683 | - } | ||
| 5684 | - } | ||
| 5685 | - | ||
| 5686 | - int count() { return count_; } | ||
| 5687 | - | ||
| 5688 | - private: | ||
| 5689 | - Object* object_; | ||
| 5690 | - int count_ = 0; | ||
| 5691 | - }; | ||
| 5692 | - | ||
| 5693 | - int Heap::CountHandlesForObject(Object* object) { | ||
| 5694 | - CountHandleVisitor v(object); | ||
| 5695 | - isolate_->handle_scope_implementer()->Iterate(&v); | ||
| 5696 | - return v.count(); | ||
| 5697 | - } | ||
| 5698 | - #endif | ||
| 5699 | - | ||
| 5700 | 5670 | class CheckHandleCountVisitor : public ObjectVisitor { | |
| 5701 | 5671 | public: | |
| 5702 | 5672 | CheckHandleCountVisitor() : handle_count_(0) {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1394,9 +1394,6 @@ class Heap { | |||
| 1394 | 1394 | void ReportHeapStatistics(const char* title); | |
| 1395 | 1395 | void ReportCodeStatistics(const char* title); | |
| 1396 | 1396 | #endif | |
| 1397 | - #ifdef ENABLE_SLOW_DCHECKS | ||
| 1398 | - int CountHandlesForObject(Object* object); | ||
| 1399 | - #endif | ||
| 1400 | 1397 | ||
| 1401 | 1398 | private: | |
| 1402 | 1399 | class PretenuringScope; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1374,8 +1374,34 @@ class RootMarkingVisitor : public ObjectVisitor { | |||
| 1374 | 1374 | void MarkObjectByPointer(Object** p) { | |
| 1375 | 1375 | if (!(*p)->IsHeapObject()) return; | |
| 1376 | 1376 | ||
| 1377 | - // Replace flat cons strings in place. | ||
| 1378 | 1377 | HeapObject* object = HeapObject::cast(*p); | |
| 1378 | + | ||
| 1379 | + // We cannot avoid stale handles to left-trimmed objects, but can only make | ||
| 1380 | + // sure all handles still needed are updated. Filter out any stale pointers | ||
| 1381 | + // and clear the slot to allow post processing of handles (needed because | ||
| 1382 | + // the sweeper might actually free the underlying page). | ||
| 1383 | + if (object->IsFiller()) { | ||
| 1384 | + #ifdef DEBUG | ||
| 1385 | + // We need to find a FixedArrayBase map after walking the fillers. | ||
| 1386 | + Heap* heap = collector_->heap(); | ||
| 1387 | + HeapObject* current = object; | ||
| 1388 | + while (current->IsFiller()) { | ||
| 1389 | + Address next = reinterpret_cast<Address>(current); | ||
| 1390 | + if (current->map() == heap->one_pointer_filler_map()) { | ||
| 1391 | + next += kPointerSize; | ||
| 1392 | + } else if (current->map() == heap->two_pointer_filler_map()) { | ||
| 1393 | + next += 2 * kPointerSize; | ||
| 1394 | + } else { | ||
| 1395 | + next += current->Size(); | ||
| 1396 | + } | ||
| 1397 | + current = reinterpret_cast<HeapObject*>(next); | ||
| 1398 | + } | ||
| 1399 | + DCHECK(current->IsFixedArrayBase()); | ||
| 1400 | + #endif // DEBUG | ||
| 1401 | + *p = nullptr; | ||
| 1402 | + return; | ||
| 1403 | + } | ||
| 1404 | + | ||
| 1379 | 1405 | MarkBit mark_bit = Marking::MarkBitFrom(object); | |
| 1380 | 1406 | if (Marking::IsBlackOrGrey(mark_bit)) return; | |
| 1381 | 1407 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + // Copyright 2016 the V8 project authors. All rights reserved. | ||
| 2 | + // Use of this source code is governed by a BSD-style license that can be | ||
| 3 | + // found in the LICENSE file. | ||
| 4 | + | ||
| 5 | + // Flags: --expose-gc | ||
| 6 | + | ||
| 7 | + var o0 = []; | ||
| 8 | + var o1 = []; | ||
| 9 | + var cnt = 0; | ||
| 10 | + o1.__defineGetter__(0, function() { | ||
| 11 | + if (cnt++ > 2) return; | ||
| 12 | + o0.shift(); | ||
| 13 | + gc(); | ||
| 14 | + o0.push(0); | ||
| 15 | + o0.concat(o1); | ||
| 16 | + }); | ||
| 17 | + o1[0]; | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments