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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 | 940 |
941 explicit Constant(int32_t v); | 941 explicit Constant(int32_t v); |
942 explicit Constant(int64_t v) : type_(kInt64), value_(v) {} | 942 explicit Constant(int64_t v) : type_(kInt64), value_(v) {} |
943 explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} | 943 explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} |
944 explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {} | 944 explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {} |
945 explicit Constant(ExternalReference ref) | 945 explicit Constant(ExternalReference ref) |
946 : type_(kExternalReference), value_(bit_cast<intptr_t>(ref)) {} | 946 : type_(kExternalReference), value_(bit_cast<intptr_t>(ref)) {} |
947 explicit Constant(Handle<HeapObject> obj) | 947 explicit Constant(Handle<HeapObject> obj) |
948 : type_(kHeapObject), value_(bit_cast<intptr_t>(obj)) {} | 948 : type_(kHeapObject), value_(bit_cast<intptr_t>(obj)) {} |
949 explicit Constant(RpoNumber rpo) : type_(kRpoNumber), value_(rpo.ToInt()) {} | 949 explicit Constant(RpoNumber rpo) : type_(kRpoNumber), value_(rpo.ToInt()) {} |
| 950 explicit Constant(RelocatablePtrConstantInfo info); |
950 | 951 |
951 Type type() const { return type_; } | 952 Type type() const { return type_; } |
952 | 953 |
| 954 RelocInfo::Mode rmode() const { return rmode_; } |
| 955 |
953 int32_t ToInt32() const { | 956 int32_t ToInt32() const { |
954 DCHECK(type() == kInt32 || type() == kInt64); | 957 DCHECK(type() == kInt32 || type() == kInt64); |
955 const int32_t value = static_cast<int32_t>(value_); | 958 const int32_t value = static_cast<int32_t>(value_); |
956 DCHECK_EQ(value_, static_cast<int64_t>(value)); | 959 DCHECK_EQ(value_, static_cast<int64_t>(value)); |
957 return value; | 960 return value; |
958 } | 961 } |
959 | 962 |
960 int64_t ToInt64() const { | 963 int64_t ToInt64() const { |
961 if (type() == kInt32) return ToInt32(); | 964 if (type() == kInt32) return ToInt32(); |
962 DCHECK_EQ(kInt64, type()); | 965 DCHECK_EQ(kInt64, type()); |
(...skipping 22 matching lines...) Expand all Loading... |
985 } | 988 } |
986 | 989 |
987 Handle<HeapObject> ToHeapObject() const { | 990 Handle<HeapObject> ToHeapObject() const { |
988 DCHECK_EQ(kHeapObject, type()); | 991 DCHECK_EQ(kHeapObject, type()); |
989 return bit_cast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); | 992 return bit_cast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); |
990 } | 993 } |
991 | 994 |
992 private: | 995 private: |
993 Type type_; | 996 Type type_; |
994 int64_t value_; | 997 int64_t value_; |
| 998 #if V8_TARGET_ARCH_32_BIT |
| 999 RelocInfo::Mode rmode_ = RelocInfo::NONE32; |
| 1000 #else |
| 1001 RelocInfo::Mode rmode_ = RelocInfo::NONE64; |
| 1002 #endif |
995 }; | 1003 }; |
996 | 1004 |
997 | 1005 |
998 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 1006 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
999 | 1007 |
1000 | 1008 |
1001 // Forward declarations. | 1009 // Forward declarations. |
1002 class FrameStateDescriptor; | 1010 class FrameStateDescriptor; |
1003 | 1011 |
1004 | 1012 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 | 1413 |
1406 | 1414 |
1407 std::ostream& operator<<(std::ostream& os, | 1415 std::ostream& operator<<(std::ostream& os, |
1408 const PrintableInstructionSequence& code); | 1416 const PrintableInstructionSequence& code); |
1409 | 1417 |
1410 } // namespace compiler | 1418 } // namespace compiler |
1411 } // namespace internal | 1419 } // namespace internal |
1412 } // namespace v8 | 1420 } // namespace v8 |
1413 | 1421 |
1414 #endif // V8_COMPILER_INSTRUCTION_H_ | 1422 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |