Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 18203) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -180,6 +180,16 @@ |
| scope, |
| &context_owner); |
| + // Allocate a local variable to save the current context when we call into |
|
hausner
2013/02/07 17:00:45
Can we allocate this variable only when really nee
siva
2013/02/07 22:08:31
Changed this to allocate only when needed followin
|
| + // any closure function as the call will destroy the current context. |
| + LocalVariable* context_var = |
| + new LocalVariable(function().token_pos(), |
| + Symbols::SavedCurrentContextVar(), |
| + Type::ZoneHandle(Type::DynamicType())); |
| + context_var->set_index(next_free_frame_index--); |
| + scope->AddVariable(context_var); |
| + set_saved_current_context_var(context_var); |
| + |
| // If this function allocates context variables, but none of its enclosing |
| // functions do, the context on entry is not linked as parent of the allocated |
| // context but saved on entry and restored on exit as to prevent memory leaks. |
| @@ -5938,9 +5948,10 @@ |
| TRACE_PARSER("ParseTryStatement"); |
| // We create three stack slots for exceptions here: |
| - // ':saved_context_var' - Used to save the context before start of the try |
| - // block. The context register is restored from this |
| - // slot before processing the catch block handler. |
| + // ':saved_try_context_var' - Used to save the context before start of the try |
| + // block. The context register is restored from |
| + // this slot before processing the catch block |
| + // handler. |
| // ':exception_var' - Used to save the current exception object that was |
| // thrown. |
| // ':stacktrace_var' - Used to save the current stack trace object into which |
| @@ -5950,10 +5961,10 @@ |
| // and the stacktrace object when an exception is thrown. |
| // These three implicit variables can never be captured variables. |
| LocalVariable* context_var = |
| - current_block_->scope->LocalLookupVariable(Symbols::SavedContextVar()); |
| + current_block_->scope->LocalLookupVariable(Symbols::SavedTryContextVar()); |
| if (context_var == NULL) { |
| context_var = new LocalVariable(TokenPos(), |
| - Symbols::SavedContextVar(), |
| + Symbols::SavedTryContextVar(), |
| Type::ZoneHandle(Type::DynamicType())); |
| current_block_->scope->AddVariable(context_var); |
| } |