Reviewers: Paul Lind, palfia, kisg, danno, Michael Starzinger,

Description:
MIPS: Fix NaN handling for start index in ArraySplice.

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

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

BUG=

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

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

Affected files:
  M src/builtins.cc


Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 30edf579e62234fdd162af7a8ea99c6fb580f0ee..b10495eb3b2d3c0e40adcf5a94148c9dfb0f41eb 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -934,7 +934,7 @@ BUILTIN(ArraySplice) {
       if (start < kMinInt || start > kMaxInt) {
         return CallJsBuiltin(isolate, "ArraySplice", args);
       }
-      relative_start = static_cast<int>(start);
+      relative_start = std::isnan(start) ? 0 : static_cast<int>(start);
     } else if (!arg1->IsUndefined()) {
       return CallJsBuiltin(isolate, "ArraySplice", 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