| 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 | 4 |
| 5 #include "vm/flow_graph_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
| 6 | 6 |
| 7 #include "vm/block_scheduler.h" | 7 #include "vm/block_scheduler.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 env = env->outer(); | 91 env = env->outer(); |
| 92 } | 92 } |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 // Helper to get the default value of a formal parameter. | 97 // Helper to get the default value of a formal parameter. |
| 98 static ConstantInstr* GetDefaultValue(intptr_t i, | 98 static ConstantInstr* GetDefaultValue(intptr_t i, |
| 99 const ParsedFunction& parsed_function) { | 99 const ParsedFunction& parsed_function) { |
| 100 return new ConstantInstr(Object::ZoneHandle( | 100 return new ConstantInstr(parsed_function.DefaultParameterValueAt(i)); |
| 101 parsed_function.default_parameter_values().At(i))); | |
| 102 } | 101 } |
| 103 | 102 |
| 104 | 103 |
| 105 // Pair of an argument name and its value. | 104 // Pair of an argument name and its value. |
| 106 struct NamedArgument { | 105 struct NamedArgument { |
| 107 String* name; | 106 String* name; |
| 108 Value* value; | 107 Value* value; |
| 109 NamedArgument(String* name, Value* value) | 108 NamedArgument(String* name, Value* value) |
| 110 : name(name), value(value) { } | 109 : name(name), value(value) { } |
| 111 }; | 110 }; |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 if (function.HasOptionalPositionalParameters()) { | 1192 if (function.HasOptionalPositionalParameters()) { |
| 1194 // Create a stub for each optional positional parameters with an actual. | 1193 // Create a stub for each optional positional parameters with an actual. |
| 1195 for (intptr_t i = fixed_param_count; i < arg_count; ++i) { | 1194 for (intptr_t i = fixed_param_count; i < arg_count; ++i) { |
| 1196 param_stubs->Add(CreateParameterStub(i, (*arguments)[i], callee_graph)); | 1195 param_stubs->Add(CreateParameterStub(i, (*arguments)[i], callee_graph)); |
| 1197 } | 1196 } |
| 1198 ASSERT(function.NumOptionalPositionalParameters() == | 1197 ASSERT(function.NumOptionalPositionalParameters() == |
| 1199 (param_count - fixed_param_count)); | 1198 (param_count - fixed_param_count)); |
| 1200 // For each optional positional parameter without an actual, add its | 1199 // For each optional positional parameter without an actual, add its |
| 1201 // default value. | 1200 // default value. |
| 1202 for (intptr_t i = arg_count; i < param_count; ++i) { | 1201 for (intptr_t i = arg_count; i < param_count; ++i) { |
| 1203 const Object& object = | 1202 const Instance& object = |
| 1204 Object::ZoneHandle( | 1203 parsed_function.DefaultParameterValueAt(i - fixed_param_count); |
| 1205 parsed_function.default_parameter_values().At( | |
| 1206 i - fixed_param_count)); | |
| 1207 ConstantInstr* constant = new(Z) ConstantInstr(object); | 1204 ConstantInstr* constant = new(Z) ConstantInstr(object); |
| 1208 arguments->Add(NULL); | 1205 arguments->Add(NULL); |
| 1209 param_stubs->Add(constant); | 1206 param_stubs->Add(constant); |
| 1210 } | 1207 } |
| 1211 return true; | 1208 return true; |
| 1212 } | 1209 } |
| 1213 | 1210 |
| 1214 ASSERT(function.HasOptionalNamedParameters()); | 1211 ASSERT(function.HasOptionalNamedParameters()); |
| 1215 | 1212 |
| 1216 // Passed arguments must match fixed parameters plus named arguments. | 1213 // Passed arguments must match fixed parameters plus named arguments. |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 intptr_t FlowGraphInliner::NextInlineId(const Function& function, | 1891 intptr_t FlowGraphInliner::NextInlineId(const Function& function, |
| 1895 intptr_t parent_id) { | 1892 intptr_t parent_id) { |
| 1896 const intptr_t id = inline_id_to_function_->length(); | 1893 const intptr_t id = inline_id_to_function_->length(); |
| 1897 inline_id_to_function_->Add(&function); | 1894 inline_id_to_function_->Add(&function); |
| 1898 caller_inline_id_->Add(parent_id); | 1895 caller_inline_id_->Add(parent_id); |
| 1899 return id; | 1896 return id; |
| 1900 } | 1897 } |
| 1901 | 1898 |
| 1902 | 1899 |
| 1903 } // namespace dart | 1900 } // namespace dart |
| OLD | NEW |