| 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. |
| 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 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3809 } | 3811 } |
| 3810 | 3812 |
| 3811 default: | 3813 default: |
| 3812 return false; | 3814 return false; |
| 3813 } | 3815 } |
| 3814 } | 3816 } |
| 3815 | 3817 |
| 3816 | 3818 |
| 3817 } // namespace dart | 3819 } // namespace dart |
| 3818 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3820 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |