Commit 88fa6685 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Implement ToLength from ES6 section 7.1.15

BUG=
R=rossberg@chromium.org

Review URL: https://codereview.chromium.org/552273002

Patch from Caitlin Potter <caitpotter88@gmail.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24036 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a1a0f465
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment