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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 StreamingFlowGraphBuilder* builder_; | 81 StreamingFlowGraphBuilder* builder_; |
82 TranslationHelper& translation_helper_; | 82 TranslationHelper& translation_helper_; |
83 ActiveClass* active_class_; | 83 ActiveClass* active_class_; |
84 TypeParameterScope* type_parameter_scope_; | 84 TypeParameterScope* type_parameter_scope_; |
85 Zone* zone_; | 85 Zone* zone_; |
86 AbstractType& result_; | 86 AbstractType& result_; |
87 bool finalize_; | 87 bool finalize_; |
88 | 88 |
89 friend class StreamingScopeBuilder; | 89 friend class StreamingScopeBuilder; |
| 90 friend class KernelReader; |
90 }; | 91 }; |
91 | 92 |
92 | 93 |
93 class StreamingScopeBuilder { | 94 class StreamingScopeBuilder { |
94 public: | 95 public: |
95 StreamingScopeBuilder(ParsedFunction* parsed_function, | 96 StreamingScopeBuilder(ParsedFunction* parsed_function, |
96 intptr_t kernel_offset, | 97 intptr_t kernel_offset, |
97 const uint8_t* buffer, | 98 const uint8_t* buffer, |
98 intptr_t buffer_length); | 99 intptr_t buffer_length); |
99 | 100 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 uint8_t ReadByte(); | 375 uint8_t ReadByte(); |
375 uint32_t ReadUInt(); | 376 uint32_t ReadUInt(); |
376 uint32_t PeekUInt(); | 377 uint32_t PeekUInt(); |
377 intptr_t ReadListLength(); | 378 intptr_t ReadListLength(); |
378 StringIndex ReadStringReference(); | 379 StringIndex ReadStringReference(); |
379 NameIndex ReadCanonicalNameReference(); | 380 NameIndex ReadCanonicalNameReference(); |
380 StringIndex ReadNameAsStringIndex(); | 381 StringIndex ReadNameAsStringIndex(); |
381 const dart::String& ReadNameAsMethodName(); | 382 const dart::String& ReadNameAsMethodName(); |
382 const dart::String& ReadNameAsGetterName(); | 383 const dart::String& ReadNameAsGetterName(); |
383 const dart::String& ReadNameAsSetterName(); | 384 const dart::String& ReadNameAsSetterName(); |
| 385 const dart::String& ReadNameAsFieldName(); |
384 void SkipStringReference(); | 386 void SkipStringReference(); |
385 void SkipCanonicalNameReference(); | 387 void SkipCanonicalNameReference(); |
386 void SkipDartType(); | 388 void SkipDartType(); |
387 void SkipOptionalDartType(); | 389 void SkipOptionalDartType(); |
388 void SkipInterfaceType(bool simple); | 390 void SkipInterfaceType(bool simple); |
389 void SkipFunctionType(bool simple); | 391 void SkipFunctionType(bool simple); |
390 void SkipListOfExpressions(); | 392 void SkipListOfExpressions(); |
391 void SkipListOfDartTypes(); | 393 void SkipListOfDartTypes(); |
392 void SkipListOfVariableDeclarations(); | 394 void SkipListOfVariableDeclarations(); |
393 void SkipTypeParametersList(); | 395 void SkipTypeParametersList(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 608 |
607 friend class StreamingConstantEvaluator; | 609 friend class StreamingConstantEvaluator; |
608 friend class StreamingDartTypeTranslator; | 610 friend class StreamingDartTypeTranslator; |
609 friend class StreamingScopeBuilder; | 611 friend class StreamingScopeBuilder; |
610 friend class FunctionNodeHelper; | 612 friend class FunctionNodeHelper; |
611 friend class VariableDeclarationHelper; | 613 friend class VariableDeclarationHelper; |
612 friend class FieldHelper; | 614 friend class FieldHelper; |
613 friend class ProcedureHelper; | 615 friend class ProcedureHelper; |
614 friend class ClassHelper; | 616 friend class ClassHelper; |
615 friend class ConstructorHelper; | 617 friend class ConstructorHelper; |
| 618 friend class SimpleExpressionConverter; |
| 619 friend class KernelReader; |
616 }; | 620 }; |
617 | 621 |
618 // Helper class that reads a kernel FunctionNode from binary. | 622 // Helper class that reads a kernel FunctionNode from binary. |
619 // | 623 // |
620 // Use ReadUntilExcluding to read up to but not including a field. | 624 // Use ReadUntilExcluding to read up to but not including a field. |
621 // One can then for instance read the field from the call-site (and remember to | 625 // One can then for instance read the field from the call-site (and remember to |
622 // call SetAt to inform this helper class), and then use this to read more. | 626 // call SetAt to inform this helper class), and then use this to read more. |
623 // "Dumb" fields are stored (e.g. integers) and can be fetched from this class. | 627 // "Dumb" fields are stored (e.g. integers) and can be fetched from this class. |
624 // If asked to read a "non-dumb" field (e.g. an expression) it will be skipped. | 628 // If asked to read a "non-dumb" field (e.g. an expression) it will be skipped. |
625 class FunctionNodeHelper { | 629 class FunctionNodeHelper { |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 return; | 1127 return; |
1124 } | 1128 } |
1125 } | 1129 } |
1126 | 1130 |
1127 void SetNext(Fields field) { next_read_ = field; } | 1131 void SetNext(Fields field) { next_read_ = field; } |
1128 void SetJustRead(Fields field) { | 1132 void SetJustRead(Fields field) { |
1129 next_read_ = field; | 1133 next_read_ = field; |
1130 ++next_read_; | 1134 ++next_read_; |
1131 } | 1135 } |
1132 | 1136 |
| 1137 bool IsExternal() { |
| 1138 return (flags_ & Constructor::kFlagExternal) == Constructor::kFlagExternal; |
| 1139 } |
| 1140 bool IsConst() { |
| 1141 return (flags_ & Constructor::kFlagConst) == Constructor::kFlagConst; |
| 1142 } |
| 1143 |
1133 NameIndex canonical_name_; | 1144 NameIndex canonical_name_; |
1134 TokenPosition position_; | 1145 TokenPosition position_; |
1135 TokenPosition end_position_; | 1146 TokenPosition end_position_; |
1136 word flags_; | 1147 word flags_; |
1137 intptr_t parent_class_binary_offset_; | 1148 intptr_t parent_class_binary_offset_; |
1138 | 1149 |
1139 private: | 1150 private: |
1140 StreamingFlowGraphBuilder* builder_; | 1151 StreamingFlowGraphBuilder* builder_; |
1141 intptr_t next_read_; | 1152 intptr_t next_read_; |
1142 }; | 1153 }; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 private: | 1307 private: |
1297 Reader* reader_; | 1308 Reader* reader_; |
1298 intptr_t saved_offset_; | 1309 intptr_t saved_offset_; |
1299 }; | 1310 }; |
1300 | 1311 |
1301 } // namespace kernel | 1312 } // namespace kernel |
1302 } // namespace dart | 1313 } // namespace dart |
1303 | 1314 |
1304 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1315 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1305 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 1316 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
OLD | NEW |