Reviewers: Yang,

Message:
PTAL

Description:
Fix NoSideEffectToString.

Remove unneccessary check for non-overridden toString - it will not be called
anyway.

[email protected]

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

Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge

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


Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 2dddffa57ad8cae08d6f445116558dac18e7d4a4..9d67d9ca4e216d8d72ac3e702e8e71cbfce52810 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -223,7 +223,10 @@ function NoSideEffectToString(obj) {
     return str;
   }
   if (IS_SYMBOL(obj)) return %_CallFunction(obj, SymbolToString);
- if (IS_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) {
+  if (CanBeSafelyTreatedAsAnErrorObject(obj)) {
+    return %_CallFunction(obj, ErrorToString);
+  }
+  if (IS_OBJECT(obj)) {
     var constructor = %GetDataProperty(obj, "constructor");
     if (typeof constructor == "function") {
       var constructorName = constructor.name;
@@ -232,9 +235,6 @@ function NoSideEffectToString(obj) {
       }
     }
   }
-  if (CanBeSafelyTreatedAsAnErrorObject(obj)) {
-    return %_CallFunction(obj, ErrorToString);
-  }
   return %_CallFunction(obj, ObjectToString);
 }



--
--
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