OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 5 #ifndef RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 // One can then for instance read the field from the call-site (and remember to | 1191 // One can then for instance read the field from the call-site (and remember to |
1192 // call SetAt to inform this helper class), and then use this to read more. | 1192 // call SetAt to inform this helper class), and then use this to read more. |
1193 // "Dumb" fields are stored (e.g. integers) and can be fetched from this class. | 1193 // "Dumb" fields are stored (e.g. integers) and can be fetched from this class. |
1194 // If asked to read a "non-dumb" field (e.g. an expression) it will be skipped. | 1194 // If asked to read a "non-dumb" field (e.g. an expression) it will be skipped. |
1195 class ClassHelper { | 1195 class ClassHelper { |
1196 public: | 1196 public: |
1197 enum Fields { | 1197 enum Fields { |
1198 kStart, // tag. | 1198 kStart, // tag. |
1199 kCanonicalName, | 1199 kCanonicalName, |
1200 kPosition, | 1200 kPosition, |
| 1201 kEndPosition, |
1201 kIsAbstract, | 1202 kIsAbstract, |
1202 kNameIndex, | 1203 kNameIndex, |
1203 kSourceUriIndex, | 1204 kSourceUriIndex, |
1204 kAnnotations, | 1205 kAnnotations, |
1205 kTypeParameters, | 1206 kTypeParameters, |
1206 kSuperClass, | 1207 kSuperClass, |
1207 kMixinType, | 1208 kMixinType, |
1208 kImplementedClasses, | 1209 kImplementedClasses, |
1209 kFields, | 1210 kFields, |
1210 kConstructors, | 1211 kConstructors, |
(...skipping 20 matching lines...) Expand all Loading... |
1231 ASSERT(tag == kClass); | 1232 ASSERT(tag == kClass); |
1232 if (++next_read_ == field) return; | 1233 if (++next_read_ == field) return; |
1233 } | 1234 } |
1234 case kCanonicalName: | 1235 case kCanonicalName: |
1235 canonical_name_ = | 1236 canonical_name_ = |
1236 builder_->ReadCanonicalNameReference(); // read canonical_name. | 1237 builder_->ReadCanonicalNameReference(); // read canonical_name. |
1237 if (++next_read_ == field) return; | 1238 if (++next_read_ == field) return; |
1238 case kPosition: | 1239 case kPosition: |
1239 position_ = builder_->ReadPosition(false); // read position. | 1240 position_ = builder_->ReadPosition(false); // read position. |
1240 if (++next_read_ == field) return; | 1241 if (++next_read_ == field) return; |
| 1242 case kEndPosition: |
| 1243 end_position_ = builder_->ReadPosition(); // read end position. |
| 1244 if (++next_read_ == field) return; |
1241 case kIsAbstract: | 1245 case kIsAbstract: |
1242 is_abstract_ = builder_->ReadBool(); // read is_abstract. | 1246 is_abstract_ = builder_->ReadBool(); // read is_abstract. |
1243 if (++next_read_ == field) return; | 1247 if (++next_read_ == field) return; |
1244 case kNameIndex: | 1248 case kNameIndex: |
1245 name_index_ = builder_->ReadStringReference(); // read name index. | 1249 name_index_ = builder_->ReadStringReference(); // read name index. |
1246 if (++next_read_ == field) return; | 1250 if (++next_read_ == field) return; |
1247 case kSourceUriIndex: | 1251 case kSourceUriIndex: |
1248 source_uri_index_ = builder_->ReadUInt(); // read source_uri_index. | 1252 source_uri_index_ = builder_->ReadUInt(); // read source_uri_index. |
1249 builder_->current_script_id_ = source_uri_index_; | 1253 builder_->current_script_id_ = source_uri_index_; |
1250 builder_->record_token_position(position_); | 1254 builder_->record_token_position(position_); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 } | 1311 } |
1308 | 1312 |
1309 void SetNext(Fields field) { next_read_ = field; } | 1313 void SetNext(Fields field) { next_read_ = field; } |
1310 void SetJustRead(Fields field) { | 1314 void SetJustRead(Fields field) { |
1311 next_read_ = field; | 1315 next_read_ = field; |
1312 ++next_read_; | 1316 ++next_read_; |
1313 } | 1317 } |
1314 | 1318 |
1315 NameIndex canonical_name_; | 1319 NameIndex canonical_name_; |
1316 TokenPosition position_; | 1320 TokenPosition position_; |
| 1321 TokenPosition end_position_; |
1317 bool is_abstract_; | 1322 bool is_abstract_; |
1318 StringIndex name_index_; | 1323 StringIndex name_index_; |
1319 intptr_t source_uri_index_; | 1324 intptr_t source_uri_index_; |
1320 | 1325 |
1321 private: | 1326 private: |
1322 StreamingFlowGraphBuilder* builder_; | 1327 StreamingFlowGraphBuilder* builder_; |
1323 intptr_t next_read_; | 1328 intptr_t next_read_; |
1324 }; | 1329 }; |
1325 | 1330 |
1326 // Helper class that reads a kernel Library from binary. | 1331 // Helper class that reads a kernel Library from binary. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 private: | 1463 private: |
1459 Reader* reader_; | 1464 Reader* reader_; |
1460 intptr_t saved_offset_; | 1465 intptr_t saved_offset_; |
1461 }; | 1466 }; |
1462 | 1467 |
1463 } // namespace kernel | 1468 } // namespace kernel |
1464 } // namespace dart | 1469 } // namespace dart |
1465 | 1470 |
1466 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1471 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1467 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 1472 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
OLD | NEW |