OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/hydrogen-instructions.h" | 5 #include "src/crankshaft/hydrogen-instructions.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/ieee754.h" | 8 #include "src/base/ieee754.h" |
9 #include "src/base/safe_math.h" | 9 #include "src/base/safe_math.h" |
10 #include "src/crankshaft/hydrogen-infer-representation.h" | 10 #include "src/crankshaft/hydrogen-infer-representation.h" |
(...skipping 3560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3571 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3571 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3572 HConstant* c_left = HConstant::cast(left); | 3572 HConstant* c_left = HConstant::cast(left); |
3573 HConstant* c_right = HConstant::cast(right); | 3573 HConstant* c_right = HConstant::cast(right); |
3574 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { | 3574 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { |
3575 if (c_right->DoubleValue() != 0) { | 3575 if (c_right->DoubleValue() != 0) { |
3576 double double_res = c_left->DoubleValue() / c_right->DoubleValue(); | 3576 double double_res = c_left->DoubleValue() / c_right->DoubleValue(); |
3577 if (IsInt32Double(double_res)) { | 3577 if (IsInt32Double(double_res)) { |
3578 return H_CONSTANT_INT(double_res); | 3578 return H_CONSTANT_INT(double_res); |
3579 } | 3579 } |
3580 return H_CONSTANT_DOUBLE(double_res); | 3580 return H_CONSTANT_DOUBLE(double_res); |
3581 } else { | 3581 } else if (c_left->DoubleValue() != 0) { |
3582 int sign = Double(c_left->DoubleValue()).Sign() * | 3582 int sign = Double(c_left->DoubleValue()).Sign() * |
3583 Double(c_right->DoubleValue()).Sign(); // Right could be -0. | 3583 Double(c_right->DoubleValue()).Sign(); // Right could be -0. |
3584 return H_CONSTANT_DOUBLE(sign * V8_INFINITY); | 3584 return H_CONSTANT_DOUBLE(sign * V8_INFINITY); |
| 3585 } else { |
| 3586 return H_CONSTANT_DOUBLE(std::numeric_limits<double>::quiet_NaN()); |
3585 } | 3587 } |
3586 } | 3588 } |
3587 } | 3589 } |
3588 return new (zone) HDiv(context, left, right); | 3590 return new (zone) HDiv(context, left, right); |
3589 } | 3591 } |
3590 | 3592 |
3591 HInstruction* HBitwise::New(Isolate* isolate, Zone* zone, HValue* context, | 3593 HInstruction* HBitwise::New(Isolate* isolate, Zone* zone, HValue* context, |
3592 Token::Value op, HValue* left, HValue* right) { | 3594 Token::Value op, HValue* left, HValue* right) { |
3593 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3595 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3594 HConstant* c_left = HConstant::cast(left); | 3596 HConstant* c_left = HConstant::cast(left); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4030 case HObjectAccess::kExternalMemory: | 4032 case HObjectAccess::kExternalMemory: |
4031 os << "[external-memory]"; | 4033 os << "[external-memory]"; |
4032 break; | 4034 break; |
4033 } | 4035 } |
4034 | 4036 |
4035 return os << "@" << access.offset(); | 4037 return os << "@" << access.offset(); |
4036 } | 4038 } |
4037 | 4039 |
4038 } // namespace internal | 4040 } // namespace internal |
4039 } // namespace v8 | 4041 } // namespace v8 |
OLD | NEW |