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

Unified Diff: src/js/harmony-typedarray.js

Issue 1410473002: Reland: Use simple/fast inline function version of MinMax in JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use existing export in runtime Created 5 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
Index: src/js/harmony-typedarray.js
diff --git a/src/js/harmony-typedarray.js b/src/js/harmony-typedarray.js
index 45e66fddcff389813ea4e470848df7f2b6a7b777..9396e7f258e5e4b06f5e6a6fb51a6d616f209b1c 100644
--- a/src/js/harmony-typedarray.js
+++ b/src/js/harmony-typedarray.js
@@ -48,9 +48,9 @@ var InnerArraySome;
var InnerArraySort;
var InnerArrayToLocaleString;
var IsNaN;
-var MathMax;
-var MathMin;
var PackedArrayReverse;
+var MaxSimple;
Jakob Kummerow 2015/10/15 14:18:48 nit: please preserve alpha-sorting
skomski 2015/10/15 15:17:58 Done.
+var MinSimple;
utils.Import(function(from) {
ArrayFrom = from.ArrayFrom;
@@ -72,9 +72,9 @@ utils.Import(function(from) {
InnerArraySort = from.InnerArraySort;
InnerArrayToLocaleString = from.InnerArrayToLocaleString;
IsNaN = from.IsNaN;
- MathMax = from.MathMax;
- MathMin = from.MathMin;
PackedArrayReverse = from.PackedArrayReverse;
+ MaxSimple = from.MaxSimple;
+ MinSimple = from.MinSimple;
});
// -------------------------------------------------------------------
@@ -319,9 +319,9 @@ function TypedArraySlice(start, end) {
var k;
if (relativeStart < 0) {
- k = MathMax(len + relativeStart, 0);
+ k = MaxSimple(len + relativeStart, 0);
} else {
- k = MathMin(relativeStart, len);
+ k = MinSimple(relativeStart, len);
}
var relativeEnd;
@@ -333,12 +333,12 @@ function TypedArraySlice(start, end) {
var final;
if (relativeEnd < 0) {
- final = MathMax(len + relativeEnd, 0);
+ final = MaxSimple(len + relativeEnd, 0);
} else {
- final = MathMin(relativeEnd, len);
+ final = MinSimple(relativeEnd, len);
}
- var count = MathMax(final - k, 0);
+ var count = MaxSimple(final - k, 0);
var array = ConstructTypedArrayLike(this, count);
// The code below is the 'then' branch; the 'else' branch species
// a memcpy. Because V8 doesn't canonicalize NaN, the difference is

Powered by Google App Engine
This is Rietveld 408576698