| Index: src/crankshaft/hydrogen-instructions.cc
|
| diff --git a/src/crankshaft/hydrogen-instructions.cc b/src/crankshaft/hydrogen-instructions.cc
|
| index 465a18ae46e6145d08cb35d5156306cc3ab378d3..8e1d891b47824a0533b93968d1d7ae20ee69df39 100644
|
| --- a/src/crankshaft/hydrogen-instructions.cc
|
| +++ b/src/crankshaft/hydrogen-instructions.cc
|
| @@ -3572,7 +3572,10 @@ HInstruction* HDiv::New(Isolate* isolate, Zone* zone, HValue* context,
|
| HConstant* c_left = HConstant::cast(left);
|
| HConstant* c_right = HConstant::cast(right);
|
| if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
|
| - if (c_right->DoubleValue() != 0) {
|
| + if (std::isnan(c_left->DoubleValue()) ||
|
| + std::isnan(c_right->DoubleValue())) {
|
| + return H_CONSTANT_DOUBLE(std::numeric_limits<double>::quiet_NaN());
|
| + } else if (c_right->DoubleValue() != 0) {
|
| double double_res = c_left->DoubleValue() / c_right->DoubleValue();
|
| if (IsInt32Double(double_res)) {
|
| return H_CONSTANT_INT(double_res);
|
|
|