Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #undef DEFINE_ENUM_LIST | 64 #undef DEFINE_ENUM_LIST |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 static Kind RecognizeKind(const Function& function); | 67 static Kind RecognizeKind(const Function& function); |
| 68 static const char* KindToCString(Kind kind); | 68 static const char* KindToCString(Kind kind); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 | 71 |
| 72 class Value : public ZoneAllocated { | 72 class Value : public ZoneAllocated { |
| 73 public: | 73 public: |
| 74 // A forward iterator that allows removing the current value from the | |
| 75 // underlying use list during iteration. | |
| 76 class Iterator { | |
|
srdjan
2013/02/04 21:38:17
public ValueObject?
| |
| 77 public: | |
| 78 explicit Iterator(Value* head) : next_(head) { Advance(); } | |
| 79 Value* Current() const { return current_; } | |
| 80 bool Done() const { return current_ == NULL; } | |
| 81 void Advance() { | |
| 82 // Pre-fetch next on advance and cache it. | |
| 83 current_ = next_; | |
| 84 if (next_ != NULL) next_ = next_->next_use(); | |
| 85 } | |
| 86 private: | |
| 87 Value* current_; | |
| 88 Value* next_; | |
| 89 }; | |
| 90 | |
| 74 explicit Value(Definition* definition) | 91 explicit Value(Definition* definition) |
| 75 : definition_(definition), | 92 : definition_(definition), |
| 76 previous_use_(NULL), | 93 previous_use_(NULL), |
| 77 next_use_(NULL), | 94 next_use_(NULL), |
| 78 instruction_(NULL), | 95 instruction_(NULL), |
| 79 use_index_(-1), | 96 use_index_(-1), |
| 80 reaching_cid_(kIllegalCid) { } | 97 reaching_cid_(kIllegalCid) { } |
| 81 | 98 |
| 82 Definition* definition() const { return definition_; } | 99 Definition* definition() const { return definition_; } |
| 83 void set_definition(Definition* definition) { definition_ = definition; } | 100 void set_definition(Definition* definition) { definition_ = definition; } |
| (...skipping 4393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4477 ForwardInstructionIterator* current_iterator_; | 4494 ForwardInstructionIterator* current_iterator_; |
| 4478 | 4495 |
| 4479 private: | 4496 private: |
| 4480 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4497 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4481 }; | 4498 }; |
| 4482 | 4499 |
| 4483 | 4500 |
| 4484 } // namespace dart | 4501 } // namespace dart |
| 4485 | 4502 |
| 4486 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4503 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |