Index: src/js/runtime.js |
diff --git a/src/js/runtime.js b/src/js/runtime.js |
index b3c4addce873cec20b97bb50a42a53faad3050e1..550b3e4afb1f6aef7a38363afa09b996b8f2f7a0 100644 |
--- a/src/js/runtime.js |
+++ b/src/js/runtime.js |
@@ -41,6 +41,13 @@ function ToPositiveInteger(x, rangeErrorIndex) { |
} |
+function ToIndex(x, rangeErrorIndex) { |
+ var i = TO_INTEGER(x) + 0; |
+ if (i < 0 || i > kMaxSafeInteger) throw %make_range_error(rangeErrorIndex); |
+ return i; |
+} |
+ |
+ |
function MaxSimple(a, b) { |
return a > b ? a : b; |
} |
@@ -90,6 +97,7 @@ utils.Export(function(to) { |
to.MaxSimple = MaxSimple; |
to.MinSimple = MinSimple; |
to.ToPositiveInteger = ToPositiveInteger; |
+ to.ToIndex = ToIndex; |
to.SpeciesConstructor = SpeciesConstructor; |
}); |