| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_CODE_GENERATOR_H_ | 5 #ifndef VM_CODE_GENERATOR_H_ |
| 6 #define VM_CODE_GENERATOR_H_ | 6 #define VM_CODE_GENERATOR_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/runtime_entry.h" | 9 #include "vm/runtime_entry.h" |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 private: | 115 private: |
| 116 static void EnterFunctionAt(int i, | 116 static void EnterFunctionAt(int i, |
| 117 const Array& cache, | 117 const Array& cache, |
| 118 const Function& function, | 118 const Function& function, |
| 119 int num_arguments, | 119 int num_arguments, |
| 120 int num_named_arguments); | 120 int num_named_arguments); |
| 121 | 121 |
| 122 const Class& class_; | 122 const Class& class_; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 |
| 126 class CodeGenerator::DescriptorList : public ZoneAllocated { |
| 127 public: |
| 128 struct PcDesc { |
| 129 intptr_t pc_offset; // PC offset value of the descriptor. |
| 130 PcDescriptors::Kind kind; // Descriptor kind (kDeopt, kOther). |
| 131 intptr_t node_id; // AST node id. |
| 132 intptr_t token_index; // Token position in source of PC. |
| 133 intptr_t try_index; // Try block index of PC. |
| 134 }; |
| 135 |
| 136 DescriptorList() : list_() { |
| 137 } |
| 138 ~DescriptorList() { } |
| 139 |
| 140 intptr_t Length() const { |
| 141 return list_.length(); |
| 142 } |
| 143 |
| 144 intptr_t PcOffset(int index) const { |
| 145 return list_[index].pc_offset; |
| 146 } |
| 147 PcDescriptors::Kind Kind(int index) const { |
| 148 return list_[index].kind; |
| 149 } |
| 150 intptr_t NodeId(int index) const { |
| 151 return list_[index].node_id; |
| 152 } |
| 153 intptr_t TokenIndex(int index) const { |
| 154 return list_[index].token_index; |
| 155 } |
| 156 intptr_t TryIndex(int index) const { |
| 157 return list_[index].try_index; |
| 158 } |
| 159 |
| 160 void AddDescriptor(PcDescriptors::Kind kind, |
| 161 intptr_t pc_offset, |
| 162 intptr_t node_id, |
| 163 intptr_t token_index, |
| 164 intptr_t try_index); |
| 165 |
| 166 RawPcDescriptors* FinalizePcDescriptors(uword entry_point); |
| 167 |
| 168 private: |
| 169 GrowableArray<struct PcDesc> list_; |
| 170 DISALLOW_COPY_AND_ASSIGN(DescriptorList); |
| 171 }; |
| 172 |
| 125 } // namespace dart | 173 } // namespace dart |
| 126 | 174 |
| 127 #endif // VM_CODE_GENERATOR_H_ | 175 #endif // VM_CODE_GENERATOR_H_ |
| OLD | NEW |