Commit 50e19547 authored by bmeurer's avatar bmeurer Committed by Commit bot

[builtins] Drop the special MathRandomRaw.

This is the last user of %_DoubleLo and actually unnecessary, since we
can just use the normal Math.random() instead.

R=yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2109483004
Cr-Commit-Position: refs/heads/master@{#37359}
parent 0e1eaec7
......@@ -14,7 +14,7 @@ var GlobalMap = global.Map;
var GlobalObject = global.Object;
var GlobalSet = global.Set;
var hashCodeSymbol = utils.ImportNow("hash_code_symbol");
var IntRandom;
var MathRandom;
var MakeTypeError;
var MapIterator;
var NumberIsNaN;
......@@ -23,7 +23,7 @@ var speciesSymbol = utils.ImportNow("species_symbol");
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
utils.Import(function(from) {
IntRandom = from.IntRandom;
MathRandom = from.MathRandom;
MakeTypeError = from.MakeTypeError;
MapIterator = from.MapIterator;
NumberIsNaN = from.NumberIsNaN;
......@@ -113,7 +113,7 @@ function GetExistingHash(key) {
function GetHash(key) {
var hash = GetExistingHash(key);
if (IS_UNDEFINED(hash)) {
hash = IntRandom() | 0;
hash = (MathRandom() * 0x40000000) | 0;
if (hash === 0) hash = 1;
SET_PRIVATE(key, hashCodeSymbol, hash);
}
......
......@@ -47,14 +47,6 @@ function MathRandom() {
return randomNumbers[--nextRandomIndex];
}
function MathRandomRaw() {
if (nextRandomIndex <= kRandomNumberStart) {
randomNumbers = %GenerateRandomNumbers(randomNumbers);
nextRandomIndex = %_TypedArrayGetLength(randomNumbers);
}
return %_DoubleLo(randomNumbers[--nextRandomIndex]) & 0x3FFFFFFF;
}
// ES6 draft 09-27-13, section 20.2.2.28.
function MathSign(x) {
x = +x;
......@@ -142,7 +134,7 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
utils.Export(function(to) {
to.MathAbs = MathAbs;
to.IntRandom = MathRandomRaw;
to.MathRandom = MathRandom;
});
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment