| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); | 2161 HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); |
| 2162 friend class Class; | 2162 friend class Class; |
| 2163 }; | 2163 }; |
| 2164 | 2164 |
| 2165 | 2165 |
| 2166 class PcDescriptors : public Object { | 2166 class PcDescriptors : public Object { |
| 2167 private: | 2167 private: |
| 2168 // Describes the layout of PC descriptor data. | 2168 // Describes the layout of PC descriptor data. |
| 2169 enum { | 2169 enum { |
| 2170 kPcEntry = 0, // PC value of the descriptor, unique. | 2170 kPcEntry = 0, // PC value of the descriptor, unique. |
| 2171 kKindEntry, | 2171 kKindEntry = 1, |
| 2172 kDeoptIdEntry, // Deopt id. | 2172 kDeoptIdEntry = 2, // Deopt id. |
| 2173 kTokenPosEntry, // Token position in source of PC. | 2173 kTokenPosEntry = 3, // Token position in source. |
| 2174 kTryIndexEntry, // Try block index of PC. | 2174 kDeoptReasonEntry = 3, // DeoptReasonId. |
| 2175 kTryIndexEntry = 4, // Try block index. |
| 2176 kDeoptIndexEntry = 4, // Deoptimization array index. |
| 2175 // We would potentially be adding other objects here like | 2177 // We would potentially be adding other objects here like |
| 2176 // pointer maps for optimized functions, local variables information etc. | 2178 // pointer maps for optimized functions, local variables information etc. |
| 2177 kNumberOfEntries | 2179 kNumberOfEntries = 5, |
| 2178 }; | 2180 }; |
| 2179 | 2181 |
| 2180 public: | 2182 public: |
| 2181 enum Kind { | 2183 enum Kind { |
| 2182 kDeopt = 0, // Deoptimization continuation point. | 2184 kDeopt = 0, // Deoptimization continuation point. |
| 2183 kDeoptIndex, // Index into deopt info array. | 2185 kDeoptIndex, // Index into deopt info array. |
| 2184 kPatchCode, // Buffer for patching code entry. | 2186 kPatchCode, // Buffer for patching code entry. |
| 2185 kIcCall, // IC call. | 2187 kIcCall, // IC call. |
| 2186 kFuncCall, // Call to known target, e.g. static call, closure call. | 2188 kFuncCall, // Call to known target, e.g. static call, closure call. |
| 2187 kReturn, // Return from function. | 2189 kReturn, // Return from function. |
| 2188 kOther | 2190 kOther |
| 2189 }; | 2191 }; |
| 2190 | 2192 |
| 2191 intptr_t Length() const; | 2193 intptr_t Length() const; |
| 2192 | 2194 |
| 2193 uword PC(intptr_t index) const; | 2195 uword PC(intptr_t index) const; |
| 2194 PcDescriptors::Kind DescriptorKind(intptr_t index) const; | 2196 PcDescriptors::Kind DescriptorKind(intptr_t index) const; |
| 2195 const char* KindAsStr(intptr_t index) const; | 2197 const char* KindAsStr(intptr_t index) const; |
| 2196 intptr_t DeoptId(intptr_t index) const; | 2198 intptr_t DeoptId(intptr_t index) const; |
| 2197 intptr_t TokenPos(intptr_t index) const; | 2199 intptr_t TokenPos(intptr_t index) const; |
| 2198 intptr_t TryIndex(intptr_t index) const; | 2200 intptr_t TryIndex(intptr_t index) const; |
| 2201 // Different encoding for kDeoptIndex. |
| 2199 // Index into the deopt-info array of Code object. | 2202 // Index into the deopt-info array of Code object. |
| 2200 intptr_t DeoptIndex(intptr_t index) const; | 2203 intptr_t DeoptIndex(intptr_t index) const; |
| 2204 intptr_t DeoptReason(intptr_t index) const; |
| 2201 | 2205 |
| 2202 void AddDescriptor(intptr_t index, | 2206 void AddDescriptor(intptr_t index, |
| 2203 uword pc, | 2207 uword pc, |
| 2204 PcDescriptors::Kind kind, | 2208 PcDescriptors::Kind kind, |
| 2205 intptr_t deopt_id, | 2209 intptr_t deopt_id, |
| 2206 intptr_t token_pos, | 2210 intptr_t token_pos, // Or deopt reason. |
| 2207 intptr_t try_index) const { | 2211 intptr_t try_index) const { // Or deopt index. |
| 2208 SetPC(index, pc); | 2212 SetPC(index, pc); |
| 2209 SetKind(index, kind); | 2213 SetKind(index, kind); |
| 2210 SetDeoptId(index, deopt_id); | 2214 SetDeoptId(index, deopt_id); |
| 2211 SetTokenPos(index, token_pos); | 2215 SetTokenPos(index, token_pos); |
| 2212 SetTryIndex(index, try_index); | 2216 SetTryIndex(index, try_index); |
| 2213 } | 2217 } |
| 2214 | 2218 |
| 2215 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 2219 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
| 2216 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 2220 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
| 2217 | 2221 |
| (...skipping 3197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5415 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5419 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5416 return false; | 5420 return false; |
| 5417 } | 5421 } |
| 5418 } | 5422 } |
| 5419 return true; | 5423 return true; |
| 5420 } | 5424 } |
| 5421 | 5425 |
| 5422 } // namespace dart | 5426 } // namespace dart |
| 5423 | 5427 |
| 5424 #endif // VM_OBJECT_H_ | 5428 #endif // VM_OBJECT_H_ |
| OLD | NEW |