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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 | 923 |
924 explicit Constant(int32_t v); | 924 explicit Constant(int32_t v); |
925 explicit Constant(int64_t v) : type_(kInt64), value_(v) {} | 925 explicit Constant(int64_t v) : type_(kInt64), value_(v) {} |
926 explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} | 926 explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} |
927 explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {} | 927 explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {} |
928 explicit Constant(ExternalReference ref) | 928 explicit Constant(ExternalReference ref) |
929 : type_(kExternalReference), value_(bit_cast<intptr_t>(ref)) {} | 929 : type_(kExternalReference), value_(bit_cast<intptr_t>(ref)) {} |
930 explicit Constant(Handle<HeapObject> obj) | 930 explicit Constant(Handle<HeapObject> obj) |
931 : type_(kHeapObject), value_(bit_cast<intptr_t>(obj)) {} | 931 : type_(kHeapObject), value_(bit_cast<intptr_t>(obj)) {} |
932 explicit Constant(RpoNumber rpo) : type_(kRpoNumber), value_(rpo.ToInt()) {} | 932 explicit Constant(RpoNumber rpo) : type_(kRpoNumber), value_(rpo.ToInt()) {} |
| 933 explicit Constant(RelocatablePtrConstantInfo info); |
933 | 934 |
934 Type type() const { return type_; } | 935 Type type() const { return type_; } |
935 | 936 |
| 937 RelocInfo::Mode rmode() const { return rmode_; } |
| 938 |
936 int32_t ToInt32() const { | 939 int32_t ToInt32() const { |
937 DCHECK(type() == kInt32 || type() == kInt64); | 940 DCHECK(type() == kInt32 || type() == kInt64); |
938 const int32_t value = static_cast<int32_t>(value_); | 941 const int32_t value = static_cast<int32_t>(value_); |
939 DCHECK_EQ(value_, static_cast<int64_t>(value)); | 942 DCHECK_EQ(value_, static_cast<int64_t>(value)); |
940 return value; | 943 return value; |
941 } | 944 } |
942 | 945 |
943 int64_t ToInt64() const { | 946 int64_t ToInt64() const { |
944 if (type() == kInt32) return ToInt32(); | 947 if (type() == kInt32) return ToInt32(); |
945 DCHECK_EQ(kInt64, type()); | 948 DCHECK_EQ(kInt64, type()); |
(...skipping 22 matching lines...) Expand all Loading... |
968 } | 971 } |
969 | 972 |
970 Handle<HeapObject> ToHeapObject() const { | 973 Handle<HeapObject> ToHeapObject() const { |
971 DCHECK_EQ(kHeapObject, type()); | 974 DCHECK_EQ(kHeapObject, type()); |
972 return bit_cast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); | 975 return bit_cast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); |
973 } | 976 } |
974 | 977 |
975 private: | 978 private: |
976 Type type_; | 979 Type type_; |
977 int64_t value_; | 980 int64_t value_; |
| 981 RelocInfo::Mode rmode_; |
978 }; | 982 }; |
979 | 983 |
980 | 984 |
981 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 985 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
982 | 986 |
983 | 987 |
984 // Forward declarations. | 988 // Forward declarations. |
985 class FrameStateDescriptor; | 989 class FrameStateDescriptor; |
986 | 990 |
987 | 991 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 | 1391 |
1388 | 1392 |
1389 std::ostream& operator<<(std::ostream& os, | 1393 std::ostream& operator<<(std::ostream& os, |
1390 const PrintableInstructionSequence& code); | 1394 const PrintableInstructionSequence& code); |
1391 | 1395 |
1392 } // namespace compiler | 1396 } // namespace compiler |
1393 } // namespace internal | 1397 } // namespace internal |
1394 } // namespace v8 | 1398 } // namespace v8 |
1395 | 1399 |
1396 #endif // V8_COMPILER_INSTRUCTION_H_ | 1400 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |