Reviewers: rossberg,

Description:
[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.

[email protected]

Please review this at https://codereview.chromium.org/1278873007/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+0, -4 lines):
  M src/runtime.js


Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 5e37e26c3c9d7df7bcf802c01bfe0fbc04633c34..a05cca19222e111fafe354d5ea12f115e530d255 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -752,11 +752,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);
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to