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 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 value()->PrintNameTo(stream); | 1533 value()->PrintNameTo(stream); |
1534 } | 1534 } |
1535 | 1535 |
1536 | 1536 |
1537 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, | 1537 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, |
1538 HValue* value, Representation representation) { | 1538 HValue* value, Representation representation) { |
1539 if (FLAG_fold_constants && value->IsConstant()) { | 1539 if (FLAG_fold_constants && value->IsConstant()) { |
1540 HConstant* c = HConstant::cast(value); | 1540 HConstant* c = HConstant::cast(value); |
1541 if (c->HasNumberValue()) { | 1541 if (c->HasNumberValue()) { |
1542 double double_res = c->DoubleValue(); | 1542 double double_res = c->DoubleValue(); |
1543 if (representation.CanContainDouble(double_res)) { | 1543 if (representation.IsDouble()) { |
| 1544 return HConstant::New(zone, context, double_res); |
| 1545 |
| 1546 } else if (representation.CanContainDouble(double_res)) { |
1544 return HConstant::New(zone, context, | 1547 return HConstant::New(zone, context, |
1545 static_cast<int32_t>(double_res), | 1548 static_cast<int32_t>(double_res), |
1546 representation); | 1549 representation); |
1547 } | 1550 } |
1548 } | 1551 } |
1549 } | 1552 } |
1550 return new(zone) HForceRepresentation(value, representation); | 1553 return new(zone) HForceRepresentation(value, representation); |
1551 } | 1554 } |
1552 | 1555 |
1553 | 1556 |
(...skipping 3282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4836 break; | 4839 break; |
4837 case kExternalMemory: | 4840 case kExternalMemory: |
4838 stream->Add("[external-memory]"); | 4841 stream->Add("[external-memory]"); |
4839 break; | 4842 break; |
4840 } | 4843 } |
4841 | 4844 |
4842 stream->Add("@%d", offset()); | 4845 stream->Add("@%d", offset()); |
4843 } | 4846 } |
4844 | 4847 |
4845 } } // namespace v8::internal | 4848 } } // namespace v8::internal |
OLD | NEW |