| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 public: | 52 public: |
| 53 TypeParameterScope(StreamingDartTypeTranslator* translator, | 53 TypeParameterScope(StreamingDartTypeTranslator* translator, |
| 54 intptr_t parameters_offset, | 54 intptr_t parameters_offset, |
| 55 intptr_t parameters_count) | 55 intptr_t parameters_count) |
| 56 : parameters_offset_(parameters_offset), | 56 : parameters_offset_(parameters_offset), |
| 57 parameters_count_(parameters_count), | 57 parameters_count_(parameters_count), |
| 58 outer_(translator->type_parameter_scope_), | 58 outer_(translator->type_parameter_scope_), |
| 59 translator_(translator) { | 59 translator_(translator) { |
| 60 translator_->type_parameter_scope_ = this; | 60 translator_->type_parameter_scope_ = this; |
| 61 } | 61 } |
| 62 ~TypeParameterScope() { | 62 ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; } |
| 63 translator_->type_parameter_scope_ = outer_; | |
| 64 } | |
| 65 | 63 |
| 66 TypeParameterScope* outer() const { return outer_; } | 64 TypeParameterScope* outer() const { return outer_; } |
| 67 intptr_t parameters_offset() const { return parameters_offset_; } | 65 intptr_t parameters_offset() const { return parameters_offset_; } |
| 68 intptr_t parameters_count() const { return parameters_count_; } | 66 intptr_t parameters_count() const { return parameters_count_; } |
| 69 | 67 |
| 70 private: | 68 private: |
| 71 intptr_t parameters_offset_; | 69 intptr_t parameters_offset_; |
| 72 intptr_t parameters_count_; | 70 intptr_t parameters_count_; |
| 73 TypeParameterScope* outer_; | 71 TypeParameterScope* outer_; |
| 74 StreamingDartTypeTranslator* translator_; | 72 StreamingDartTypeTranslator* translator_; |
| 75 }; | 73 }; |
| 76 | 74 |
| 77 intptr_t FindTypeParameterIndex(intptr_t parameters_offset, | 75 intptr_t FindTypeParameterIndex(intptr_t parameters_offset, |
| 78 intptr_t parameters_count, | 76 intptr_t parameters_count, |
| 79 intptr_t look_for); | 77 intptr_t look_for); |
| 80 | 78 |
| 81 StreamingFlowGraphBuilder* builder_; | 79 StreamingFlowGraphBuilder* builder_; |
| 82 TranslationHelper& translation_helper_; | 80 TranslationHelper& translation_helper_; |
| 83 ActiveClass* active_class_; | 81 ActiveClass* active_class_; |
| 84 TypeParameterScope* type_parameter_scope_; | 82 TypeParameterScope* type_parameter_scope_; |
| 85 Zone* zone_; | 83 Zone* zone_; |
| 86 AbstractType& result_; | 84 AbstractType& result_; |
| 87 bool finalize_; | 85 bool finalize_; |
| 88 | 86 |
| 89 friend class StreamingScopeBuilder; | 87 friend class StreamingScopeBuilder; |
| 90 friend class KernelReader; | 88 friend class KernelReader; |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 | |
| 94 class StreamingScopeBuilder { | 91 class StreamingScopeBuilder { |
| 95 public: | 92 public: |
| 96 StreamingScopeBuilder(ParsedFunction* parsed_function, | 93 StreamingScopeBuilder(ParsedFunction* parsed_function, |
| 97 intptr_t kernel_offset, | 94 intptr_t kernel_offset, |
| 98 const uint8_t* buffer, | 95 const uint8_t* buffer, |
| 99 intptr_t buffer_length); | 96 intptr_t buffer_length); |
| 100 | 97 |
| 101 virtual ~StreamingScopeBuilder(); | 98 virtual ~StreamingScopeBuilder(); |
| 102 | 99 |
| 103 ScopeBuildingResult* BuildScopes(); | 100 ScopeBuildingResult* BuildScopes(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 191 |
| 195 intptr_t name_index_; | 192 intptr_t name_index_; |
| 196 | 193 |
| 197 bool needs_expr_temp_; | 194 bool needs_expr_temp_; |
| 198 TokenPosition first_body_token_position_; | 195 TokenPosition first_body_token_position_; |
| 199 | 196 |
| 200 StreamingFlowGraphBuilder* builder_; | 197 StreamingFlowGraphBuilder* builder_; |
| 201 StreamingDartTypeTranslator type_translator_; | 198 StreamingDartTypeTranslator type_translator_; |
| 202 }; | 199 }; |
| 203 | 200 |
| 204 | |
| 205 // There are several cases when we are compiling constant expressions: | 201 // There are several cases when we are compiling constant expressions: |
| 206 // | 202 // |
| 207 // * constant field initializers: | 203 // * constant field initializers: |
| 208 // const FieldName = <expr>; | 204 // const FieldName = <expr>; |
| 209 // | 205 // |
| 210 // * constant expressions: | 206 // * constant expressions: |
| 211 // const [<expr>, ...] | 207 // const [<expr>, ...] |
| 212 // const {<expr> : <expr>, ...} | 208 // const {<expr> : <expr>, ...} |
| 213 // const Constructor(<expr>, ...) | 209 // const Constructor(<expr>, ...) |
| 214 // | 210 // |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 word flags_; | 935 word flags_; |
| 940 intptr_t parent_class_binary_offset_; | 936 intptr_t parent_class_binary_offset_; |
| 941 intptr_t source_uri_index_; | 937 intptr_t source_uri_index_; |
| 942 intptr_t annotation_count_; | 938 intptr_t annotation_count_; |
| 943 | 939 |
| 944 private: | 940 private: |
| 945 StreamingFlowGraphBuilder* builder_; | 941 StreamingFlowGraphBuilder* builder_; |
| 946 intptr_t next_read_; | 942 intptr_t next_read_; |
| 947 }; | 943 }; |
| 948 | 944 |
| 949 | |
| 950 // Helper class that reads a kernel Procedure from binary. | 945 // Helper class that reads a kernel Procedure from binary. |
| 951 // | 946 // |
| 952 // Use ReadUntilExcluding to read up to but not including a field. | 947 // Use ReadUntilExcluding to read up to but not including a field. |
| 953 // One can then for instance read the field from the call-site (and remember to | 948 // One can then for instance read the field from the call-site (and remember to |
| 954 // call SetAt to inform this helper class), and then use this to read more. | 949 // call SetAt to inform this helper class), and then use this to read more. |
| 955 // "Dumb" fields are stored (e.g. integers) and can be fetched from this class. | 950 // "Dumb" fields are stored (e.g. integers) and can be fetched from this class. |
| 956 // If asked to read a "non-dumb" field (e.g. an expression) it will be skipped. | 951 // If asked to read a "non-dumb" field (e.g. an expression) it will be skipped. |
| 957 class ProcedureHelper { | 952 class ProcedureHelper { |
| 958 public: | 953 public: |
| 959 enum Fields { | 954 enum Fields { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 private: | 1478 private: |
| 1484 Reader* reader_; | 1479 Reader* reader_; |
| 1485 intptr_t saved_offset_; | 1480 intptr_t saved_offset_; |
| 1486 }; | 1481 }; |
| 1487 | 1482 |
| 1488 } // namespace kernel | 1483 } // namespace kernel |
| 1489 } // namespace dart | 1484 } // namespace dart |
| 1490 | 1485 |
| 1491 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1486 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1492 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 1487 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
| OLD | NEW |