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

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 global object hash code. This eated about 5% of weak collection performance 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 633a5d02c45d37ef830afbb221c8e5fc5138e08c..95796c636782d53f9ac6c67a2436e4ea88ae3cfd 100644
--- a/src/math.js
+++ b/src/math.js
@@ -9,6 +9,7 @@ var $exp;
var $floor;
var $max;
var $min;
+var $intrandom;
(function(global, shared, exports) {
@@ -144,6 +145,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));
@@ -361,6 +371,7 @@ $installFunctions(Math, DONT_ENUM, [
$abs = MathAbs;
$exp = MathExp;
$floor = MathFloorJS;
+$intrandom = MathRandomRaw;
adamk 2015/05/21 19:11:32 One more camelCase nit here...$intRandom?
Erik Corry 2015/05/22 06:20:24 Done.
$max = MathMax;
$min = MathMin;

Powered by Google App Engine
This is Rietveld 408576698