From 0c674828dc2bdefd6f111d278408a938686edcfd Mon Sep 17 00:00:00 2001 From: bmeurer Date: Sun, 9 Aug 2015 23:07:20 -0700 Subject: [PATCH] [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} --- src/runtime.js | 4 ---- 1 file changed, 4 deletions(-) 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); } -- 2.34.1