Index: src/runtime.js |
diff --git a/src/runtime.js b/src/runtime.js |
index d9e1fe5c994030f40461167faac8b3df4d60ff22..4d15d205a495b6623cf399ccd0dd36973cac22c4 100644 |
--- a/src/runtime.js |
+++ b/src/runtime.js |
@@ -563,6 +563,14 @@ function ToInteger(x) { |
} |
+// ES6, draft 08-24-14, section 7.1.15 |
+function ToLength(arg) { |
+ arg = ToInteger(arg); |
+ if (arg < 0) return 0; |
+ return arg < $Number.MAX_SAFE_INTEGER ? arg : $Number.MAX_SAFE_INTEGER; |
+} |
+ |
+ |
// ECMA-262, section 9.6, page 34. |
function ToUint32(x) { |
if (%_IsSmi(x) && x >= 0) return x; |