Chromium Code Reviews| Index: runtime/vm/flow_graph_compiler_dbc.cc |
| diff --git a/runtime/vm/flow_graph_compiler_dbc.cc b/runtime/vm/flow_graph_compiler_dbc.cc |
| index 06114b23b921b91dfffa90f1522e8b4ec8c13dd0..4f2e5574ec1bf0c9f5d822015fc3f0735f9a5b4c 100644 |
| --- a/runtime/vm/flow_graph_compiler_dbc.cc |
| +++ b/runtime/vm/flow_graph_compiler_dbc.cc |
| @@ -383,12 +383,18 @@ void FlowGraphCompiler::EmitFrameEntry() { |
| if (function.IsClosureFunction()) { |
| // In optimized mode the register allocator expects CurrentContext in the |
| - // flow_graph_.num_copied_params() register at function entry. |
| + // flow_graph_.num_copied_params() register at function entry, unless that |
| + // register is used for function type arguments, either as their |
| + // permanent location or as their temporary location when captured. |
| + // In that case, the next register holds CurrentContext. |
| // (see FlowGraphAllocator::ProcessInitialDefinition) |
| Register context_reg = |
| - is_optimizing() ? flow_graph_.num_copied_params() : context_index; |
| + is_optimizing() ? ((parsed_function().function_type_arguments() != NULL) |
|
Vyacheslav Egorov (Google)
2017/08/16 05:27:36
The code below uses FLAG_reify_generic_functions &
regis
2017/08/16 17:47:48
Done.
I also unified with the code in FlowGraphAll
|
| + ? flow_graph_.num_copied_params() + 1 |
| + : flow_graph_.num_copied_params()) |
| + : context_index; |
| LocalScope* scope = parsed_function().node_sequence()->scope(); |
| - LocalVariable* local = scope->VariableAt(0); |
| + LocalVariable* local = scope->VariableAt(0); // Closure instance receiver. |
| Register closure_reg; |
| if (local->index() > 0) { |
| @@ -406,9 +412,14 @@ void FlowGraphCompiler::EmitFrameEntry() { |
| // Check for a passed type argument vector if the function is generic. |
| if (FLAG_reify_generic_functions && function.IsGeneric() && |
| !flow_graph().IsCompiledForOsr()) { |
| - __ Comment("Check passed-in type args"); |
| - UNIMPLEMENTED(); // TODO(regis): Not yet supported. |
| + ASSERT(-parsed_function().first_stack_local_index() - 1 == |
| + flow_graph_.num_copied_params()); |
| + __ CheckFunctionTypeArgs(function.NumTypeParameters(), |
| + flow_graph_.num_copied_params()); |
| } |
| + |
| + // TODO(regis): Verify that no vector is passed if not generic, unless already |
| + // checked during resolution. |
| } |
| void FlowGraphCompiler::CompileGraph() { |