| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} | 668 explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} |
| 669 explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {} | 669 explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {} |
| 670 explicit Constant(ExternalReference ref) | 670 explicit Constant(ExternalReference ref) |
| 671 : type_(kExternalReference), value_(bit_cast<intptr_t>(ref)) {} | 671 : type_(kExternalReference), value_(bit_cast<intptr_t>(ref)) {} |
| 672 explicit Constant(Handle<HeapObject> obj) | 672 explicit Constant(Handle<HeapObject> obj) |
| 673 : type_(kHeapObject), value_(bit_cast<intptr_t>(obj)) {} | 673 : type_(kHeapObject), value_(bit_cast<intptr_t>(obj)) {} |
| 674 | 674 |
| 675 Type type() const { return type_; } | 675 Type type() const { return type_; } |
| 676 | 676 |
| 677 int32_t ToInt32() const { | 677 int32_t ToInt32() const { |
| 678 DCHECK_EQ(kInt32, type()); | 678 DCHECK(type() == kInt32 || type() == kInt64); |
| 679 return static_cast<int32_t>(value_); | 679 const int32_t value = static_cast<int32_t>(value_); |
| 680 DCHECK_EQ(value_, static_cast<int64_t>(value)); |
| 681 return value; |
| 680 } | 682 } |
| 681 | 683 |
| 682 int64_t ToInt64() const { | 684 int64_t ToInt64() const { |
| 683 if (type() == kInt32) return ToInt32(); | 685 if (type() == kInt32) return ToInt32(); |
| 684 DCHECK_EQ(kInt64, type()); | 686 DCHECK_EQ(kInt64, type()); |
| 685 return value_; | 687 return value_; |
| 686 } | 688 } |
| 687 | 689 |
| 688 float ToFloat32() const { | 690 float ToFloat32() const { |
| 689 DCHECK_EQ(kFloat32, type()); | 691 DCHECK_EQ(kFloat32, type()); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 DeoptimizationVector deoptimization_entries_; | 972 DeoptimizationVector deoptimization_entries_; |
| 971 }; | 973 }; |
| 972 | 974 |
| 973 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); | 975 std::ostream& operator<<(std::ostream& os, const InstructionSequence& code); |
| 974 | 976 |
| 975 } // namespace compiler | 977 } // namespace compiler |
| 976 } // namespace internal | 978 } // namespace internal |
| 977 } // namespace v8 | 979 } // namespace v8 |
| 978 | 980 |
| 979 #endif // V8_COMPILER_INSTRUCTION_H_ | 981 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |