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

Unified Diff: src/heap/heap.cc

Issue 2395233003: [modules] Give Module an internal [hash] field (Closed)
Patch Set: Fix merge 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') | no next file with comments »
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 f6a1b3551ba57a59cfcd4bdc6e102650379f4af2..ac92f07a829785c384ae3faeb4d33073b855d5a5 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4014,13 +4014,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698