OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 if (Isolate::Current()->TypeChecksEnabled()) { | 1049 if (Isolate::Current()->TypeChecksEnabled()) { |
1050 const bool is_implicit_dynamic_getter = | 1050 const bool is_implicit_dynamic_getter = |
1051 (!function.is_static() && | 1051 (!function.is_static() && |
1052 ((function.kind() == RawFunction::kImplicitGetter) || | 1052 ((function.kind() == RawFunction::kImplicitGetter) || |
1053 (function.kind() == RawFunction::kImplicitStaticFinalGetter))); | 1053 (function.kind() == RawFunction::kImplicitStaticFinalGetter))); |
1054 // Implicit getters do not need a type check at return, unless they compute | 1054 // Implicit getters do not need a type check at return, unless they compute |
1055 // the initial value of a static field. | 1055 // the initial value of a static field. |
1056 // The body of a constructor cannot modify the type of the | 1056 // The body of a constructor cannot modify the type of the |
1057 // constructed instance, which is passed in as an implicit parameter. | 1057 // constructed instance, which is passed in as an implicit parameter. |
1058 // However, factories may create an instance of the wrong type. | 1058 // However, factories may create an instance of the wrong type. |
1059 if (!is_implicit_dynamic_getter && !function.IsConstructor()) { | 1059 if (!is_implicit_dynamic_getter && !function.IsGenerativeConstructor()) { |
1060 const AbstractType& dst_type = | 1060 const AbstractType& dst_type = |
1061 AbstractType::ZoneHandle(I, function.result_type()); | 1061 AbstractType::ZoneHandle(I, function.result_type()); |
1062 return_value = BuildAssignableValue(node->value()->token_pos(), | 1062 return_value = BuildAssignableValue(node->value()->token_pos(), |
1063 return_value, | 1063 return_value, |
1064 dst_type, | 1064 dst_type, |
1065 Symbols::FunctionResult()); | 1065 Symbols::FunctionResult()); |
1066 } | 1066 } |
1067 } | 1067 } |
1068 | 1068 |
1069 // Async functions contain two types of return statements: | 1069 // Async functions contain two types of return statements: |
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3844 // create the stack check in order to allocate a deopt id. | 3844 // create the stack check in order to allocate a deopt id. |
3845 if (!owner()->IsInlining()) { | 3845 if (!owner()->IsInlining()) { |
3846 AddInstruction(check); | 3846 AddInstruction(check); |
3847 } | 3847 } |
3848 } | 3848 } |
3849 } | 3849 } |
3850 | 3850 |
3851 if (Isolate::Current()->TypeChecksEnabled() && is_top_level_sequence) { | 3851 if (Isolate::Current()->TypeChecksEnabled() && is_top_level_sequence) { |
3852 const int num_params = function.NumParameters(); | 3852 const int num_params = function.NumParameters(); |
3853 int pos = 0; | 3853 int pos = 0; |
3854 if (function.IsConstructor()) { | 3854 if (function.IsGenerativeConstructor()) { |
3855 // Skip type checking of receiver and phase for constructor functions. | 3855 // Skip type checking of receiver and phase for constructor functions. |
3856 pos = 2; | 3856 pos = 2; |
3857 } else if (function.IsFactory() || function.IsDynamicFunction()) { | 3857 } else if (function.IsFactory() || function.IsDynamicFunction()) { |
3858 // Skip type checking of type arguments for factory functions. | 3858 // Skip type checking of type arguments for factory functions. |
3859 // Skip type checking of receiver for instance functions. | 3859 // Skip type checking of receiver for instance functions. |
3860 pos = 1; | 3860 pos = 1; |
3861 } | 3861 } |
3862 while (pos < num_params) { | 3862 while (pos < num_params) { |
3863 const LocalVariable& parameter = *scope->VariableAt(pos); | 3863 const LocalVariable& parameter = *scope->VariableAt(pos); |
3864 ASSERT(parameter.owner() == scope); | 3864 ASSERT(parameter.owner() == scope); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4356 Report::MessageF(Report::kBailout, | 4356 Report::MessageF(Report::kBailout, |
4357 Script::Handle(function.script()), | 4357 Script::Handle(function.script()), |
4358 function.token_pos(), | 4358 function.token_pos(), |
4359 "FlowGraphBuilder Bailout: %s %s", | 4359 "FlowGraphBuilder Bailout: %s %s", |
4360 String::Handle(function.name()).ToCString(), | 4360 String::Handle(function.name()).ToCString(), |
4361 reason); | 4361 reason); |
4362 UNREACHABLE(); | 4362 UNREACHABLE(); |
4363 } | 4363 } |
4364 | 4364 |
4365 } // namespace dart | 4365 } // namespace dart |
OLD | NEW |