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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 public: | 853 public: |
854 enum Fields { | 854 enum Fields { |
855 kStart, // tag. | 855 kStart, // tag. |
856 kCanonicalName, | 856 kCanonicalName, |
857 kPosition, | 857 kPosition, |
858 kEndPosition, | 858 kEndPosition, |
859 kFlags, | 859 kFlags, |
860 kParentClassBinaryOffset, | 860 kParentClassBinaryOffset, |
861 kName, | 861 kName, |
862 kSourceUriIndex, | 862 kSourceUriIndex, |
863 kDocumentationCommentIndex, | |
864 kAnnotations, | 863 kAnnotations, |
865 kType, | 864 kType, |
866 kInitializer, | 865 kInitializer, |
867 kEnd | 866 kEnd |
868 }; | 867 }; |
869 | 868 |
870 explicit FieldHelper(StreamingFlowGraphBuilder* builder) | 869 explicit FieldHelper(StreamingFlowGraphBuilder* builder) |
871 : builder_(builder), | 870 : builder_(builder), |
872 next_read_(kStart), | 871 next_read_(kStart), |
873 has_function_literal_initializer_(false) {} | 872 has_function_literal_initializer_(false) {} |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 if (++next_read_ == field) return; | 912 if (++next_read_ == field) return; |
914 case kName: | 913 case kName: |
915 builder_->SkipName(); // read name. | 914 builder_->SkipName(); // read name. |
916 if (++next_read_ == field) return; | 915 if (++next_read_ == field) return; |
917 case kSourceUriIndex: | 916 case kSourceUriIndex: |
918 source_uri_index_ = builder_->ReadUInt(); // read source_uri_index. | 917 source_uri_index_ = builder_->ReadUInt(); // read source_uri_index. |
919 builder_->current_script_id_ = source_uri_index_; | 918 builder_->current_script_id_ = source_uri_index_; |
920 builder_->record_token_position(position_); | 919 builder_->record_token_position(position_); |
921 builder_->record_token_position(end_position_); | 920 builder_->record_token_position(end_position_); |
922 if (++next_read_ == field) return; | 921 if (++next_read_ == field) return; |
923 case kDocumentationCommentIndex: | |
924 builder_->ReadStringReference(); | |
925 if (++next_read_ == field) return; | |
926 case kAnnotations: { | 922 case kAnnotations: { |
927 annotation_count_ = builder_->ReadListLength(); // read list length. | 923 annotation_count_ = builder_->ReadListLength(); // read list length. |
928 for (intptr_t i = 0; i < annotation_count_; ++i) { | 924 for (intptr_t i = 0; i < annotation_count_; ++i) { |
929 builder_->SkipExpression(); // read ith expression. | 925 builder_->SkipExpression(); // read ith expression. |
930 } | 926 } |
931 if (++next_read_ == field) return; | 927 if (++next_read_ == field) return; |
932 } | 928 } |
933 case kType: | 929 case kType: |
934 builder_->SkipDartType(); // read type. | 930 builder_->SkipDartType(); // read type. |
935 if (++next_read_ == field) return; | 931 if (++next_read_ == field) return; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 enum Fields { | 1002 enum Fields { |
1007 kStart, // tag. | 1003 kStart, // tag. |
1008 kCanonicalName, | 1004 kCanonicalName, |
1009 kPosition, | 1005 kPosition, |
1010 kEndPosition, | 1006 kEndPosition, |
1011 kKind, | 1007 kKind, |
1012 kFlags, | 1008 kFlags, |
1013 kParentClassBinaryOffset, | 1009 kParentClassBinaryOffset, |
1014 kName, | 1010 kName, |
1015 kSourceUriIndex, | 1011 kSourceUriIndex, |
1016 kDocumentationCommentIndex, | |
1017 kAnnotations, | 1012 kAnnotations, |
1018 kFunction, | 1013 kFunction, |
1019 kEnd | 1014 kEnd |
1020 }; | 1015 }; |
1021 | 1016 |
1022 explicit ProcedureHelper(StreamingFlowGraphBuilder* builder) { | 1017 explicit ProcedureHelper(StreamingFlowGraphBuilder* builder) { |
1023 builder_ = builder; | 1018 builder_ = builder; |
1024 next_read_ = kStart; | 1019 next_read_ = kStart; |
1025 } | 1020 } |
1026 | 1021 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 if (++next_read_ == field) return; | 1056 if (++next_read_ == field) return; |
1062 case kName: | 1057 case kName: |
1063 builder_->SkipName(); // read name. | 1058 builder_->SkipName(); // read name. |
1064 if (++next_read_ == field) return; | 1059 if (++next_read_ == field) return; |
1065 case kSourceUriIndex: | 1060 case kSourceUriIndex: |
1066 source_uri_index_ = builder_->ReadUInt(); // read source_uri_index. | 1061 source_uri_index_ = builder_->ReadUInt(); // read source_uri_index. |
1067 builder_->current_script_id_ = source_uri_index_; | 1062 builder_->current_script_id_ = source_uri_index_; |
1068 builder_->record_token_position(position_); | 1063 builder_->record_token_position(position_); |
1069 builder_->record_token_position(end_position_); | 1064 builder_->record_token_position(end_position_); |
1070 if (++next_read_ == field) return; | 1065 if (++next_read_ == field) return; |
1071 case kDocumentationCommentIndex: | |
1072 builder_->ReadStringReference(); | |
1073 if (++next_read_ == field) return; | |
1074 case kAnnotations: { | 1066 case kAnnotations: { |
1075 annotation_count_ = builder_->ReadListLength(); // read list length. | 1067 annotation_count_ = builder_->ReadListLength(); // read list length. |
1076 for (intptr_t i = 0; i < annotation_count_; ++i) { | 1068 for (intptr_t i = 0; i < annotation_count_; ++i) { |
1077 builder_->SkipExpression(); // read ith expression. | 1069 builder_->SkipExpression(); // read ith expression. |
1078 } | 1070 } |
1079 if (++next_read_ == field) return; | 1071 if (++next_read_ == field) return; |
1080 } | 1072 } |
1081 case kFunction: | 1073 case kFunction: |
1082 if (builder_->ReadTag() == kSomething) | 1074 if (builder_->ReadTag() == kSomething) |
1083 builder_->SkipFunctionNode(); // read function node. | 1075 builder_->SkipFunctionNode(); // read function node. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 class ConstructorHelper { | 1122 class ConstructorHelper { |
1131 public: | 1123 public: |
1132 enum Fields { | 1124 enum Fields { |
1133 kStart, // tag. | 1125 kStart, // tag. |
1134 kCanonicalName, | 1126 kCanonicalName, |
1135 kPosition, | 1127 kPosition, |
1136 kEndPosition, | 1128 kEndPosition, |
1137 kFlags, | 1129 kFlags, |
1138 kParentClassBinaryOffset, | 1130 kParentClassBinaryOffset, |
1139 kName, | 1131 kName, |
1140 kDocumentationCommentIndex, | |
1141 kAnnotations, | 1132 kAnnotations, |
1142 kFunction, | 1133 kFunction, |
1143 kInitializers, | 1134 kInitializers, |
1144 kEnd | 1135 kEnd |
1145 }; | 1136 }; |
1146 | 1137 |
1147 explicit ConstructorHelper(StreamingFlowGraphBuilder* builder) { | 1138 explicit ConstructorHelper(StreamingFlowGraphBuilder* builder) { |
1148 builder_ = builder; | 1139 builder_ = builder; |
1149 next_read_ = kStart; | 1140 next_read_ = kStart; |
1150 } | 1141 } |
(...skipping 25 matching lines...) Expand all Loading... |
1176 case kFlags: | 1167 case kFlags: |
1177 flags_ = builder_->ReadFlags(); // read flags. | 1168 flags_ = builder_->ReadFlags(); // read flags. |
1178 if (++next_read_ == field) return; | 1169 if (++next_read_ == field) return; |
1179 case kParentClassBinaryOffset: | 1170 case kParentClassBinaryOffset: |
1180 parent_class_binary_offset_ = | 1171 parent_class_binary_offset_ = |
1181 builder_->ReadUInt(); // read parent class binary offset. | 1172 builder_->ReadUInt(); // read parent class binary offset. |
1182 if (++next_read_ == field) return; | 1173 if (++next_read_ == field) return; |
1183 case kName: | 1174 case kName: |
1184 builder_->SkipName(); // read name. | 1175 builder_->SkipName(); // read name. |
1185 if (++next_read_ == field) return; | 1176 if (++next_read_ == field) return; |
1186 case kDocumentationCommentIndex: | |
1187 builder_->ReadStringReference(); | |
1188 if (++next_read_ == field) return; | |
1189 case kAnnotations: { | 1177 case kAnnotations: { |
1190 annotation_count_ = builder_->ReadListLength(); // read list length. | 1178 annotation_count_ = builder_->ReadListLength(); // read list length. |
1191 for (intptr_t i = 0; i < annotation_count_; ++i) { | 1179 for (intptr_t i = 0; i < annotation_count_; ++i) { |
1192 builder_->SkipExpression(); // read ith expression. | 1180 builder_->SkipExpression(); // read ith expression. |
1193 } | 1181 } |
1194 if (++next_read_ == field) return; | 1182 if (++next_read_ == field) return; |
1195 } | 1183 } |
1196 case kFunction: | 1184 case kFunction: |
1197 builder_->SkipFunctionNode(); // read function. | 1185 builder_->SkipFunctionNode(); // read function. |
1198 if (++next_read_ == field) return; | 1186 if (++next_read_ == field) return; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 private: | 1531 private: |
1544 Reader* reader_; | 1532 Reader* reader_; |
1545 intptr_t saved_offset_; | 1533 intptr_t saved_offset_; |
1546 }; | 1534 }; |
1547 | 1535 |
1548 } // namespace kernel | 1536 } // namespace kernel |
1549 } // namespace dart | 1537 } // namespace dart |
1550 | 1538 |
1551 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1539 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1552 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 1540 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
OLD | NEW |