OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
(...skipping 1046 matching lines...) Loading... | |
1057 DCHECK_EQ(value_, static_cast<int64_t>(value)); | 1057 DCHECK_EQ(value_, static_cast<int64_t>(value)); |
1058 return value; | 1058 return value; |
1059 } | 1059 } |
1060 | 1060 |
1061 int64_t ToInt64() const { | 1061 int64_t ToInt64() const { |
1062 if (type() == kInt32) return ToInt32(); | 1062 if (type() == kInt32) return ToInt32(); |
1063 DCHECK_EQ(kInt64, type()); | 1063 DCHECK_EQ(kInt64, type()); |
1064 return value_; | 1064 return value_; |
1065 } | 1065 } |
1066 | 1066 |
1067 float ToFloat32() const { | 1067 float ToFloat32() const { |
titzer
2017/01/19 13:13:01
Maybe we should add a TODO to remove these methods
ahaas
2017/01/19 15:46:19
Done.
| |
1068 DCHECK_EQ(kFloat32, type()); | 1068 DCHECK_EQ(kFloat32, type()); |
1069 return bit_cast<float>(static_cast<int32_t>(value_)); | 1069 return bit_cast<float>(static_cast<int32_t>(value_)); |
1070 } | 1070 } |
1071 | 1071 |
1072 int32_t ToFloat32AsInt() const { | |
1073 DCHECK_EQ(kFloat32, type()); | |
1074 return static_cast<int32_t>(value_); | |
1075 } | |
1076 | |
1072 double ToFloat64() const { | 1077 double ToFloat64() const { |
1073 if (type() == kInt32) return ToInt32(); | 1078 if (type() == kInt32) return ToInt32(); |
1074 DCHECK_EQ(kFloat64, type()); | 1079 DCHECK_EQ(kFloat64, type()); |
1075 return bit_cast<double>(value_); | 1080 return bit_cast<double>(value_); |
1076 } | 1081 } |
1077 | 1082 |
1083 int64_t ToFloat64AsInt() const { | |
1084 if (type() == kInt32) return ToInt32(); | |
1085 DCHECK_EQ(kFloat64, type()); | |
1086 return value_; | |
1087 } | |
1088 | |
1078 ExternalReference ToExternalReference() const { | 1089 ExternalReference ToExternalReference() const { |
1079 DCHECK_EQ(kExternalReference, type()); | 1090 DCHECK_EQ(kExternalReference, type()); |
1080 return bit_cast<ExternalReference>(static_cast<intptr_t>(value_)); | 1091 return bit_cast<ExternalReference>(static_cast<intptr_t>(value_)); |
1081 } | 1092 } |
1082 | 1093 |
1083 RpoNumber ToRpoNumber() const { | 1094 RpoNumber ToRpoNumber() const { |
1084 DCHECK_EQ(kRpoNumber, type()); | 1095 DCHECK_EQ(kRpoNumber, type()); |
1085 return RpoNumber::FromInt(static_cast<int>(value_)); | 1096 return RpoNumber::FromInt(static_cast<int>(value_)); |
1086 } | 1097 } |
1087 | 1098 |
(...skipping 521 matching lines...) Loading... | |
1609 }; | 1620 }; |
1610 | 1621 |
1611 V8_EXPORT_PRIVATE std::ostream& operator<<( | 1622 V8_EXPORT_PRIVATE std::ostream& operator<<( |
1612 std::ostream& os, const PrintableInstructionSequence& code); | 1623 std::ostream& os, const PrintableInstructionSequence& code); |
1613 | 1624 |
1614 } // namespace compiler | 1625 } // namespace compiler |
1615 } // namespace internal | 1626 } // namespace internal |
1616 } // namespace v8 | 1627 } // namespace v8 |
1617 | 1628 |
1618 #endif // V8_COMPILER_INSTRUCTION_H_ | 1629 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |