| Index: runtime/vm/flow_graph_builder.cc
|
| ===================================================================
|
| --- runtime/vm/flow_graph_builder.cc (revision 25556)
|
| +++ runtime/vm/flow_graph_builder.cc (working copy)
|
| @@ -542,6 +542,7 @@
|
| Definition* EffectGraphVisitor::BuildStoreLocal(
|
| const LocalVariable& local, Value* value, bool result_is_needed) {
|
| if (local.is_captured()) {
|
| + InlineBailout("EffectGraphVisitor::BuildStoreLocal (context)");
|
| if (result_is_needed) {
|
| value = Bind(BuildStoreExprTemp(value));
|
| }
|
| @@ -574,6 +575,7 @@
|
|
|
| Definition* EffectGraphVisitor::BuildLoadLocal(const LocalVariable& local) {
|
| if (local.is_captured()) {
|
| + InlineBailout("EffectGraphVisitor::BuildLoadLocal (context)");
|
| intptr_t delta =
|
| owner()->context_level() - local.owner()->context_level();
|
| ASSERT(delta >= 0);
|
| @@ -592,14 +594,14 @@
|
|
|
|
|
| // Stores current context into the 'variable'
|
| -void EffectGraphVisitor::BuildSaveContext(const LocalVariable& variable) {
|
| +void EffectGraphVisitor::BuildStoreContext(const LocalVariable& variable) {
|
| Value* context = Bind(new CurrentContextInstr());
|
| Do(BuildStoreLocal(variable, context, kResultNotNeeded));
|
| }
|
|
|
|
|
| // Loads context saved in 'context_variable' into the current context.
|
| -void EffectGraphVisitor::BuildRestoreContext(const LocalVariable& variable) {
|
| +void EffectGraphVisitor::BuildLoadContext(const LocalVariable& variable) {
|
| Value* load_saved_context = Bind(BuildLoadLocal(variable));
|
| AddInstruction(new StoreContextInstr(load_saved_context));
|
| }
|
| @@ -821,7 +823,7 @@
|
| ASSERT(current_context_level >= 0);
|
| if (owner()->parsed_function()->saved_entry_context_var() != NULL) {
|
| // CTX on entry was saved, but not linked as context parent.
|
| - BuildRestoreContext(*owner()->parsed_function()->saved_entry_context_var());
|
| + BuildLoadContext(*owner()->parsed_function()->saved_entry_context_var());
|
| } else {
|
| while (current_context_level-- > 0) {
|
| UnchainContext();
|
| @@ -2136,7 +2138,7 @@
|
|
|
| // Save context around the call.
|
| ASSERT(owner()->parsed_function()->saved_current_context_var() != NULL);
|
| - BuildSaveContext(*owner()->parsed_function()->saved_current_context_var());
|
| + BuildStoreContext(*owner()->parsed_function()->saved_current_context_var());
|
| return new ClosureCallInstr(node, arguments);
|
| }
|
|
|
| @@ -2145,7 +2147,7 @@
|
| Do(BuildClosureCall(node));
|
| // Restore context from saved location.
|
| ASSERT(owner()->parsed_function()->saved_current_context_var() != NULL);
|
| - BuildRestoreContext(*owner()->parsed_function()->saved_current_context_var());
|
| + BuildLoadContext(*owner()->parsed_function()->saved_current_context_var());
|
| }
|
|
|
|
|
| @@ -2153,12 +2155,13 @@
|
| Value* result = Bind(BuildClosureCall(node));
|
| // Restore context from temp.
|
| ASSERT(owner()->parsed_function()->saved_current_context_var() != NULL);
|
| - BuildRestoreContext(*owner()->parsed_function()->saved_current_context_var());
|
| + BuildLoadContext(*owner()->parsed_function()->saved_current_context_var());
|
| ReturnValue(result);
|
| }
|
|
|
|
|
| void EffectGraphVisitor::VisitCloneContextNode(CloneContextNode* node) {
|
| + InlineBailout("EffectGraphVisitor::VisitCloneContextNode (context)");
|
| Value* context = Bind(new CurrentContextInstr());
|
| Value* clone = Bind(new CloneContextInstr(node->token_pos(), context));
|
| AddInstruction(new StoreContextInstr(clone));
|
| @@ -3065,6 +3068,7 @@
|
|
|
|
|
| void EffectGraphVisitor::UnchainContext() {
|
| + InlineBailout("EffectGraphVisitor::UnchainContext (context)");
|
| Value* context = Bind(new CurrentContextInstr());
|
| Value* parent = Bind(
|
| new LoadFieldInstr(context,
|
| @@ -3083,6 +3087,7 @@
|
| (scope != NULL) ? scope->num_context_variables() : 0;
|
| int previous_context_level = owner()->context_level();
|
| if (num_context_variables > 0) {
|
| + InlineBailout("EffectGraphVisitor::VisitSequenceNode (context)");
|
| // The loop local scope declares variables that are captured.
|
| // Allocate and chain a new context.
|
| // Allocate context computation (uses current CTX)
|
| @@ -3200,8 +3205,7 @@
|
| if (is_open()) {
|
| if (MustSaveRestoreContext(node)) {
|
| ASSERT(num_context_variables > 0);
|
| - BuildRestoreContext(
|
| - *owner()->parsed_function()->saved_entry_context_var());
|
| + BuildLoadContext(*owner()->parsed_function()->saved_entry_context_var());
|
| } else if (num_context_variables > 0) {
|
| UnchainContext();
|
| }
|
| @@ -3232,7 +3236,7 @@
|
| // Restores CTX from local variable ':saved_context'.
|
| AddInstruction(
|
| new CatchEntryInstr(node->exception_var(), node->stacktrace_var()));
|
| - BuildRestoreContext(node->context_var());
|
| + BuildLoadContext(node->context_var());
|
|
|
| EffectGraphVisitor for_catch(owner(), temp_index());
|
| node->VisitChildren(&for_catch);
|
| @@ -3247,7 +3251,7 @@
|
| owner()->set_try_index(try_handler_index);
|
|
|
| // Preserve CTX into local variable '%saved_context'.
|
| - BuildSaveContext(node->context_var());
|
| + BuildStoreContext(node->context_var());
|
|
|
| EffectGraphVisitor for_try(owner(), temp_index());
|
| node->try_block()->Visit(&for_try);
|
| @@ -3304,7 +3308,7 @@
|
| for_finally.AddInstruction(
|
| new CatchEntryInstr(catch_block->exception_var(),
|
| catch_block->stacktrace_var()));
|
| - for_finally.BuildRestoreContext(catch_block->context_var());
|
| + for_finally.BuildLoadContext(catch_block->context_var());
|
|
|
| finally_block->Visit(&for_finally);
|
| if (for_finally.is_open()) {
|
| @@ -3474,7 +3478,7 @@
|
| // thrown not from the current try block but the outer try block if any.
|
| owner()->set_try_index((try_index - 1));
|
| }
|
| - BuildRestoreContext(node->context_var());
|
| + BuildLoadContext(node->context_var());
|
|
|
| JoinEntryInstr* finally_entry =
|
| new JoinEntryInstr(owner()->AllocateBlockId(), owner()->try_index());
|
|
|