Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index 22f888d814194c92216cd933f3310c627ef664a5..348fd747f5b9171c45b493bc824d92a4ba725911 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -658,7 +658,6 @@ function DefaultNumber(x) { |
throw %MakeTypeError('cannot_convert_to_primitive', []); |
} |
- |
// ECMA-262, section 8.6.2.6, page 28. |
function DefaultString(x) { |
var toString = x.toString; |
@@ -676,6 +675,12 @@ function DefaultString(x) { |
throw %MakeTypeError('cannot_convert_to_primitive', []); |
} |
+function ToPositiveInteger(x, rangeErrorName) { |
+ var i = TO_INTEGER(x); |
+ if (i < 0) throw %MakeRangeError(rangeErrorName); |
+ return i; |
+} |
+ |
// NOTE: Setting the prototype for Array must take place as early as |
// possible due to code generation for array literals. When |