Chromium Code Reviews| 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 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1943 Instruction* last_instruction_; | 1943 Instruction* last_instruction_; |
| 1944 | 1944 |
| 1945 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); | 1945 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); |
| 1946 }; | 1946 }; |
| 1947 | 1947 |
| 1948 | 1948 |
| 1949 class ForwardInstructionIterator : public ValueObject { | 1949 class ForwardInstructionIterator : public ValueObject { |
| 1950 public: | 1950 public: |
| 1951 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) | 1951 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) |
| 1952 : block_entry_(block_entry), current_(block_entry) { | 1952 : block_entry_(block_entry), current_(block_entry) { |
| 1953 ASSERT(block_entry_->last_instruction()->next() == NULL); | |
| 1953 Advance(); | 1954 Advance(); |
| 1954 } | 1955 } |
| 1955 | 1956 |
| 1956 void Advance() { | 1957 void Advance() { |
| 1957 ASSERT(!Done()); | 1958 ASSERT(!Done()); |
| 1958 current_ = current_->next(); | 1959 current_ = current_->next(); |
| 1959 } | 1960 } |
| 1960 | 1961 |
| 1961 bool Done() const { | 1962 bool Done() const { return current_ == NULL; } |
| 1962 return current_ == block_entry_->last_instruction()->next(); | |
| 1963 } | |
| 1964 | 1963 |
| 1965 // Removes 'current_' from graph and sets 'current_' to previous instruction. | 1964 // Removes 'current_' from graph and sets 'current_' to previous instruction. |
| 1966 void RemoveCurrentFromGraph(); | 1965 void RemoveCurrentFromGraph(); |
| 1967 | 1966 |
| 1968 Instruction* Current() const { return current_; } | 1967 Instruction* Current() const { return current_; } |
| 1969 | 1968 |
| 1970 private: | 1969 private: |
| 1971 BlockEntryInstr* block_entry_; | 1970 BlockEntryInstr* block_entry_; |
| 1972 Instruction* current_; | 1971 Instruction* current_; |
| 1973 }; | 1972 }; |
| 1974 | 1973 |
| 1975 | 1974 |
| 1975 class BackwardInstructionIterator : public ValueObject { | |
| 1976 public: | |
| 1977 explicit BackwardInstructionIterator(BlockEntryInstr* block_entry) | |
| 1978 : block_entry_(block_entry), current_(block_entry->last_instruction()) { | |
| 1979 ASSERT(block_entry_->previous() == NULL); | |
| 1980 } | |
| 1981 | |
| 1982 void Advance() { | |
| 1983 ASSERT(!Done()); | |
| 1984 current_ = current_->previous(); | |
| 1985 } | |
| 1986 | |
| 1987 bool Done() const { return current_ == block_entry_; } | |
| 1988 | |
| 1989 Instruction* Current() const { return current_; } | |
|
srdjan
2012/07/24 15:49:30
s/Current/current/ (also for ForwardInstructionI
Florian Schneider
2012/07/25 08:31:29
I leave it as is to be consistent with the names o
srdjan
2012/07/25 15:19:30
Yes, the consistency argument is valid.
Since lowe
| |
| 1990 | |
| 1991 private: | |
| 1992 BlockEntryInstr* block_entry_; | |
| 1993 Instruction* current_; | |
| 1994 }; | |
| 1995 | |
| 1996 | |
| 1976 class GraphEntryInstr : public BlockEntryInstr { | 1997 class GraphEntryInstr : public BlockEntryInstr { |
| 1977 public: | 1998 public: |
| 1978 explicit GraphEntryInstr(TargetEntryInstr* normal_entry) | 1999 explicit GraphEntryInstr(TargetEntryInstr* normal_entry) |
| 1979 : BlockEntryInstr(), | 2000 : BlockEntryInstr(), |
| 1980 normal_entry_(normal_entry), | 2001 normal_entry_(normal_entry), |
| 1981 catch_entries_(), | 2002 catch_entries_(), |
| 1982 start_env_(NULL) { } | 2003 start_env_(NULL) { } |
| 1983 | 2004 |
| 1984 DECLARE_INSTRUCTION(GraphEntry) | 2005 DECLARE_INSTRUCTION(GraphEntry) |
| 1985 | 2006 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2533 const GrowableArray<BlockEntryInstr*>& block_order_; | 2554 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2534 | 2555 |
| 2535 private: | 2556 private: |
| 2536 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2557 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2537 }; | 2558 }; |
| 2538 | 2559 |
| 2539 | 2560 |
| 2540 } // namespace dart | 2561 } // namespace dart |
| 2541 | 2562 |
| 2542 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2563 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |