| 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); | |
| 951 | 950 |
| 952 Type type() const { return type_; } | 951 Type type() const { return type_; } |
| 953 | 952 |
| 954 RelocInfo::Mode rmode() const { return rmode_; } | |
| 955 | |
| 956 int32_t ToInt32() const { | 953 int32_t ToInt32() const { |
| 957 DCHECK(type() == kInt32 || type() == kInt64); | 954 DCHECK(type() == kInt32 || type() == kInt64); |
| 958 const int32_t value = static_cast<int32_t>(value_); | 955 const int32_t value = static_cast<int32_t>(value_); |
| 959 DCHECK_EQ(value_, static_cast<int64_t>(value)); | 956 DCHECK_EQ(value_, static_cast<int64_t>(value)); |
| 960 return value; | 957 return value; |
| 961 } | 958 } |
| 962 | 959 |
| 963 int64_t ToInt64() const { | 960 int64_t ToInt64() const { |
| 964 if (type() == kInt32) return ToInt32(); | 961 if (type() == kInt32) return ToInt32(); |
| 965 DCHECK_EQ(kInt64, type()); | 962 DCHECK_EQ(kInt64, type()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 988 } | 985 } |
| 989 | 986 |
| 990 Handle<HeapObject> ToHeapObject() const { | 987 Handle<HeapObject> ToHeapObject() const { |
| 991 DCHECK_EQ(kHeapObject, type()); | 988 DCHECK_EQ(kHeapObject, type()); |
| 992 return bit_cast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); | 989 return bit_cast<Handle<HeapObject> >(static_cast<intptr_t>(value_)); |
| 993 } | 990 } |
| 994 | 991 |
| 995 private: | 992 private: |
| 996 Type type_; | 993 Type type_; |
| 997 int64_t value_; | 994 int64_t value_; |
| 998 RelocInfo::Mode rmode_; | |
| 999 }; | 995 }; |
| 1000 | 996 |
| 1001 | 997 |
| 1002 std::ostream& operator<<(std::ostream& os, const Constant& constant); | 998 std::ostream& operator<<(std::ostream& os, const Constant& constant); |
| 1003 | 999 |
| 1004 | 1000 |
| 1005 // Forward declarations. | 1001 // Forward declarations. |
| 1006 class FrameStateDescriptor; | 1002 class FrameStateDescriptor; |
| 1007 | 1003 |
| 1008 | 1004 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 | 1405 |
| 1410 | 1406 |
| 1411 std::ostream& operator<<(std::ostream& os, | 1407 std::ostream& operator<<(std::ostream& os, |
| 1412 const PrintableInstructionSequence& code); | 1408 const PrintableInstructionSequence& code); |
| 1413 | 1409 |
| 1414 } // namespace compiler | 1410 } // namespace compiler |
| 1415 } // namespace internal | 1411 } // namespace internal |
| 1416 } // namespace v8 | 1412 } // namespace v8 |
| 1417 | 1413 |
| 1418 #endif // V8_COMPILER_INSTRUCTION_H_ | 1414 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |