Index: runtime/vm/intermediate_language.cc |
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc |
index 250651e3bb61c3cee1b4fec56e64c5add6da63d7..3d739ba7649940ea394b9890dccca18ce25578a4 100644 |
--- a/runtime/vm/intermediate_language.cc |
+++ b/runtime/vm/intermediate_language.cc |
@@ -2530,6 +2530,39 @@ void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
} |
+void IndirectGotoInstr::ComputeOffsetTable(Isolate* isolate) { |
+ ASSERT(SuccessorCount() == offsets_.Capacity()); |
+ offsets_.SetLength(SuccessorCount()); |
+ for (intptr_t i = 0; i < SuccessorCount(); i++) { |
+ TargetEntryInstr* target = SuccessorAt(i); |
+ |
+ // Optimizations might have modified the immediate target block, but |
+ // it must end with a goto to the indirect entry. |
+ Instruction* instr = target; |
Vyacheslav Egorov (Google)
2014/11/13 18:30:04
use target->last_instruction() instead of the loop
zerny-google
2014/11/14 13:29:29
No can do, since it is not set if the target is un
|
+ while (instr != NULL && !instr->IsGoto()) { |
+ instr = instr->next(); |
+ } |
+ ASSERT(instr->IsGoto()); |
+ |
+ IndirectEntryInstr* ientry = |
+ instr->AsGoto()->successor()->AsIndirectEntry(); |
+ ASSERT(ientry != NULL); |
+ ASSERT(ientry->indirect_id() == i); |
+ |
+ // The intermediate block might be compacted, check both it and the |
+ // final indirect entry for a valid offset. If neither are valid, then |
+ // the indirect entry is unreachable. |
+ intptr_t offset = |
Vyacheslav Egorov (Google)
2014/11/13 18:30:04
when can the ientry be unreachable?
if it is "unr
zerny-google
2014/11/14 13:29:28
It is possible that we never emit a backtracking p
|
+ (target->offset() > 0) ? target->offset() : ientry->offset(); |
+ |
+ if (offset > 0) { |
+ offset -= Assembler::EntryPointToPcMarkerOffset(); |
+ offsets_.SetAt(i, Smi::ZoneHandle(isolate, Smi::New(offset))); |
+ } |
+ } |
+} |
+ |
+ |
LocationSummary* IndirectEntryInstr::MakeLocationSummary( |
Isolate* isolate, bool optimizing) const { |
return JoinEntryInstr::MakeLocationSummary(isolate, optimizing); |