Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/objects.cc

Issue 2129933002: If we can't rehash the backing store for weak sets & maps, do a last resort GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 17729 matching lines...) Expand 10 before | Expand all | Expand 10 after
17740 if (entry != kNotFound) { 17740 if (entry != kNotFound) {
17741 table->set(EntryToIndex(entry) + 1, *value); 17741 table->set(EntryToIndex(entry) + 1, *value);
17742 return table; 17742 return table;
17743 } 17743 }
17744 17744
17745 // Rehash if more than 33% of the entries are deleted entries. 17745 // Rehash if more than 33% of the entries are deleted entries.
17746 // TODO(jochen): Consider to shrink the fixed array in place. 17746 // TODO(jochen): Consider to shrink the fixed array in place.
17747 if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) { 17747 if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
17748 table->Rehash(isolate->factory()->undefined_value()); 17748 table->Rehash(isolate->factory()->undefined_value());
17749 } 17749 }
17750 // If we're out of luck, we didn't get a GC recently, and so rehashing
17751 // isn't enough to avoid a crash.
17752 int nof = table->NumberOfElements() + 1;
17753 if (!table->HasSufficientCapacity(nof)) {
17754 int capacity = ObjectHashTable::ComputeCapacity(nof * 2);
17755 if (capacity > ObjectHashTable::kMaxCapacity) {
17756 for (size_t i = 0; i < 2; ++i) {
17757 isolate->heap()->CollectAllGarbage(
17758 Heap::kFinalizeIncrementalMarkingMask, "full object hash table");
17759 }
17760 table->Rehash(isolate->factory()->undefined_value());
17761 }
17762 }
17750 17763
17751 // Check whether the hash table should be extended. 17764 // Check whether the hash table should be extended.
17752 table = EnsureCapacity(table, 1, key); 17765 table = EnsureCapacity(table, 1, key);
17753 table->AddEntry(table->FindInsertionEntry(hash), *key, *value); 17766 table->AddEntry(table->FindInsertionEntry(hash), *key, *value);
17754 return table; 17767 return table;
17755 } 17768 }
17756 17769
17757 17770
17758 Handle<ObjectHashTable> ObjectHashTable::Remove(Handle<ObjectHashTable> table, 17771 Handle<ObjectHashTable> ObjectHashTable::Remove(Handle<ObjectHashTable> table,
17759 Handle<Object> key, 17772 Handle<Object> key,
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
18978 18991
18979 Object* data_obj = 18992 Object* data_obj =
18980 constructor->shared()->get_api_func_data()->access_check_info(); 18993 constructor->shared()->get_api_func_data()->access_check_info();
18981 if (data_obj->IsUndefined(isolate)) return nullptr; 18994 if (data_obj->IsUndefined(isolate)) return nullptr;
18982 18995
18983 return AccessCheckInfo::cast(data_obj); 18996 return AccessCheckInfo::cast(data_obj);
18984 } 18997 }
18985 18998
18986 } // namespace internal 18999 } // namespace internal
18987 } // namespace v8 19000 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698