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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10855053: Align AllocateObjectComp and AllocateObjectWithBoundsCheckComp with ssa allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 Value* value_; 1088 Value* value_;
1089 Value* instantiator_; 1089 Value* instantiator_;
1090 Value* type_arguments_; 1090 Value* type_arguments_;
1091 const AbstractType& type_; 1091 const AbstractType& type_;
1092 const bool negate_result_; 1092 const bool negate_result_;
1093 1093
1094 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); 1094 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp);
1095 }; 1095 };
1096 1096
1097 1097
1098 class AllocateObjectComp : public Computation { 1098 class AllocateObjectComp : public TemplateComputation<0> {
1099 public: 1099 public:
1100 AllocateObjectComp(ConstructorCallNode* node, 1100 AllocateObjectComp(ConstructorCallNode* node,
1101 intptr_t try_index, 1101 intptr_t try_index,
1102 ZoneGrowableArray<Value*>* arguments) 1102 ZoneGrowableArray<PushArgumentInstr*>* arguments)
1103 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { 1103 : ast_node_(*node), try_index_(try_index), arguments_(arguments) {
1104 // Either no arguments or one type-argument and one instantiator. 1104 // Either no arguments or one type-argument and one instantiator.
1105 ASSERT(arguments->is_empty() || (arguments->length() == 2)); 1105 ASSERT(arguments->is_empty() || (arguments->length() == 2));
1106 } 1106 }
1107 1107
1108 DECLARE_COMPUTATION(AllocateObject) 1108 DECLARE_CALL_COMPUTATION(AllocateObject)
1109
1110 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
1111 PushArgumentInstr* ArgumentAt(intptr_t index) const {
1112 return (*arguments_)[index];
1113 }
1109 1114
1110 const Function& constructor() const { return ast_node_.constructor(); } 1115 const Function& constructor() const { return ast_node_.constructor(); }
1111 intptr_t token_pos() const { return ast_node_.token_pos(); } 1116 intptr_t token_pos() const { return ast_node_.token_pos(); }
1112 intptr_t try_index() const { return try_index_; } 1117 intptr_t try_index() const { return try_index_; }
1113 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; }
1114
1115 virtual intptr_t InputCount() const;
1116 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; }
1117 virtual void SetInputAt(intptr_t i, Value* value) {
1118 (*arguments_)[i] = value;
1119 }
1120 1118
1121 virtual void PrintOperandsTo(BufferFormatter* f) const; 1119 virtual void PrintOperandsTo(BufferFormatter* f) const;
1122 1120
1123 virtual bool CanDeoptimize() const { return false; } 1121 virtual bool CanDeoptimize() const { return false; }
1124 1122
1125 private: 1123 private:
1126 const ConstructorCallNode& ast_node_; 1124 const ConstructorCallNode& ast_node_;
1127 const intptr_t try_index_; 1125 const intptr_t try_index_;
1128 ZoneGrowableArray<Value*>* const arguments_; 1126 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
1127
1129 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); 1128 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp);
1130 }; 1129 };
1131 1130
1132 1131
1133 class AllocateObjectWithBoundsCheckComp : public Computation { 1132 class AllocateObjectWithBoundsCheckComp : public TemplateComputation<2> {
1134 public: 1133 public:
1135 AllocateObjectWithBoundsCheckComp(ConstructorCallNode* node, 1134 AllocateObjectWithBoundsCheckComp(ConstructorCallNode* node,
1136 intptr_t try_index, 1135 intptr_t try_index,
1137 ZoneGrowableArray<Value*>* arguments) 1136 Value* type_arguments,
1138 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { 1137 Value* instantiator)
1139 // One type-argument and one instantiator. 1138 : ast_node_(*node), try_index_(try_index) {
1140 ASSERT(arguments->length() == 2); 1139 ASSERT(type_arguments != NULL);
1140 ASSERT(instantiator != NULL);
1141 inputs_[0] = type_arguments;
1142 inputs_[1] = instantiator;
1141 } 1143 }
1142 1144
1143 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) 1145 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck)
1144 1146
1145 const Function& constructor() const { return ast_node_.constructor(); } 1147 const Function& constructor() const { return ast_node_.constructor(); }
1146 intptr_t token_pos() const { return ast_node_.token_pos(); } 1148 intptr_t token_pos() const { return ast_node_.token_pos(); }
1147 intptr_t try_index() const { return try_index_; } 1149 intptr_t try_index() const { return try_index_; }
1148 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; }
1149
1150 virtual intptr_t InputCount() const;
1151 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; }
1152 virtual void SetInputAt(intptr_t i, Value* value) {
1153 (*arguments_)[i] = value;
1154 }
1155 1150
1156 virtual void PrintOperandsTo(BufferFormatter* f) const; 1151 virtual void PrintOperandsTo(BufferFormatter* f) const;
1157 1152
1158 virtual bool CanDeoptimize() const { return false; } 1153 virtual bool CanDeoptimize() const { return false; }
1159 1154
1160 private: 1155 private:
1161 const ConstructorCallNode& ast_node_; 1156 const ConstructorCallNode& ast_node_;
1162 const intptr_t try_index_; 1157 const intptr_t try_index_;
1163 ZoneGrowableArray<Value*>* const arguments_; 1158
1164 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); 1159 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp);
1165 }; 1160 };
1166 1161
1167 1162
1168 class CreateArrayComp : public TemplateComputation<1> { 1163 class CreateArrayComp : public TemplateComputation<1> {
1169 public: 1164 public:
1170 CreateArrayComp(intptr_t token_pos, 1165 CreateArrayComp(intptr_t token_pos,
1171 intptr_t try_index, 1166 intptr_t try_index,
1172 ZoneGrowableArray<Value*>* elements, 1167 ZoneGrowableArray<Value*>* elements,
1173 Value* element_type) 1168 Value* element_type)
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 const GrowableArray<BlockEntryInstr*>& block_order_; 2760 const GrowableArray<BlockEntryInstr*>& block_order_;
2766 2761
2767 private: 2762 private:
2768 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2763 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2769 }; 2764 };
2770 2765
2771 2766
2772 } // namespace dart 2767 } // namespace dart
2773 2768
2774 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2769 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698