From: bmeurer Date: Mon, 10 Aug 2015 06:07:20 +0000 (-0700) Subject: [runtime] Remove premature optimization from ToPrimitive. X-Git-Tag: upstream/4.7.83~959 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c674828dc2bdefd6f111d278408a938686edcfd;p=platform%2Fupstream%2Fv8.git [runtime] Remove premature optimization from ToPrimitive. 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} --- diff --git a/src/runtime.js b/src/runtime.js index 21b3da923..a120d9648 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -750,11 +750,7 @@ TO_NAME = function TO_NAME() { // 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); }