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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 class TypeParameterScope { | 51 class TypeParameterScope { |
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 outer_parameter_count_ = 0; |
| 61 if (outer_ != NULL) { |
| 62 outer_parameter_count_ = |
| 63 outer_->outer_parameter_count_ + outer_->parameters_count_; |
| 64 } |
60 translator_->type_parameter_scope_ = this; | 65 translator_->type_parameter_scope_ = this; |
61 } | 66 } |
62 ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; } | 67 ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; } |
63 | 68 |
64 TypeParameterScope* outer() const { return outer_; } | 69 TypeParameterScope* outer() const { return outer_; } |
65 intptr_t parameters_offset() const { return parameters_offset_; } | 70 intptr_t parameters_offset() const { return parameters_offset_; } |
66 intptr_t parameters_count() const { return parameters_count_; } | 71 intptr_t parameters_count() const { return parameters_count_; } |
| 72 intptr_t outer_parameter_count() const { return outer_parameter_count_; } |
67 | 73 |
68 private: | 74 private: |
69 intptr_t parameters_offset_; | 75 intptr_t parameters_offset_; |
70 intptr_t parameters_count_; | 76 intptr_t parameters_count_; |
| 77 intptr_t outer_parameter_count_; |
71 TypeParameterScope* outer_; | 78 TypeParameterScope* outer_; |
72 StreamingDartTypeTranslator* translator_; | 79 StreamingDartTypeTranslator* translator_; |
73 }; | 80 }; |
74 | 81 |
75 intptr_t FindTypeParameterIndex(intptr_t parameters_offset, | 82 intptr_t FindTypeParameterIndex(intptr_t parameters_offset, |
76 intptr_t parameters_count, | 83 intptr_t parameters_count, |
77 intptr_t look_for); | 84 intptr_t look_for); |
78 | 85 |
79 StreamingFlowGraphBuilder* builder_; | 86 StreamingFlowGraphBuilder* builder_; |
80 TranslationHelper& translation_helper_; | 87 TranslationHelper& translation_helper_; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 GrowableArray<intptr_t>* record_token_positions_in, | 346 GrowableArray<intptr_t>* record_token_positions_in, |
340 GrowableArray<intptr_t>* record_yield_positions_in); | 347 GrowableArray<intptr_t>* record_yield_positions_in); |
341 intptr_t SourceTableSize(); | 348 intptr_t SourceTableSize(); |
342 String& SourceTableUriFor(intptr_t index); | 349 String& SourceTableUriFor(intptr_t index); |
343 String& GetSourceFor(intptr_t index); | 350 String& GetSourceFor(intptr_t index); |
344 Array& GetLineStartsFor(intptr_t index); | 351 Array& GetLineStartsFor(intptr_t index); |
345 | 352 |
346 private: | 353 private: |
347 void DiscoverEnclosingElements(Zone* zone, | 354 void DiscoverEnclosingElements(Zone* zone, |
348 const Function& function, | 355 const Function& function, |
349 Function* outermost_function, | 356 Function* outermost_function); |
350 intptr_t* outermost_kernel_offset, | |
351 intptr_t* parent_class_offset); | |
352 intptr_t GetParentOffset(intptr_t offset); | |
353 void GetTypeParameterInfoForClass(intptr_t class_offset, | |
354 intptr_t* type_paremeter_counts, | |
355 intptr_t* type_paremeter_offset); | |
356 | 357 |
357 void GetTypeParameterInfoForPossibleProcedure( | |
358 intptr_t outermost_kernel_offset, | |
359 bool* member_is_procedure, | |
360 bool* is_factory_procedure, | |
361 intptr_t* member_type_parameters, | |
362 intptr_t* member_type_parameters_offset_start); | |
363 /** | 358 /** |
364 * Will return kernel offset for parent class if reading a constructor. | 359 * Will return kernel offset for parent class if reading a constructor. |
365 * Will otherwise return -1. | 360 * Will otherwise return -1. |
366 */ | 361 */ |
367 intptr_t ReadUntilFunctionNode(); | 362 intptr_t ReadUntilFunctionNode(); |
368 StringIndex GetNameFromVariableDeclaration(intptr_t kernel_offset); | 363 StringIndex GetNameFromVariableDeclaration(intptr_t kernel_offset); |
369 | 364 |
370 FlowGraph* BuildGraphOfStaticFieldInitializer(); | 365 FlowGraph* BuildGraphOfStaticFieldInitializer(); |
371 FlowGraph* BuildGraphOfFieldAccessor(LocalVariable* setter_value); | 366 FlowGraph* BuildGraphOfFieldAccessor(LocalVariable* setter_value); |
372 void SetupDefaultParameterValues(); | 367 void SetupDefaultParameterValues(); |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 private: | 1548 private: |
1554 StreamingFlowGraphBuilder* builder_; | 1549 StreamingFlowGraphBuilder* builder_; |
1555 intptr_t next_read_; | 1550 intptr_t next_read_; |
1556 }; | 1551 }; |
1557 | 1552 |
1558 } // namespace kernel | 1553 } // namespace kernel |
1559 } // namespace dart | 1554 } // namespace dart |
1560 | 1555 |
1561 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1556 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1562 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 1557 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
OLD | NEW |