| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/double.h" | 8 #include "src/double.h" |
| 9 #include "src/factory.h" | 9 #include "src/factory.h" |
| 10 #include "src/hydrogen-infer-representation.h" | 10 #include "src/hydrogen-infer-representation.h" |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 | 1505 |
| 1506 OStream& HTypeof::PrintDataTo(OStream& os) const { // NOLINT | 1506 OStream& HTypeof::PrintDataTo(OStream& os) const { // NOLINT |
| 1507 return os << NameOf(value()); | 1507 return os << NameOf(value()); |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 | 1510 |
| 1511 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, | 1511 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, |
| 1512 HValue* value, Representation representation) { | 1512 HValue* value, Representation representation) { |
| 1513 if (FLAG_fold_constants && value->IsConstant()) { | 1513 if (FLAG_fold_constants && value->IsConstant()) { |
| 1514 HConstant* c = HConstant::cast(value); | 1514 HConstant* c = HConstant::cast(value); |
| 1515 if (c->HasNumberValue()) { | 1515 c = c->CopyToRepresentation(representation, zone); |
| 1516 double double_res = c->DoubleValue(); | 1516 if (c != NULL) return c; |
| 1517 if (representation.IsDouble()) { | |
| 1518 return HConstant::New(zone, context, double_res); | |
| 1519 | |
| 1520 } else if (representation.CanContainDouble(double_res)) { | |
| 1521 return HConstant::New(zone, context, | |
| 1522 static_cast<int32_t>(double_res), | |
| 1523 representation); | |
| 1524 } | |
| 1525 } | |
| 1526 } | 1517 } |
| 1527 return new(zone) HForceRepresentation(value, representation); | 1518 return new(zone) HForceRepresentation(value, representation); |
| 1528 } | 1519 } |
| 1529 | 1520 |
| 1530 | 1521 |
| 1531 OStream& HForceRepresentation::PrintDataTo(OStream& os) const { // NOLINT | 1522 OStream& HForceRepresentation::PrintDataTo(OStream& os) const { // NOLINT |
| 1532 return os << representation().Mnemonic() << " " << NameOf(value()); | 1523 return os << representation().Mnemonic() << " " << NameOf(value()); |
| 1533 } | 1524 } |
| 1534 | 1525 |
| 1535 | 1526 |
| (...skipping 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4767 break; | 4758 break; |
| 4768 case HObjectAccess::kExternalMemory: | 4759 case HObjectAccess::kExternalMemory: |
| 4769 os << "[external-memory]"; | 4760 os << "[external-memory]"; |
| 4770 break; | 4761 break; |
| 4771 } | 4762 } |
| 4772 | 4763 |
| 4773 return os << "@" << access.offset(); | 4764 return os << "@" << access.offset(); |
| 4774 } | 4765 } |
| 4775 | 4766 |
| 4776 } } // namespace v8::internal | 4767 } } // namespace v8::internal |
| OLD | NEW |