| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 function_name_(function_name), | 567 function_name_(function_name), |
| 568 token_kind_(token_kind), | 568 token_kind_(token_kind), |
| 569 arguments_(arguments), | 569 arguments_(arguments), |
| 570 argument_names_(argument_names), | 570 argument_names_(argument_names), |
| 571 checked_argument_count_(checked_argument_count) { | 571 checked_argument_count_(checked_argument_count) { |
| 572 ASSERT(function_name.IsZoneHandle()); | 572 ASSERT(function_name.IsZoneHandle()); |
| 573 ASSERT(!arguments->is_empty()); | 573 ASSERT(!arguments->is_empty()); |
| 574 ASSERT(argument_names.IsZoneHandle()); | 574 ASSERT(argument_names.IsZoneHandle()); |
| 575 ASSERT(Token::IsBinaryToken(token_kind) || | 575 ASSERT(Token::IsBinaryToken(token_kind) || |
| 576 Token::IsUnaryToken(token_kind) || | 576 Token::IsUnaryToken(token_kind) || |
| 577 Token::IsIndexOperator(token_kind) || |
| 577 token_kind == Token::kGET || | 578 token_kind == Token::kGET || |
| 578 token_kind == Token::kSET || | 579 token_kind == Token::kSET || |
| 579 token_kind == Token::kILLEGAL); | 580 token_kind == Token::kILLEGAL); |
| 580 } | 581 } |
| 581 | 582 |
| 582 DECLARE_CALL_COMPUTATION(InstanceCall) | 583 DECLARE_CALL_COMPUTATION(InstanceCall) |
| 583 | 584 |
| 584 intptr_t token_pos() const { return token_pos_; } | 585 intptr_t token_pos() const { return token_pos_; } |
| 585 intptr_t try_index() const { return try_index_; } | 586 intptr_t try_index() const { return try_index_; } |
| 586 const String& function_name() const { return function_name_; } | 587 const String& function_name() const { return function_name_; } |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 | 998 |
| 998 private: | 999 private: |
| 999 const Field& field_; | 1000 const Field& field_; |
| 1000 | 1001 |
| 1001 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); | 1002 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); |
| 1002 }; | 1003 }; |
| 1003 | 1004 |
| 1004 | 1005 |
| 1005 class LoadIndexedComp : public TemplateComputation<2> { | 1006 class LoadIndexedComp : public TemplateComputation<2> { |
| 1006 public: | 1007 public: |
| 1007 LoadIndexedComp(intptr_t token_pos, | 1008 LoadIndexedComp(Value* array, |
| 1008 intptr_t try_index, | 1009 Value* index, |
| 1009 Value* array, | 1010 intptr_t receiver_type, |
| 1010 Value* index) | 1011 InstanceCallComp* original) |
| 1011 : token_pos_(token_pos), | 1012 : receiver_type_(receiver_type), |
| 1012 try_index_(try_index), | 1013 original_(original) { |
| 1013 receiver_type_(kIllegalCid) { | |
| 1014 ASSERT(array != NULL); | 1014 ASSERT(array != NULL); |
| 1015 ASSERT(index != NULL); | 1015 ASSERT(index != NULL); |
| 1016 inputs_[0] = array; | 1016 inputs_[0] = array; |
| 1017 inputs_[1] = index; | 1017 inputs_[1] = index; |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 DECLARE_COMPUTATION(LoadIndexed) | 1020 DECLARE_COMPUTATION(LoadIndexed) |
| 1021 | 1021 |
| 1022 intptr_t token_pos() const { return token_pos_; } | |
| 1023 intptr_t try_index() const { return try_index_; } | |
| 1024 Value* array() const { return inputs_[0]; } | 1022 Value* array() const { return inputs_[0]; } |
| 1025 Value* index() const { return inputs_[1]; } | 1023 Value* index() const { return inputs_[1]; } |
| 1026 | 1024 |
| 1027 void set_receiver_type(intptr_t receiver_type) { | 1025 intptr_t receiver_type() const { return receiver_type_; } |
| 1028 receiver_type_ = receiver_type; | |
| 1029 } | |
| 1030 | 1026 |
| 1031 intptr_t receiver_type() const { | 1027 InstanceCallComp* original() const { return original_; } |
| 1032 return receiver_type_; | |
| 1033 } | |
| 1034 | 1028 |
| 1035 virtual bool CanDeoptimize() const { return true; } | 1029 virtual bool CanDeoptimize() const { return true; } |
| 1036 | 1030 |
| 1037 private: | 1031 private: |
| 1038 const intptr_t token_pos_; | |
| 1039 const intptr_t try_index_; | |
| 1040 intptr_t receiver_type_; | 1032 intptr_t receiver_type_; |
| 1033 InstanceCallComp* original_; |
| 1041 | 1034 |
| 1042 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp); | 1035 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp); |
| 1043 }; | 1036 }; |
| 1044 | 1037 |
| 1045 | 1038 |
| 1046 // Not simply an InstanceCall because it has somewhat more complicated | |
| 1047 // semantics: the value operand is preserved before the call. | |
| 1048 class StoreIndexedComp : public TemplateComputation<3> { | 1039 class StoreIndexedComp : public TemplateComputation<3> { |
| 1049 public: | 1040 public: |
| 1050 StoreIndexedComp(intptr_t token_pos, | 1041 StoreIndexedComp(Value* array, |
| 1051 intptr_t try_index, | |
| 1052 Value* array, | |
| 1053 Value* index, | 1042 Value* index, |
| 1054 Value* value) | 1043 Value* value, |
| 1055 : token_pos_(token_pos), | 1044 intptr_t receiver_type, |
| 1056 try_index_(try_index), | 1045 InstanceCallComp* original) |
| 1057 receiver_type_(kIllegalCid) { | 1046 : receiver_type_(receiver_type), |
| 1047 original_(original) { |
| 1058 ASSERT(array != NULL); | 1048 ASSERT(array != NULL); |
| 1059 ASSERT(index != NULL); | 1049 ASSERT(index != NULL); |
| 1060 ASSERT(value != NULL); | 1050 ASSERT(value != NULL); |
| 1061 inputs_[0] = array; | 1051 inputs_[0] = array; |
| 1062 inputs_[1] = index; | 1052 inputs_[1] = index; |
| 1063 inputs_[2] = value; | 1053 inputs_[2] = value; |
| 1064 } | 1054 } |
| 1065 | 1055 |
| 1066 DECLARE_COMPUTATION(StoreIndexed) | 1056 DECLARE_COMPUTATION(StoreIndexed) |
| 1067 | 1057 |
| 1068 intptr_t token_pos() const { return token_pos_; } | |
| 1069 intptr_t try_index() const { return try_index_; } | |
| 1070 Value* array() const { return inputs_[0]; } | 1058 Value* array() const { return inputs_[0]; } |
| 1071 Value* index() const { return inputs_[1]; } | 1059 Value* index() const { return inputs_[1]; } |
| 1072 Value* value() const { return inputs_[2]; } | 1060 Value* value() const { return inputs_[2]; } |
| 1073 | 1061 |
| 1074 void set_receiver_type(intptr_t receiver_type) { | 1062 InstanceCallComp* original() const { return original_; } |
| 1075 receiver_type_ = receiver_type; | |
| 1076 } | |
| 1077 | 1063 |
| 1078 intptr_t receiver_type() const { | 1064 intptr_t receiver_type() const { return receiver_type_; } |
| 1079 return receiver_type_; | |
| 1080 } | |
| 1081 | 1065 |
| 1082 virtual bool CanDeoptimize() const { return true; } | 1066 virtual bool CanDeoptimize() const { return true; } |
| 1083 | 1067 |
| 1084 private: | 1068 private: |
| 1085 const intptr_t token_pos_; | |
| 1086 const intptr_t try_index_; | |
| 1087 intptr_t receiver_type_; | 1069 intptr_t receiver_type_; |
| 1070 InstanceCallComp* original_; |
| 1088 | 1071 |
| 1089 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); | 1072 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); |
| 1090 }; | 1073 }; |
| 1091 | 1074 |
| 1092 | 1075 |
| 1093 // Note overrideable, built-in: value? false : true. | 1076 // Note overrideable, built-in: value? false : true. |
| 1094 class BooleanNegateComp : public TemplateComputation<1> { | 1077 class BooleanNegateComp : public TemplateComputation<1> { |
| 1095 public: | 1078 public: |
| 1096 explicit BooleanNegateComp(Value* value) { | 1079 explicit BooleanNegateComp(Value* value) { |
| 1097 ASSERT(value != NULL); | 1080 ASSERT(value != NULL); |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 const GrowableArray<BlockEntryInstr*>& block_order_; | 2890 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2908 | 2891 |
| 2909 private: | 2892 private: |
| 2910 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2893 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2911 }; | 2894 }; |
| 2912 | 2895 |
| 2913 | 2896 |
| 2914 } // namespace dart | 2897 } // namespace dart |
| 2915 | 2898 |
| 2916 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2899 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |