Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: vm/intermediate_language.h

Issue 10836239: Change indexed load and store IL instructions to fit with SSA backend. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 function_name_(function_name), 568 function_name_(function_name),
569 token_kind_(token_kind), 569 token_kind_(token_kind),
570 arguments_(arguments), 570 arguments_(arguments),
571 argument_names_(argument_names), 571 argument_names_(argument_names),
572 checked_argument_count_(checked_argument_count) { 572 checked_argument_count_(checked_argument_count) {
573 ASSERT(function_name.IsZoneHandle()); 573 ASSERT(function_name.IsZoneHandle());
574 ASSERT(!arguments->is_empty()); 574 ASSERT(!arguments->is_empty());
575 ASSERT(argument_names.IsZoneHandle()); 575 ASSERT(argument_names.IsZoneHandle());
576 ASSERT(Token::IsBinaryToken(token_kind) || 576 ASSERT(Token::IsBinaryToken(token_kind) ||
577 Token::IsUnaryToken(token_kind) || 577 Token::IsUnaryToken(token_kind) ||
578 Token::IsIndexOperator(token_kind) ||
578 token_kind == Token::kGET || 579 token_kind == Token::kGET ||
579 token_kind == Token::kSET || 580 token_kind == Token::kSET ||
580 token_kind == Token::kILLEGAL); 581 token_kind == Token::kILLEGAL);
581 } 582 }
582 583
583 DECLARE_CALL_COMPUTATION(InstanceCall) 584 DECLARE_CALL_COMPUTATION(InstanceCall)
584 585
585 intptr_t token_pos() const { return token_pos_; } 586 intptr_t token_pos() const { return token_pos_; }
586 intptr_t try_index() const { return try_index_; } 587 intptr_t try_index() const { return try_index_; }
587 const String& function_name() const { return function_name_; } 588 const String& function_name() const { return function_name_; }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 999
999 private: 1000 private:
1000 const Field& field_; 1001 const Field& field_;
1001 1002
1002 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); 1003 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp);
1003 }; 1004 };
1004 1005
1005 1006
1006 class LoadIndexedComp : public TemplateComputation<2> { 1007 class LoadIndexedComp : public TemplateComputation<2> {
1007 public: 1008 public:
1008 LoadIndexedComp(intptr_t token_pos, 1009 LoadIndexedComp(Value* array,
1009 intptr_t try_index, 1010 Value* index,
1010 Value* array, 1011 intptr_t receiver_type,
1011 Value* index) 1012 InstanceCallComp* original)
1012 : token_pos_(token_pos), 1013 : receiver_type_(receiver_type),
1013 try_index_(try_index), 1014 original_(original) {
1014 receiver_type_(kIllegalCid) {
1015 ASSERT(array != NULL); 1015 ASSERT(array != NULL);
1016 ASSERT(index != NULL); 1016 ASSERT(index != NULL);
1017 inputs_[0] = array; 1017 inputs_[0] = array;
1018 inputs_[1] = index; 1018 inputs_[1] = index;
1019 } 1019 }
1020 1020
1021 DECLARE_COMPUTATION(LoadIndexed) 1021 DECLARE_COMPUTATION(LoadIndexed)
1022 1022
1023 intptr_t token_pos() const { return token_pos_; }
1024 intptr_t try_index() const { return try_index_; }
1025 Value* array() const { return inputs_[0]; } 1023 Value* array() const { return inputs_[0]; }
1026 Value* index() const { return inputs_[1]; } 1024 Value* index() const { return inputs_[1]; }
1027 1025
1028 void set_receiver_type(intptr_t receiver_type) { 1026 intptr_t receiver_type() const { return receiver_type_; }
1029 receiver_type_ = receiver_type;
1030 }
1031 1027
1032 intptr_t receiver_type() const { 1028 InstanceCallComp* original() const { return original_; }
1033 return receiver_type_;
1034 }
1035 1029
1036 virtual bool CanDeoptimize() const { return true; } 1030 virtual bool CanDeoptimize() const { return true; }
1037 1031
1038 private: 1032 private:
1039 const intptr_t token_pos_;
1040 const intptr_t try_index_;
1041 intptr_t receiver_type_; 1033 intptr_t receiver_type_;
1034 InstanceCallComp* original_;
1042 1035
1043 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp); 1036 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp);
1044 }; 1037 };
1045 1038
1046 1039
1047 // Not simply an InstanceCall because it has somewhat more complicated
1048 // semantics: the value operand is preserved before the call.
1049 class StoreIndexedComp : public TemplateComputation<3> { 1040 class StoreIndexedComp : public TemplateComputation<3> {
1050 public: 1041 public:
1051 StoreIndexedComp(intptr_t token_pos, 1042 StoreIndexedComp(Value* array,
1052 intptr_t try_index,
1053 Value* array,
1054 Value* index, 1043 Value* index,
1055 Value* value) 1044 Value* value,
1056 : token_pos_(token_pos), 1045 intptr_t receiver_type,
1057 try_index_(try_index), 1046 InstanceCallComp* original)
1058 receiver_type_(kIllegalCid) { 1047 : receiver_type_(receiver_type),
1048 original_(original) {
1059 ASSERT(array != NULL); 1049 ASSERT(array != NULL);
1060 ASSERT(index != NULL); 1050 ASSERT(index != NULL);
1061 ASSERT(value != NULL); 1051 ASSERT(value != NULL);
1062 inputs_[0] = array; 1052 inputs_[0] = array;
1063 inputs_[1] = index; 1053 inputs_[1] = index;
1064 inputs_[2] = value; 1054 inputs_[2] = value;
1065 } 1055 }
1066 1056
1067 DECLARE_COMPUTATION(StoreIndexed) 1057 DECLARE_COMPUTATION(StoreIndexed)
1068 1058
1069 intptr_t token_pos() const { return token_pos_; }
1070 intptr_t try_index() const { return try_index_; }
1071 Value* array() const { return inputs_[0]; } 1059 Value* array() const { return inputs_[0]; }
1072 Value* index() const { return inputs_[1]; } 1060 Value* index() const { return inputs_[1]; }
1073 Value* value() const { return inputs_[2]; } 1061 Value* value() const { return inputs_[2]; }
1074 1062
1075 void set_receiver_type(intptr_t receiver_type) { 1063 InstanceCallComp* original() const { return original_; }
1076 receiver_type_ = receiver_type;
1077 }
1078 1064
1079 intptr_t receiver_type() const { 1065 intptr_t receiver_type() const { return receiver_type_; }
1080 return receiver_type_;
1081 }
1082 1066
1083 virtual bool CanDeoptimize() const { return true; } 1067 virtual bool CanDeoptimize() const { return true; }
1084 1068
1085 private: 1069 private:
1086 const intptr_t token_pos_;
1087 const intptr_t try_index_;
1088 intptr_t receiver_type_; 1070 intptr_t receiver_type_;
1071 InstanceCallComp* original_;
1089 1072
1090 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); 1073 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp);
1091 }; 1074 };
1092 1075
1093 1076
1094 // Note overrideable, built-in: value? false : true. 1077 // Note overrideable, built-in: value? false : true.
1095 class BooleanNegateComp : public TemplateComputation<1> { 1078 class BooleanNegateComp : public TemplateComputation<1> {
1096 public: 1079 public:
1097 explicit BooleanNegateComp(Value* value) { 1080 explicit BooleanNegateComp(Value* value) {
1098 ASSERT(value != NULL); 1081 ASSERT(value != NULL);
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2922 const GrowableArray<BlockEntryInstr*>& block_order_; 2905 const GrowableArray<BlockEntryInstr*>& block_order_;
2923 2906
2924 private: 2907 private:
2925 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2908 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2926 }; 2909 };
2927 2910
2928 2911
2929 } // namespace dart 2912 } // namespace dart
2930 2913
2931 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2914 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698