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

Unified Diff: runtime/vm/flow_graph_compiler_dbc.cc

Issue 2796283003: VM: [Kernel] Implement CatchBlockEntryInstr::should_restore_closure_context on all platforms. (Closed)
Patch Set: Address Zach's comment Created 3 years, 8 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/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4450561dddf7cbe65856ed954d4ae8cd8119d24a..5e0f8bce871702bc31336f5531f12c7461e89934 100644
--- a/runtime/vm/flow_graph_compiler_dbc.cc
+++ b/runtime/vm/flow_graph_compiler_dbc.cc
@@ -400,17 +400,23 @@ void FlowGraphCompiler::EmitFrameEntry() {
}
if (function.IsClosureFunction()) {
- Register reg =
+ // In optimized mode the register allocator expects CurrentContext in the
+ // flow_graph_.num_copied_params() register at function entry.
+ // (see FlowGraphAllocator::ProcessInitialDefinition)
+ Register context_reg =
is_optimizing() ? flow_graph_.num_copied_params() : context_index;
- Register closure_reg = reg;
LocalScope* scope = parsed_function().node_sequence()->scope();
LocalVariable* local = scope->VariableAt(0);
+
+ Register closure_reg;
if (local->index() > 0) {
- __ Move(reg, -local->index());
+ __ Move(context_reg, -local->index());
+ closure_reg = context_reg;
} else {
closure_reg = -local->index() - 1;
}
- __ LoadField(reg, closure_reg, Closure::context_offset() / kWordSize);
+ __ LoadField(context_reg, closure_reg,
+ Closure::context_offset() / kWordSize);
} else if (has_optional_params && !is_optimizing()) {
__ LoadConstant(context_index, Object::empty_context());
}
@@ -440,6 +446,14 @@ uint16_t FlowGraphCompiler::ToEmbeddableCid(intptr_t cid,
}
+intptr_t FlowGraphCompiler::CatchEntryRegForVariable(const LocalVariable& var) {
+ ASSERT(is_optimizing());
+ ASSERT(var.index() <= 0);
+ return kNumberOfCpuRegisters -
+ (flow_graph().num_non_copied_params() - var.index());
+}
+
+
#undef __
#define __ compiler_->assembler()->
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698