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

Unified Diff: src/runtime/runtime-array.cc

Issue 2865113005: [runtime function] Fix IndexOf when start is -Infinity (Closed)
Patch Set: Corrected2 Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index 5538fb4c28afc84838552b8bdc36bc8f306bd12b..56d9cf40a55a7ed72e0f6c6283298dd4758f63a1 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -568,7 +568,13 @@ RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
Object::ToInteger(isolate, from_index));
double fp = from_index->Number();
if (fp > len) return Smi::FromInt(-1);
- start_from = static_cast<int64_t>(fp);
+ if (V8_LIKELY(fp >=
+ static_cast<double>(std::numeric_limits<int64_t>::min()))) {
+ DCHECK(fp < std::numeric_limits<int64_t>::max());
+ start_from = static_cast<int64_t>(fp);
+ } else {
+ start_from = std::numeric_limits<int64_t>::min();
+ }
}
int64_t index;
« 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