Revision: 14621
Author:   [email protected]
Date:     Fri May 10 06:04:42 2013
Log:      MIPS: Fix NaN handling for start and end indexes in ArraySlice.

Casting NaN to int is unpredictable, on different architectures it produces different int value.

TEST=test262/S15.4.4.10_A2.1_T2, test262/S15.4.4.10_A2.2_T2

BUG=

Review URL: https://codereview.chromium.org/14812014
http://code.google.com/p/v8/source/detail?r=14621

Modified:
 /branches/bleeding_edge/src/builtins.cc

=======================================
--- /branches/bleeding_edge/src/builtins.cc     Wed May  8 08:02:08 2013
+++ /branches/bleeding_edge/src/builtins.cc     Fri May 10 06:04:42 2013
@@ -845,7 +845,7 @@
       if (start < kMinInt || start > kMaxInt) {
         return CallJsBuiltin(isolate, "ArraySlice", args);
       }
-      relative_start = static_cast<int>(start);
+      relative_start = std::isnan(start) ? 0 : static_cast<int>(start);
     } else if (!arg1->IsUndefined()) {
       return CallJsBuiltin(isolate, "ArraySlice", args);
     }
@@ -858,7 +858,7 @@
         if (end < kMinInt || end > kMaxInt) {
           return CallJsBuiltin(isolate, "ArraySlice", args);
         }
-        relative_end = static_cast<int>(end);
+        relative_end = std::isnan(end) ? 0 : static_cast<int>(end);
       } else if (!arg2->IsUndefined()) {
         return CallJsBuiltin(isolate, "ArraySlice", args);
       }

--
--
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/groups/opt_out.


Reply via email to