Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/builtins.cc

Issue 14257006: MIPS: Fix NaN handling for start index in ArraySplice. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 int relative_start = 0; 927 int relative_start = 0;
928 if (n_arguments > 0) { 928 if (n_arguments > 0) {
929 Object* arg1 = args[1]; 929 Object* arg1 = args[1];
930 if (arg1->IsSmi()) { 930 if (arg1->IsSmi()) {
931 relative_start = Smi::cast(arg1)->value(); 931 relative_start = Smi::cast(arg1)->value();
932 } else if (arg1->IsHeapNumber()) { 932 } else if (arg1->IsHeapNumber()) {
933 double start = HeapNumber::cast(arg1)->value(); 933 double start = HeapNumber::cast(arg1)->value();
934 if (start < kMinInt || start > kMaxInt) { 934 if (start < kMinInt || start > kMaxInt) {
935 return CallJsBuiltin(isolate, "ArraySplice", args); 935 return CallJsBuiltin(isolate, "ArraySplice", args);
936 } 936 }
937 relative_start = static_cast<int>(start); 937 relative_start = std::isnan(start) ? 0 : static_cast<int>(start);
938 } else if (!arg1->IsUndefined()) { 938 } else if (!arg1->IsUndefined()) {
939 return CallJsBuiltin(isolate, "ArraySplice", args); 939 return CallJsBuiltin(isolate, "ArraySplice", args);
940 } 940 }
941 } 941 }
942 int actual_start = (relative_start < 0) ? Max(len + relative_start, 0) 942 int actual_start = (relative_start < 0) ? Max(len + relative_start, 0)
943 : Min(relative_start, len); 943 : Min(relative_start, len);
944 944
945 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is 945 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is
946 // given as a request to delete all the elements from the start. 946 // given as a request to delete all the elements from the start.
947 // And it differs from the case of undefined delete count. 947 // And it differs from the case of undefined delete count.
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 return Handle<Code>(code_address); \ 1867 return Handle<Code>(code_address); \
1868 } 1868 }
1869 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1869 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1870 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1870 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1871 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1871 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1872 #undef DEFINE_BUILTIN_ACCESSOR_C 1872 #undef DEFINE_BUILTIN_ACCESSOR_C
1873 #undef DEFINE_BUILTIN_ACCESSOR_A 1873 #undef DEFINE_BUILTIN_ACCESSOR_A
1874 1874
1875 1875
1876 } } // namespace v8::internal 1876 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698