Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: runtime/vm/parser.cc

Issue 12179020: Fix for issues 6080 - pass in the Isolate's top context into the stub for invoking dart code from n… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698