Index: src/crankshaft/hydrogen.cc |
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc |
index d17696d351117250eddbe7c84948ea78ca7085bb..a28fb3f30b4d481a47eba912b5bcc26bc2249a15 100644 |
--- a/src/crankshaft/hydrogen.cc |
+++ b/src/crankshaft/hydrogen.cc |
@@ -7508,6 +7508,12 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr, |
HValue* string = Pop(); |
HInstruction* char_code = BuildStringCharCodeAt(string, index); |
AddInstruction(char_code); |
+ if (char_code->IsConstant()) { |
+ HConstant* c_code = HConstant::cast(char_code); |
+ if (c_code->HasNumberValue() && std::isnan(c_code->DoubleValue())) { |
+ Add<HDeoptimize>(DeoptimizeReason::kOutOfBounds, Deoptimizer::EAGER); |
+ } |
+ } |
instr = NewUncasted<HStringCharFromCode>(char_code); |
} else if (expr->key()->IsPropertyName()) { |