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