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/double.h" | 7 #include "src/double.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/hydrogen-infer-representation.h" | 9 #include "src/hydrogen-infer-representation.h" |
10 #include "src/property-details-inl.h" | 10 #include "src/property-details-inl.h" |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 | 1504 |
1505 OStream& HTypeof::PrintDataTo(OStream& os) const { // NOLINT | 1505 OStream& HTypeof::PrintDataTo(OStream& os) const { // NOLINT |
1506 return os << NameOf(value()); | 1506 return os << NameOf(value()); |
1507 } | 1507 } |
1508 | 1508 |
1509 | 1509 |
1510 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, | 1510 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, |
1511 HValue* value, Representation representation) { | 1511 HValue* value, Representation representation) { |
1512 if (FLAG_fold_constants && value->IsConstant()) { | 1512 if (FLAG_fold_constants && value->IsConstant()) { |
1513 HConstant* c = HConstant::cast(value); | 1513 HConstant* c = HConstant::cast(value); |
1514 if (c->HasNumberValue()) { | 1514 c = c->CopyToRepresentation(representation, zone); |
1515 double double_res = c->DoubleValue(); | 1515 if (c != NULL) return c; |
1516 if (representation.IsDouble()) { | |
1517 return HConstant::New(zone, context, double_res); | |
1518 | |
1519 } else if (representation.CanContainDouble(double_res)) { | |
1520 return HConstant::New(zone, context, | |
1521 static_cast<int32_t>(double_res), | |
1522 representation); | |
1523 } | |
1524 } | |
1525 } | 1516 } |
1526 return new(zone) HForceRepresentation(value, representation); | 1517 return new(zone) HForceRepresentation(value, representation); |
1527 } | 1518 } |
1528 | 1519 |
1529 | 1520 |
1530 OStream& HForceRepresentation::PrintDataTo(OStream& os) const { // NOLINT | 1521 OStream& HForceRepresentation::PrintDataTo(OStream& os) const { // NOLINT |
1531 return os << representation().Mnemonic() << " " << NameOf(value()); | 1522 return os << representation().Mnemonic() << " " << NameOf(value()); |
1532 } | 1523 } |
1533 | 1524 |
1534 | 1525 |
(...skipping 3248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4783 break; | 4774 break; |
4784 case HObjectAccess::kExternalMemory: | 4775 case HObjectAccess::kExternalMemory: |
4785 os << "[external-memory]"; | 4776 os << "[external-memory]"; |
4786 break; | 4777 break; |
4787 } | 4778 } |
4788 | 4779 |
4789 return os << "@" << access.offset(); | 4780 return os << "@" << access.offset(); |
4790 } | 4781 } |
4791 | 4782 |
4792 } } // namespace v8::internal | 4783 } } // namespace v8::internal |
OLD | NEW |