| 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 ZoneGrowableArray<PhiInstr*>* phis_; | 971 ZoneGrowableArray<PhiInstr*>* phis_; |
| 972 intptr_t index_; | 972 intptr_t index_; |
| 973 }; | 973 }; |
| 974 | 974 |
| 975 | 975 |
| 976 class TargetEntryInstr : public BlockEntryInstr { | 976 class TargetEntryInstr : public BlockEntryInstr { |
| 977 public: | 977 public: |
| 978 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth) | 978 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t loop_depth) |
| 979 : BlockEntryInstr(block_id, try_index, loop_depth), | 979 : BlockEntryInstr(block_id, try_index, loop_depth), |
| 980 predecessor_(NULL), | 980 predecessor_(NULL), |
| 981 catch_try_index_(CatchClauseNode::kInvalidTryIndex) { } | 981 catch_try_index_(CatchClauseNode::kInvalidTryIndex), |
| 982 catch_handler_types_(Array::ZoneHandle()) { } |
| 982 | 983 |
| 983 DECLARE_INSTRUCTION(TargetEntry) | 984 DECLARE_INSTRUCTION(TargetEntry) |
| 984 | 985 |
| 985 virtual intptr_t PredecessorCount() const { | 986 virtual intptr_t PredecessorCount() const { |
| 986 return (predecessor_ == NULL) ? 0 : 1; | 987 return (predecessor_ == NULL) ? 0 : 1; |
| 987 } | 988 } |
| 988 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 989 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 989 ASSERT((index == 0) && (predecessor_ != NULL)); | 990 ASSERT((index == 0) && (predecessor_ != NULL)); |
| 990 return predecessor_; | 991 return predecessor_; |
| 991 } | 992 } |
| 992 | 993 |
| 993 // Returns true if this Block is an entry of a catch handler. | 994 // Returns true if this Block is an entry of a catch handler. |
| 994 bool IsCatchEntry() const { | 995 bool IsCatchEntry() const { |
| 995 return catch_try_index_ != CatchClauseNode::kInvalidTryIndex; | 996 return catch_try_index_ != CatchClauseNode::kInvalidTryIndex; |
| 996 } | 997 } |
| 997 | 998 |
| 998 // Returns try index for the try block to which this catch handler | 999 // Returns try index for the try block to which this catch handler |
| 999 // corresponds. | 1000 // corresponds. |
| 1000 intptr_t catch_try_index() const { | 1001 intptr_t catch_try_index() const { |
| 1001 ASSERT(IsCatchEntry()); | 1002 ASSERT(IsCatchEntry()); |
| 1002 return catch_try_index_; | 1003 return catch_try_index_; |
| 1003 } | 1004 } |
| 1004 void set_catch_try_index(intptr_t index) { catch_try_index_ = index; } | 1005 void set_catch_try_index(intptr_t index) { catch_try_index_ = index; } |
| 1006 void set_catch_handler_types(const Array& handler_types) { |
| 1007 catch_handler_types_ = handler_types.raw(); |
| 1008 } |
| 1005 | 1009 |
| 1006 virtual void PrepareEntry(FlowGraphCompiler* compiler); | 1010 virtual void PrepareEntry(FlowGraphCompiler* compiler); |
| 1007 | 1011 |
| 1008 virtual void PrintTo(BufferFormatter* f) const; | 1012 virtual void PrintTo(BufferFormatter* f) const; |
| 1009 | 1013 |
| 1010 private: | 1014 private: |
| 1011 friend class FlowGraph; // Access to predecessor_ when inlining. | 1015 friend class FlowGraph; // Access to predecessor_ when inlining. |
| 1012 virtual void ClearPredecessors() { predecessor_ = NULL; } | 1016 virtual void ClearPredecessors() { predecessor_ = NULL; } |
| 1013 virtual void AddPredecessor(BlockEntryInstr* predecessor) { | 1017 virtual void AddPredecessor(BlockEntryInstr* predecessor) { |
| 1014 ASSERT(predecessor_ == NULL); | 1018 ASSERT(predecessor_ == NULL); |
| 1015 predecessor_ = predecessor; | 1019 predecessor_ = predecessor; |
| 1016 } | 1020 } |
| 1017 | 1021 |
| 1018 BlockEntryInstr* predecessor_; | 1022 BlockEntryInstr* predecessor_; |
| 1019 intptr_t catch_try_index_; | 1023 intptr_t catch_try_index_; |
| 1024 Array& catch_handler_types_; |
| 1020 | 1025 |
| 1021 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); | 1026 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); |
| 1022 }; | 1027 }; |
| 1023 | 1028 |
| 1024 | 1029 |
| 1025 // Abstract super-class of all instructions that define a value (Bind, Phi). | 1030 // Abstract super-class of all instructions that define a value (Bind, Phi). |
| 1026 class Definition : public Instruction { | 1031 class Definition : public Instruction { |
| 1027 public: | 1032 public: |
| 1028 enum UseKind { kEffect, kValue }; | 1033 enum UseKind { kEffect, kValue }; |
| 1029 | 1034 |
| (...skipping 3359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4389 ForwardInstructionIterator* current_iterator_; | 4394 ForwardInstructionIterator* current_iterator_; |
| 4390 | 4395 |
| 4391 private: | 4396 private: |
| 4392 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4397 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4393 }; | 4398 }; |
| 4394 | 4399 |
| 4395 | 4400 |
| 4396 } // namespace dart | 4401 } // namespace dart |
| 4397 | 4402 |
| 4398 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4403 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |