| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void Advance() { | 217 void Advance() { |
| 218 // Pre-fetch next on advance and cache it. | 218 // Pre-fetch next on advance and cache it. |
| 219 current_ = next_; | 219 current_ = next_; |
| 220 if (next_ != NULL) next_ = next_->next_use(); | 220 if (next_ != NULL) next_ = next_->next_use(); |
| 221 } | 221 } |
| 222 private: | 222 private: |
| 223 Value* current_; | 223 Value* current_; |
| 224 Value* next_; | 224 Value* next_; |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 explicit Value(Definition* definition, CompileType* type = NULL) | 227 explicit Value(Definition* definition) |
| 228 : definition_(definition), | 228 : definition_(definition), |
| 229 previous_use_(NULL), | 229 previous_use_(NULL), |
| 230 next_use_(NULL), | 230 next_use_(NULL), |
| 231 instruction_(NULL), | 231 instruction_(NULL), |
| 232 use_index_(-1), | 232 use_index_(-1), |
| 233 reaching_type_(type) { } | 233 reaching_type_(NULL) { } |
| 234 | 234 |
| 235 Definition* definition() const { return definition_; } | 235 Definition* definition() const { return definition_; } |
| 236 void set_definition(Definition* definition) { definition_ = definition; } | 236 void set_definition(Definition* definition) { definition_ = definition; } |
| 237 | 237 |
| 238 Value* previous_use() const { return previous_use_; } | 238 Value* previous_use() const { return previous_use_; } |
| 239 void set_previous_use(Value* previous) { previous_use_ = previous; } | 239 void set_previous_use(Value* previous) { previous_use_ = previous; } |
| 240 | 240 |
| 241 Value* next_use() const { return next_use_; } | 241 Value* next_use() const { return next_use_; } |
| 242 void set_next_use(Value* next) { next_use_ = next; } | 242 void set_next_use(Value* next) { next_use_ = next; } |
| 243 | 243 |
| 244 Instruction* instruction() const { return instruction_; } | 244 Instruction* instruction() const { return instruction_; } |
| 245 void set_instruction(Instruction* instruction) { instruction_ = instruction; } | 245 void set_instruction(Instruction* instruction) { instruction_ = instruction; } |
| 246 | 246 |
| 247 intptr_t use_index() const { return use_index_; } | 247 intptr_t use_index() const { return use_index_; } |
| 248 void set_use_index(intptr_t index) { use_index_ = index; } | 248 void set_use_index(intptr_t index) { use_index_ = index; } |
| 249 | 249 |
| 250 static void AddToList(Value* value, Value** list); | 250 static void AddToList(Value* value, Value** list); |
| 251 void RemoveFromUseList(); | 251 void RemoveFromUseList(); |
| 252 | 252 |
| 253 Value* Copy() { return new Value(definition_); } | 253 Value* Copy() { return new Value(definition_); } |
| 254 | 254 |
| 255 // This function must only be used when the new Value is dominated by | 255 // This function must only be used when the new Value is dominated by |
| 256 // the original Value. | 256 // the original Value. |
| 257 Value* CopyWithType() { return new Value(definition_, reaching_type_); } | 257 Value* CopyWithType() { |
| 258 Value* copy = new Value(definition_); |
| 259 copy->reaching_type_ = reaching_type_; |
| 260 return copy; |
| 261 } |
| 258 | 262 |
| 259 CompileType* Type(); | 263 CompileType* Type(); |
| 260 | 264 |
| 261 void SetReachingType(CompileType* type) { | 265 void SetReachingType(CompileType* type) { |
| 262 reaching_type_ = type; | 266 reaching_type_ = type; |
| 263 } | 267 } |
| 264 | 268 |
| 265 void PrintTo(BufferFormatter* f) const; | 269 void PrintTo(BufferFormatter* f) const; |
| 266 | 270 |
| 267 const char* DebugName() const { return "Value"; } | 271 const char* DebugName() const { return "Value"; } |
| (...skipping 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4470 ForwardInstructionIterator* current_iterator_; | 4474 ForwardInstructionIterator* current_iterator_; |
| 4471 | 4475 |
| 4472 private: | 4476 private: |
| 4473 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4477 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4474 }; | 4478 }; |
| 4475 | 4479 |
| 4476 | 4480 |
| 4477 } // namespace dart | 4481 } // namespace dart |
| 4478 | 4482 |
| 4479 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4483 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |