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

Unified Diff: src/heap/heap.cc

Issue 2395233003: [modules] Give Module an internal [hash] field (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.cc ('k') | src/isolate.h » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index b15a5d2790a91ca54aa35553e9aa3525e93d20ed..ee77e2e8e32979f099987cfe848b9deea19a039d 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4023,13 +4023,7 @@ AllocationResult Heap::AllocateSymbol() {
result->set_map_no_write_barrier(symbol_map());
// Generate a random hash value.
- int hash;
- int attempts = 0;
- do {
- hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask;
- attempts++;
- } while (hash == 0 && attempts < 30);
- if (hash == 0) hash = 1; // never return 0
+ int hash = isolate()->GenerateIdentityHash(Name::kHashBitMask);
Symbol::cast(result)
->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift));
« no previous file with comments | « src/factory.cc ('k') | src/isolate.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698