Index: src/runtime/runtime-array.cc |
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc |
index 5538fb4c28afc84838552b8bdc36bc8f306bd12b..0ac965566c9ab46d2993b11e82e0ac2b6f3f1264 100644 |
--- a/src/runtime/runtime-array.cc |
+++ b/src/runtime/runtime-array.cc |
@@ -568,7 +568,15 @@ 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()) && |
+ fp < static_cast<double>(std::numeric_limits<int64_t>::max()))) { |
Jakob Kummerow
2017/05/09 11:03:32
You don't need the second condition; the "fp > len
predrag.rudic
2017/05/09 12:43:08
Acknowledged.
|
+ start_from = static_cast<int64_t>(fp); |
+ } else { |
+ start_from = fp < static_cast<double>(std::numeric_limits<int64_t>::min()) |
Jakob Kummerow
2017/05/09 11:03:32
...and then you don't need a case distinction here
predrag.rudic
2017/05/09 12:43:07
Acknowledged.
|
+ ? std::numeric_limits<int64_t>::min() |
+ : std::numeric_limits<int64_t>::max(); |
+ } |
} |
int64_t index; |