OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 4 #if !defined(DART_PRECOMPILED_RUNTIME) |
5 #include "vm/flow_graph_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
6 | 6 |
7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
8 #include "vm/precompiler.h" | 8 #include "vm/precompiler.h" |
9 #include "vm/block_scheduler.h" | 9 #include "vm/block_scheduler.h" |
10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 function.set_is_inlinable(false); | 856 function.set_is_inlinable(false); |
857 TRACE_INLINING(THR_Print(" Bailout: optional arg mismatch\n")); | 857 TRACE_INLINING(THR_Print(" Bailout: optional arg mismatch\n")); |
858 PRINT_INLINING_TREE("Optional arg mismatch", &call_data->caller, | 858 PRINT_INLINING_TREE("Optional arg mismatch", &call_data->caller, |
859 &function, call_data->call); | 859 &function, call_data->call); |
860 return false; | 860 return false; |
861 } | 861 } |
862 } | 862 } |
863 | 863 |
864 // After treating optional parameters the actual/formal count must | 864 // After treating optional parameters the actual/formal count must |
865 // match. | 865 // match. |
866 // TODO(regis): Consider type arguments in arguments. | |
Vyacheslav Egorov (Google)
2017/05/13 22:20:14
maybe also add
if (function.IsGeneric()) return
regis
2017/05/18 21:02:12
I suspect that many generic functions of the sdk g
| |
866 ASSERT(arguments->length() == function.NumParameters()); | 867 ASSERT(arguments->length() == function.NumParameters()); |
867 ASSERT(param_stubs->length() == callee_graph->parameter_count()); | 868 ASSERT(param_stubs->length() == callee_graph->parameter_count()); |
868 | 869 |
869 // Update try-index of the callee graph. | 870 // Update try-index of the callee graph. |
870 BlockEntryInstr* call_block = call_data->call->GetBlock(); | 871 BlockEntryInstr* call_block = call_data->call->GetBlock(); |
871 if (call_block->InsideTryBlock()) { | 872 if (call_block->InsideTryBlock()) { |
872 intptr_t try_index = call_block->try_index(); | 873 intptr_t try_index = call_block->try_index(); |
873 for (BlockIterator it = callee_graph->reverse_postorder_iterator(); | 874 for (BlockIterator it = callee_graph->reverse_postorder_iterator(); |
874 !it.Done(); it.Advance()) { | 875 !it.Done(); it.Advance()) { |
875 BlockEntryInstr* block = it.Current(); | 876 BlockEntryInstr* block = it.Current(); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1334 const Array& argument_names, | 1335 const Array& argument_names, |
1335 GrowableArray<Value*>* arguments, | 1336 GrowableArray<Value*>* arguments, |
1336 ZoneGrowableArray<Definition*>* param_stubs, | 1337 ZoneGrowableArray<Definition*>* param_stubs, |
1337 FlowGraph* callee_graph) { | 1338 FlowGraph* callee_graph) { |
1338 const Function& function = parsed_function.function(); | 1339 const Function& function = parsed_function.function(); |
1339 // The language and this code does not support both optional positional | 1340 // The language and this code does not support both optional positional |
1340 // and optional named parameters for the same function. | 1341 // and optional named parameters for the same function. |
1341 ASSERT(!function.HasOptionalPositionalParameters() || | 1342 ASSERT(!function.HasOptionalPositionalParameters() || |
1342 !function.HasOptionalNamedParameters()); | 1343 !function.HasOptionalNamedParameters()); |
1343 | 1344 |
1345 // TODO(regis): Consider type arguments in arguments. | |
1344 intptr_t arg_count = arguments->length(); | 1346 intptr_t arg_count = arguments->length(); |
1345 intptr_t param_count = function.NumParameters(); | 1347 intptr_t param_count = function.NumParameters(); |
1346 intptr_t fixed_param_count = function.num_fixed_parameters(); | 1348 intptr_t fixed_param_count = function.num_fixed_parameters(); |
1347 ASSERT(fixed_param_count <= arg_count); | 1349 ASSERT(fixed_param_count <= arg_count); |
1348 ASSERT(arg_count <= param_count); | 1350 ASSERT(arg_count <= param_count); |
1349 | 1351 |
1350 if (function.HasOptionalPositionalParameters()) { | 1352 if (function.HasOptionalPositionalParameters()) { |
1351 // Create a stub for each optional positional parameters with an actual. | 1353 // Create a stub for each optional positional parameters with an actual. |
1352 for (intptr_t i = fixed_param_count; i < arg_count; ++i) { | 1354 for (intptr_t i = fixed_param_count; i < arg_count; ++i) { |
1353 param_stubs->Add(CreateParameterStub(i, (*arguments)[i], callee_graph)); | 1355 param_stubs->Add(CreateParameterStub(i, (*arguments)[i], callee_graph)); |
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3783 } | 3785 } |
3784 | 3786 |
3785 default: | 3787 default: |
3786 return false; | 3788 return false; |
3787 } | 3789 } |
3788 } | 3790 } |
3789 | 3791 |
3790 | 3792 |
3791 } // namespace dart | 3793 } // namespace dart |
3792 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3794 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |