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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 | 1531 |
1532 void HTypeof::PrintDataTo(StringStream* stream) { | 1532 void HTypeof::PrintDataTo(StringStream* stream) { |
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 c = c->CopyToRepresentation(representation, zone); |
1542 double double_res = c->DoubleValue(); | 1542 if (c != NULL) return c; |
1543 if (representation.IsDouble()) { | |
1544 return HConstant::New(zone, context, double_res); | |
1545 | |
1546 } else if (representation.CanContainDouble(double_res)) { | |
1547 return HConstant::New(zone, context, | |
1548 static_cast<int32_t>(double_res), | |
1549 representation); | |
1550 } | |
1551 } | |
1552 } | 1543 } |
1553 return new(zone) HForceRepresentation(value, representation); | 1544 return new(zone) HForceRepresentation(value, representation); |
1554 } | 1545 } |
1555 | 1546 |
1556 | 1547 |
1557 void HForceRepresentation::PrintDataTo(StringStream* stream) { | 1548 void HForceRepresentation::PrintDataTo(StringStream* stream) { |
1558 stream->Add("%s ", representation().Mnemonic()); | 1549 stream->Add("%s ", representation().Mnemonic()); |
1559 value()->PrintNameTo(stream); | 1550 value()->PrintNameTo(stream); |
1560 } | 1551 } |
1561 | 1552 |
(...skipping 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4839 break; | 4830 break; |
4840 case kExternalMemory: | 4831 case kExternalMemory: |
4841 stream->Add("[external-memory]"); | 4832 stream->Add("[external-memory]"); |
4842 break; | 4833 break; |
4843 } | 4834 } |
4844 | 4835 |
4845 stream->Add("@%d", offset()); | 4836 stream->Add("@%d", offset()); |
4846 } | 4837 } |
4847 | 4838 |
4848 } } // namespace v8::internal | 4839 } } // namespace v8::internal |
OLD | NEW |