Browse Source

Revert "deps: backport e093a04, 09db540 from upstream V8"

This reverts commit 2d07fd71ee, with the
exception of the `V8_PATCH_LEVEL` which will continue to increase.

This commit was intended to be a backport of v8's e093a04 and 09db540,
but it failed to consider the reversion of e093a04 in 5f5a328.

PR-URL: https://github.com/nodejs/node/pull/14829
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v4.x-staging
Jesse Rosenberger 7 years ago
committed by Myles Borins
parent
commit
df23963e82
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 7
      deps/v8/src/heap/mark-compact.cc
  2. 4
      deps/v8/src/heap/mark-compact.h
  3. 26
      deps/v8/src/objects.cc
  4. 2
      deps/v8/test/cctest/test-weakmaps.cc
  5. 4
      deps/v8/test/cctest/test-weaksets.cc

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

@ -2614,13 +2614,6 @@ void MarkCompactCollector::ClearWeakCollections() {
table->RemoveEntry(i);
}
}
// Rehash if more than 25% of the entries are deleted entries.
// TODO(jochen): Consider to shrink the fixed array in place.
if ((table->NumberOfDeletedElements() << kJSWeakCollectionLoadFactorExp) >
table->NumberOfElements()) {
HandleScope scope(heap()->isolate());
table->Rehash(heap()->isolate()->factory()->undefined_value());
}
}
weak_collection_obj = weak_collection->next();
weak_collection->set_next(heap()->undefined_value());

4
deps/v8/src/heap/mark-compact.h

@ -612,10 +612,6 @@ class MarkCompactCollector {
static const uint32_t kSingleFreeEncoding = 0;
static const uint32_t kMultiFreeEncoding = 1;
// If the number of deleted slots in a JSWeakCollection exceeds the number
// of entries / 2^(factor), we rehash the table.
static const int kJSWeakCollectionLoadFactorExp = 1;
static inline bool IsMarked(Object* obj);
static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p);

26
deps/v8/src/objects.cc

@ -13744,16 +13744,6 @@ void HashTable<Derived, Shape, Key>::Rehash(Key key) {
}
}
}
// Wipe deleted entries.
Heap* heap = GetHeap();
Object* the_hole = heap->the_hole_value();
Object* undefined = heap->undefined_value();
for (uint32_t current = 0; current < capacity; current++) {
if (get(EntryToIndex(current)) == the_hole) {
set(EntryToIndex(current), undefined);
}
}
SetNumberOfDeletedElements(0);
}
@ -14677,7 +14667,6 @@ Handle<CompilationCacheTable> CompilationCacheTable::PutRegExp(
void CompilationCacheTable::Age() {
DisallowHeapAllocation no_allocation;
Object* the_hole_value = GetHeap()->the_hole_value();
uint32_t capacity = Capacity();
for (int entry = 0, size = Capacity(); entry < size; entry++) {
int entry_index = EntryToIndex(entry);
int value_index = entry_index + 1;
@ -14701,16 +14690,6 @@ void CompilationCacheTable::Age() {
}
}
}
// Wipe deleted entries.
Heap* heap = GetHeap();
Object* the_hole = heap->the_hole_value();
Object* undefined = heap->undefined_value();
for (uint32_t current = 0; current < capacity; current++) {
if (get(EntryToIndex(current)) == the_hole) {
set(EntryToIndex(current), undefined);
}
}
SetNumberOfDeletedElements(0);
}
@ -15219,11 +15198,6 @@ Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
return table;
}
// Rehash if more than 25% of the entries are deleted entries.
// TODO(jochen): Consider to shrink the fixed array in place.
if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
table->Rehash(isolate->factory()->undefined_value());
}
// If we're out of luck, we didn't get a GC recently, and so rehashing
// isn't enough to avoid a crash.
if (!table->HasSufficientCapacityToAdd(1)) {

2
deps/v8/test/cctest/test-weakmaps.cc

@ -123,7 +123,7 @@ TEST(Weakness) {
heap->CollectAllGarbage(false);
CHECK_EQ(1, NumberOfWeakCalls);
CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
CHECK_EQ(0,
CHECK_EQ(2,
ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
}

4
deps/v8/test/cctest/test-weaksets.cc

@ -122,8 +122,8 @@ TEST(WeakSet_Weakness) {
heap->CollectAllGarbage(false);
CHECK_EQ(1, NumberOfWeakCalls);
CHECK_EQ(0, ObjectHashTable::cast(weakset->table())->NumberOfElements());
CHECK_EQ(0,
ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements());
CHECK_EQ(
1, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements());
}

Loading…
Cancel
Save