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

Side by Side Diff: src/js/collection.js

Issue 2109483004: [builtins] Drop the special MathRandomRaw. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix off-by-one. 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 | src/js/math.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 (function(global, utils) { 5 (function(global, utils) {
6 "use strict"; 6 "use strict";
7 7
8 %CheckIsBootstrapping(); 8 %CheckIsBootstrapping();
9 9
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
11 // Imports 11 // Imports
12 12
13 var GlobalMap = global.Map; 13 var GlobalMap = global.Map;
14 var GlobalObject = global.Object; 14 var GlobalObject = global.Object;
15 var GlobalSet = global.Set; 15 var GlobalSet = global.Set;
16 var hashCodeSymbol = utils.ImportNow("hash_code_symbol"); 16 var hashCodeSymbol = utils.ImportNow("hash_code_symbol");
17 var IntRandom; 17 var MathRandom;
18 var MakeTypeError; 18 var MakeTypeError;
19 var MapIterator; 19 var MapIterator;
20 var NumberIsNaN; 20 var NumberIsNaN;
21 var SetIterator; 21 var SetIterator;
22 var speciesSymbol = utils.ImportNow("species_symbol"); 22 var speciesSymbol = utils.ImportNow("species_symbol");
23 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 23 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
24 24
25 utils.Import(function(from) { 25 utils.Import(function(from) {
26 IntRandom = from.IntRandom; 26 MathRandom = from.MathRandom;
27 MakeTypeError = from.MakeTypeError; 27 MakeTypeError = from.MakeTypeError;
28 MapIterator = from.MapIterator; 28 MapIterator = from.MapIterator;
29 NumberIsNaN = from.NumberIsNaN; 29 NumberIsNaN = from.NumberIsNaN;
30 SetIterator = from.SetIterator; 30 SetIterator = from.SetIterator;
31 }); 31 });
32 32
33 // ------------------------------------------------------------------- 33 // -------------------------------------------------------------------
34 34
35 function HashToEntry(table, hash, numBuckets) { 35 function HashToEntry(table, hash, numBuckets) {
36 var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets); 36 var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return hash; 106 return hash;
107 } 107 }
108 return %GenericHash(key); 108 return %GenericHash(key);
109 } 109 }
110 %SetForceInlineFlag(GetExistingHash); 110 %SetForceInlineFlag(GetExistingHash);
111 111
112 112
113 function GetHash(key) { 113 function GetHash(key) {
114 var hash = GetExistingHash(key); 114 var hash = GetExistingHash(key);
115 if (IS_UNDEFINED(hash)) { 115 if (IS_UNDEFINED(hash)) {
116 hash = IntRandom() | 0; 116 hash = (MathRandom() * 0x40000000) | 0;
117 if (hash === 0) hash = 1; 117 if (hash === 0) hash = 1;
118 SET_PRIVATE(key, hashCodeSymbol, hash); 118 SET_PRIVATE(key, hashCodeSymbol, hash);
119 } 119 }
120 return hash; 120 return hash;
121 } 121 }
122 %SetForceInlineFlag(GetHash); 122 %SetForceInlineFlag(GetHash);
123 123
124 124
125 // ------------------------------------------------------------------- 125 // -------------------------------------------------------------------
126 // Harmony Set 126 // Harmony Set
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 "set_has", SetHas, 485 "set_has", SetHas,
486 "set_delete", SetDelete, 486 "set_delete", SetDelete,
487 ]); 487 ]);
488 488
489 utils.Export(function(to) { 489 utils.Export(function(to) {
490 to.GetExistingHash = GetExistingHash; 490 to.GetExistingHash = GetExistingHash;
491 to.GetHash = GetHash; 491 to.GetHash = GetHash;
492 }); 492 });
493 493
494 }) 494 })
OLDNEW
« no previous file with comments | « no previous file | src/js/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698