Index: runtime/vm/flow_graph_allocator.cc |
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc |
index 7b62e3792c3461fd16262c6b9814eb4e6c5622cc..5c65b0d5baf256cb013e3864d251217b2231f865 100644 |
--- a/runtime/vm/flow_graph_allocator.cc |
+++ b/runtime/vm/flow_graph_allocator.cc |
@@ -11,6 +11,7 @@ |
#include "vm/flow_graph_compiler.h" |
#include "vm/log.h" |
#include "vm/parser.h" |
+#include "vm/stack_frame.h" |
namespace dart { |
@@ -612,10 +613,6 @@ void FlowGraphAllocator::BuildLiveRanges() { |
} else if (block->IsCatchBlockEntry()) { |
// Process initial definitions. |
CatchBlockEntryInstr* catch_entry = block->AsCatchBlockEntry(); |
-#if defined(TARGET_ARCH_DBC) |
- // TODO(vegorov) support try-catch/finally for DBC. |
- flow_graph_.parsed_function().Bailout("FlowGraphAllocator", "Catch"); |
-#endif |
ProcessEnvironmentUses(catch_entry, catch_entry); // For lazy deopt |
@@ -631,10 +628,19 @@ void FlowGraphAllocator::BuildLiveRanges() { |
// block start to until the end of the instruction so that they are |
// preserved. |
intptr_t start = catch_entry->start_pos(); |
- BlockLocation(Location::RegisterLocation(kExceptionObjectReg), |
+#if !defined(TARGET_ARCH_DBC) |
+ const Register exception_reg = kExceptionObjectReg; |
+ const Register stacktrace_reg = kStackTraceObjectReg; |
+#else |
+ const intptr_t exception_reg = |
+ LocalVarIndex(0, catch_entry->exception_var().index()); |
+ const intptr_t stacktrace_reg = |
+ LocalVarIndex(0, catch_entry->stacktrace_var().index()); |
+#endif |
+ BlockLocation(Location::RegisterLocation(exception_reg), |
start, |
ToInstructionEnd(start)); |
- BlockLocation(Location::RegisterLocation(kStackTraceObjectReg), |
+ BlockLocation(Location::RegisterLocation(stacktrace_reg), |
start, |
ToInstructionEnd(start)); |
} |
@@ -657,6 +663,42 @@ void FlowGraphAllocator::BuildLiveRanges() { |
void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, |
LiveRange* range, |
BlockEntryInstr* block) { |
+#if defined(TARGET_ARCH_DBC) |
+ if (block->IsCatchBlockEntry()) { |
+ if (defn->IsParameter()) { |
+ ParameterInstr* param = defn->AsParameter(); |
+ intptr_t slot_index = param->index(); |
+ AssignSafepoints(defn, range); |
+ range->finger()->Initialize(range); |
+ slot_index = kNumberOfCpuRegisters - 1 - slot_index; |
+ range->set_assigned_location(Location::RegisterLocation(slot_index)); |
Vyacheslav Egorov (Google)
2016/10/13 15:02:04
Some of this code is repeated below just with kNo
Florian Schneider
2016/10/13 17:24:03
Done.
|
+ if (range->End() > block->lifetime_position() + 2) { |
+ LiveRange* tail = range->SplitAt(block->lifetime_position() + 2); |
+ CompleteRange(tail, Location::kRegister); |
+ } |
+ ConvertAllUses(range); |
+ BlockLocation(Location::RegisterLocation(slot_index), 0, kMaxPosition); |
+ } else { |
+ ConstantInstr* constant = defn->AsConstant(); |
+ ASSERT(constant != NULL); |
+ range->set_assigned_location(Location::Constant(constant)); |
+ range->set_spill_slot(Location::Constant(constant)); |
+ AssignSafepoints(defn, range); |
+ range->finger()->Initialize(range); |
+ UsePosition* use = |
+ range->finger()->FirstRegisterBeneficialUse(block->start_pos()); |
+ if (use != NULL) { |
+ LiveRange* tail = |
+ SplitBetween(range, block->start_pos(), use->pos()); |
+ // Parameters and constants are tagged, so allocated to CPU registers. |
+ CompleteRange(tail, Location::kRegister); |
Vyacheslav Egorov (Google)
2016/10/13 15:02:04
we have UnboxedConstantInstr (which inherits from
Florian Schneider
2016/10/13 17:24:03
Done.
|
+ } |
+ ConvertAllUses(range); |
+ } |
+ return; |
+ } |
+#endif |
+ |
// Save the range end because it may change below. |
intptr_t range_end = range->End(); |
if (defn->IsParameter()) { |