| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 ASSERT(instantiator_type_arguments != NULL); | 314 ASSERT(instantiator_type_arguments != NULL); |
| 315 ASSERT(!dst_type.IsNull()); | 315 ASSERT(!dst_type.IsNull()); |
| 316 ASSERT(!dst_name.IsNull()); | 316 ASSERT(!dst_name.IsNull()); |
| 317 inputs_[0] = value; | 317 inputs_[0] = value; |
| 318 inputs_[1] = instantiator; | 318 inputs_[1] = instantiator; |
| 319 inputs_[2] = instantiator_type_arguments; | 319 inputs_[2] = instantiator_type_arguments; |
| 320 } | 320 } |
| 321 | 321 |
| 322 DECLARE_COMPUTATION(AssertAssignable) | 322 DECLARE_COMPUTATION(AssertAssignable) |
| 323 | 323 |
| 324 intptr_t token_index() const { return token_index_; } | |
| 325 intptr_t try_index() const { return try_index_; } | |
| 326 Value* value() const { return inputs_[0]; } | 324 Value* value() const { return inputs_[0]; } |
| 327 Value* instantiator() const { return inputs_[1]; } | 325 Value* instantiator() const { return inputs_[1]; } |
| 328 Value* instantiator_type_arguments() const { return inputs_[2]; } | 326 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 327 |
| 328 intptr_t token_index() const { return token_index_; } |
| 329 intptr_t try_index() const { return try_index_; } |
| 329 const AbstractType& dst_type() const { return dst_type_; } | 330 const AbstractType& dst_type() const { return dst_type_; } |
| 330 const String& dst_name() const { return dst_name_; } | 331 const String& dst_name() const { return dst_name_; } |
| 331 | 332 |
| 332 virtual void PrintOperandsTo(BufferFormatter* f) const; | 333 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 333 | 334 |
| 334 private: | 335 private: |
| 335 const intptr_t token_index_; | 336 const intptr_t token_index_; |
| 336 const intptr_t try_index_; | 337 const intptr_t try_index_; |
| 337 const AbstractType& dst_type_; | 338 const AbstractType& dst_type_; |
| 338 const String& dst_name_; | 339 const String& dst_name_; |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 851 |
| 851 DECLARE_COMPUTATION(BooleanNegate) | 852 DECLARE_COMPUTATION(BooleanNegate) |
| 852 | 853 |
| 853 Value* value() const { return inputs_[0]; } | 854 Value* value() const { return inputs_[0]; } |
| 854 | 855 |
| 855 private: | 856 private: |
| 856 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); | 857 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); |
| 857 }; | 858 }; |
| 858 | 859 |
| 859 | 860 |
| 860 class InstanceOfComp : public Computation { | 861 class InstanceOfComp : public TemplateComputation<3> { |
| 861 public: | 862 public: |
| 862 InstanceOfComp(intptr_t token_index, | 863 InstanceOfComp(intptr_t token_index, |
| 863 intptr_t try_index, | 864 intptr_t try_index, |
| 864 Value* value, | 865 Value* value, |
| 865 Value* instantiator, // Can be NULL. | 866 Value* instantiator, |
| 866 Value* type_arguments, // Can be NULL. | 867 Value* instantiator_type_arguments, |
| 867 const AbstractType& type, | 868 const AbstractType& type, |
| 868 bool negate_result) | 869 bool negate_result) |
| 869 : token_index_(token_index), | 870 : token_index_(token_index), |
| 870 try_index_(try_index), | 871 try_index_(try_index), |
| 871 value_(value), | |
| 872 instantiator_(instantiator), | |
| 873 type_arguments_(type_arguments), | |
| 874 type_(type), | 872 type_(type), |
| 875 negate_result_(negate_result) { | 873 negate_result_(negate_result) { |
| 876 ASSERT(value_ != NULL); | 874 ASSERT(value != NULL); |
| 875 ASSERT(instantiator != NULL); |
| 876 ASSERT(instantiator_type_arguments != NULL); |
| 877 ASSERT(!type.IsNull()); | 877 ASSERT(!type.IsNull()); |
| 878 inputs_[0] = value; |
| 879 inputs_[1] = instantiator; |
| 880 inputs_[2] = instantiator_type_arguments; |
| 878 } | 881 } |
| 879 | 882 |
| 880 DECLARE_COMPUTATION(InstanceOf) | 883 DECLARE_COMPUTATION(InstanceOf) |
| 881 | 884 |
| 882 Value* value() const { return value_; } | 885 Value* value() const { return inputs_[0]; } |
| 883 Value* instantiator() const { return instantiator_; } | 886 Value* instantiator() const { return inputs_[1]; } |
| 884 Value* type_arguments() const { return type_arguments_; } | 887 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 888 |
| 885 bool negate_result() const { return negate_result_; } | 889 bool negate_result() const { return negate_result_; } |
| 886 const AbstractType& type() const { return type_; } | 890 const AbstractType& type() const { return type_; } |
| 887 intptr_t token_index() const { return token_index_; } | 891 intptr_t token_index() const { return token_index_; } |
| 888 intptr_t try_index() const { return try_index_; } | 892 intptr_t try_index() const { return try_index_; } |
| 889 | 893 |
| 890 virtual intptr_t InputCount() const; | |
| 891 virtual Value* InputAt(intptr_t i) const { | |
| 892 if (i == 0) return value(); | |
| 893 if (i == 1) return type_arguments(); | |
| 894 return NULL; | |
| 895 } | |
| 896 | |
| 897 virtual void PrintOperandsTo(BufferFormatter* f) const; | 894 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 898 | 895 |
| 899 private: | 896 private: |
| 900 const intptr_t token_index_; | 897 const intptr_t token_index_; |
| 901 const intptr_t try_index_; | 898 const intptr_t try_index_; |
| 902 Value* value_; | 899 Value* value_; |
| 903 Value* instantiator_; | 900 Value* instantiator_; |
| 904 Value* type_arguments_; | 901 Value* type_arguments_; |
| 905 const AbstractType& type_; | 902 const AbstractType& type_; |
| 906 const bool negate_result_; | 903 const bool negate_result_; |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 const GrowableArray<BlockEntryInstr*>& block_order_; | 1892 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1896 | 1893 |
| 1897 private: | 1894 private: |
| 1898 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1895 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1899 }; | 1896 }; |
| 1900 | 1897 |
| 1901 | 1898 |
| 1902 } // namespace dart | 1899 } // namespace dart |
| 1903 | 1900 |
| 1904 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1901 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |