The !IS_SPEC_OBJECT(x) check implies both IS_STRING(x) and
IS_SIMD_VALUE(x), and generates shorter/better code. So we
can safely remove the redundant checks.
R=rossberg@chromium.org
Review URL: https://codereview.chromium.org/
1278873007
Cr-Commit-Position: refs/heads/master@{#30081}
// ECMA-262, section 9.1, page 30. Use null/undefined for no hint,
// (1) for number hint, and (2) for string hint.
function ToPrimitive(x, hint) {
- // Fast case check.
- if (IS_STRING(x)) return x;
- // Normal behavior.
if (!IS_SPEC_OBJECT(x)) return x;
- if (IS_SIMD_VALUE(x)) return x;
if (hint == NO_HINT) hint = (IS_DATE(x)) ? STRING_HINT : NUMBER_HINT;
return (hint == NUMBER_HINT) ? DefaultNumber(x) : DefaultString(x);
}