Index: src/js/runtime.js |
diff --git a/src/js/runtime.js b/src/js/runtime.js |
index 216685fe4f2692eba560e0be9aedd03a919b6c01..4983d81df738f3a9754dd55efad580b2ae454d42 100644 |
--- a/src/js/runtime.js |
+++ b/src/js/runtime.js |
@@ -45,6 +45,13 @@ function ToPositiveInteger(x, rangeErrorIndex) { |
} |
+function ToIndex(x, rangeErrorIndex) { |
+ var i = TO_INTEGER(x) + 0; |
+ if (i < 0 || i > kMaxSafeInteger) throw MakeRangeError(rangeErrorIndex); |
+ return i; |
+} |
+ |
+ |
function MaxSimple(a, b) { |
return a > b ? a : b; |
} |
@@ -94,6 +101,7 @@ utils.Export(function(to) { |
to.MaxSimple = MaxSimple; |
to.MinSimple = MinSimple; |
to.ToPositiveInteger = ToPositiveInteger; |
+ to.ToIndex = ToIndex; |
to.SpeciesConstructor = SpeciesConstructor; |
}); |