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

Unified Diff: src/math.js

Issue 1149863005: Move hash code from hidden string to a private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MIPS Created 5 years, 7 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
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index d620906d1893d2b0f92fc64e7d2e426cb9b6d1df..74ae1ee547f0d719e58ad687511a4c95a579f359 100644
--- a/src/math.js
+++ b/src/math.js
@@ -5,7 +5,6 @@
var rngstate; // Initialized to a Uint32Array during genesis.
(function(global, utils) {
-
"use strict";
%CheckIsBootstrapping();
@@ -138,6 +137,15 @@ function MathRandom() {
return (x < 0 ? (x + 0x100000000) : x) * 2.3283064365386962890625e-10;
}
+function MathRandomRaw() {
+ var r0 = (MathImul(18030, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0;
+ rngstate[0] = r0;
+ var r1 = (MathImul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0;
+ rngstate[1] = r1;
+ var x = ((r0 << 16) + (r1 & 0xFFFF)) | 0;
+ return x & 0x3fffffff;
+}
+
// ECMA 262 - 15.8.2.15
function MathRound(x) {
return %RoundNumber(TO_NUMBER_INLINE(x));
@@ -358,6 +366,7 @@ utils.Export(function(to) {
to.MathAbs = MathAbs;
to.MathExp = MathExp;
to.MathFloor = MathFloorJS;
+ to.IntRandom = MathRandomRaw;
to.MathMax = MathMax;
to.MathMin = MathMin;
});

Powered by Google App Engine
This is Rietveld 408576698