Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 41393) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -127,6 +127,19 @@ |
| } |
| +LocalVariable* ParsedFunction::EnsureSavedCurrentContext() { |
|
hausner
2014/10/29 16:44:34
Now that every function has a local variable to st
Florian Schneider
2014/10/29 17:50:45
Done. Yes, I can now remove this function.
|
| + if (!has_current_context_var()) { |
| + LocalVariable* temp = new(I) LocalVariable( |
| + function().token_pos(), |
| + Symbols::CurrentContextVar(), |
| + Type::ZoneHandle(I, Type::DynamicType())); |
| + ASSERT(temp != NULL); |
| + set_current_context_var(temp); |
| + } |
| + return current_context_var(); |
| +} |
| + |
| + |
| void ParsedFunction::EnsureFinallyReturnTemp() { |
| if (!has_finally_return_temp_var()) { |
| LocalVariable* temp = new(I) LocalVariable( |
| @@ -345,6 +358,7 @@ |
| if (FLAG_enable_type_checks) { |
| EnsureExpressionTemp(); |
| } |
| + EnsureSavedCurrentContext(); |
| } |
| @@ -864,9 +878,9 @@ |
| if (parsed_function->has_expression_temp_var()) { |
| node_sequence->scope()->AddVariable(parsed_function->expression_temp_var()); |
| } |
| - if (parsed_function->has_saved_current_context_var()) { |
| + if (parsed_function->has_current_context_var()) { |
|
hausner
2014/10/29 16:44:34
This is always true now, correct?
Florian Schneider
2014/10/29 17:50:45
Done.
|
| node_sequence->scope()->AddVariable( |
| - parsed_function->saved_current_context_var()); |
| + parsed_function->current_context_var()); |
| } |
| if (parsed_function->has_finally_return_temp_var()) { |
| node_sequence->scope()->AddVariable( |
| @@ -1068,8 +1082,8 @@ |
| if (parsed_function->has_expression_temp_var()) { |
| body->scope()->AddVariable(parsed_function->expression_temp_var()); |
| } |
| - if (parsed_function->has_saved_current_context_var()) { |
| - body->scope()->AddVariable(parsed_function->saved_current_context_var()); |
| + if (parsed_function->has_current_context_var()) { |
|
hausner
2014/10/29 16:44:34
ditto
Florian Schneider
2014/10/29 17:50:45
Done.
|
| + body->scope()->AddVariable(parsed_function->current_context_var()); |
| } |
| if (parsed_function->has_finally_return_temp_var()) { |
| body->scope()->AddVariable(parsed_function->finally_return_temp_var()); |
| @@ -1387,7 +1401,6 @@ |
| ASSERT(!owner.IsNull()); |
| AstNode* result = NULL; |
| if (owner.IsSignatureClass() && name.Equals(Symbols::Call())) { |
| - EnsureSavedCurrentContext(); |
| result = new ClosureCallNode(token_pos, getter_call, args); |
| } else { |
| result = BuildClosureCall(token_pos, getter_call, args); |
| @@ -8696,15 +8709,7 @@ |
| void Parser::EnsureSavedCurrentContext() { |
| - // Used later by the flow_graph_builder to save current context. |
| - if (!parsed_function()->has_saved_current_context_var()) { |
| - LocalVariable* temp = new(I) LocalVariable( |
| - current_function().token_pos(), |
| - Symbols::SavedCurrentContextVar(), |
| - Type::ZoneHandle(I, Type::DynamicType())); |
| - ASSERT(temp != NULL); |
| - parsed_function()->set_saved_current_context_var(temp); |
| - } |
| + parsed_function()->EnsureSavedCurrentContext(); |
| } |