OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include <set> | 5 #include <set> |
6 | 6 |
7 #include "vm/kernel_to_il.h" | 7 #include "vm/kernel_to_il.h" |
8 | 8 |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 result += second; | 60 result += second; |
61 return result; | 61 return result; |
62 } | 62 } |
63 | 63 |
64 Fragment operator<<(const Fragment& fragment, Instruction* next) { | 64 Fragment operator<<(const Fragment& fragment, Instruction* next) { |
65 Fragment result = fragment; | 65 Fragment result = fragment; |
66 result <<= next; | 66 result <<= next; |
67 return result; | 67 return result; |
68 } | 68 } |
69 | 69 |
| 70 intptr_t ActiveClass::MemberTypeParameterCount(Zone* zone) { |
| 71 ASSERT(member != NULL); |
| 72 if (member->IsFactory()) { |
| 73 TypeArguments& class_types = |
| 74 dart::TypeArguments::Handle(zone, klass->type_parameters()); |
| 75 return class_types.Length(); |
| 76 } else if (member->IsMethodExtractor()) { |
| 77 Function& extracted = |
| 78 Function::Handle(zone, member->extracted_method_closure()); |
| 79 TypeArguments& function_types = |
| 80 dart::TypeArguments::Handle(zone, extracted.type_parameters()); |
| 81 return function_types.Length(); |
| 82 } else { |
| 83 TypeArguments& function_types = |
| 84 dart::TypeArguments::Handle(zone, member->type_parameters()); |
| 85 return function_types.Length(); |
| 86 } |
| 87 } |
| 88 |
70 TranslationHelper::TranslationHelper(Thread* thread) | 89 TranslationHelper::TranslationHelper(Thread* thread) |
71 : thread_(thread), | 90 : thread_(thread), |
72 zone_(thread->zone()), | 91 zone_(thread->zone()), |
73 isolate_(thread->isolate()), | 92 isolate_(thread->isolate()), |
74 allocation_space_(thread->IsMutatorThread() ? Heap::kNew : Heap::kOld), | 93 allocation_space_(thread->IsMutatorThread() ? Heap::kNew : Heap::kOld), |
75 string_offsets_(TypedData::Handle(Z)), | 94 string_offsets_(TypedData::Handle(Z)), |
76 string_data_(TypedData::Handle(Z)), | 95 string_data_(TypedData::Handle(Z)), |
77 canonical_names_(TypedData::Handle(Z)) {} | 96 canonical_names_(TypedData::Handle(Z)) {} |
78 | 97 |
79 TranslationHelper::TranslationHelper(Thread* thread, | 98 TranslationHelper::TranslationHelper(Thread* thread, |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 #ifdef DEBUG | 773 #ifdef DEBUG |
755 Function& function = | 774 Function& function = |
756 Function::Handle(Z, parsed_function_->function().raw()); | 775 Function::Handle(Z, parsed_function_->function().raw()); |
757 while (function.IsClosureFunction()) { | 776 while (function.IsClosureFunction()) { |
758 function = function.parent_function(); | 777 function = function.parent_function(); |
759 } | 778 } |
760 ASSERT(function.IsFactory()); | 779 ASSERT(function.IsFactory()); |
761 #endif | 780 #endif |
762 instructions += LoadLocal(scopes_->type_arguments_variable); | 781 instructions += LoadLocal(scopes_->type_arguments_variable); |
763 } else if (scopes_->this_variable != NULL && | 782 } else if (scopes_->this_variable != NULL && |
764 active_class_.class_type_parameters > 0) { | 783 active_class_.ClassTypeParameterCount(Z) > 0) { |
765 ASSERT(!parsed_function_->function().IsFactory()); | 784 ASSERT(!parsed_function_->function().IsFactory()); |
766 intptr_t type_arguments_field_offset = | 785 intptr_t type_arguments_field_offset = |
767 active_class_.klass->type_arguments_field_offset(); | 786 active_class_.klass->type_arguments_field_offset(); |
768 ASSERT(type_arguments_field_offset != dart::Class::kNoTypeArguments); | 787 ASSERT(type_arguments_field_offset != dart::Class::kNoTypeArguments); |
769 | 788 |
770 instructions += LoadLocal(scopes_->this_variable); | 789 instructions += LoadLocal(scopes_->this_variable); |
771 instructions += LoadField(type_arguments_field_offset); | 790 instructions += LoadField(type_arguments_field_offset); |
772 } else { | 791 } else { |
773 instructions += NullConstant(); | 792 instructions += NullConstant(); |
774 } | 793 } |
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2355 StreamingFlowGraphBuilder streaming_flow_graph_builder( | 2374 StreamingFlowGraphBuilder streaming_flow_graph_builder( |
2356 &helper, zone_, script.kernel_data(), script.kernel_data_size()); | 2375 &helper, zone_, script.kernel_data(), script.kernel_data_size()); |
2357 return streaming_flow_graph_builder.GetLineStartsFor( | 2376 return streaming_flow_graph_builder.GetLineStartsFor( |
2358 script.kernel_script_index()); | 2377 script.kernel_script_index()); |
2359 } | 2378 } |
2360 | 2379 |
2361 } // namespace kernel | 2380 } // namespace kernel |
2362 } // namespace dart | 2381 } // namespace dart |
2363 | 2382 |
2364 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 2383 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |