Index: runtime/vm/intermediate_language_mips.cc |
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc |
index 9c72ba1877fc8f7926a37d377c97c92156e7c3b6..4456f6ea2dd0f4222d9b1e4bcd1fc0147bb0804d 100644 |
--- a/runtime/vm/intermediate_language_mips.cc |
+++ b/runtime/vm/intermediate_language_mips.cc |
@@ -3773,22 +3773,13 @@ void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
__ Bind(compiler->GetJumpLabel(this)); |
if (!compiler->is_optimizing()) { |
+ compiler->EmitEdgeCounter(); |
+ // On MIPS the deoptimization descriptor points after the edge counter |
+ // code so that we can reuse the same pattern matching code as at call |
+ // sites, which matches backwards from the end of the pattern. |
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
deopt_id_, |
Scanner::kDummyTokenIndex); |
- // Add an edge counter. |
- const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); |
- counter.SetAt(0, Smi::Handle(Smi::New(0))); |
- Label done; |
- __ Comment("Edge counter"); |
- __ LoadObject(T0, counter); |
- __ lw(T1, FieldAddress(T0, Array::element_offset(0))); |
- __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES, T2); |
- __ bgez(CMPRES, &done); |
- __ delay_slot()->sw(T1, FieldAddress(T0, Array::element_offset(0))); |
- __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue)); |
- __ sw(TMP1, FieldAddress(T0, Array::element_offset(0))); // If overflow. |
- __ Bind(&done); |
} |
if (HasParallelMove()) { |
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
@@ -3803,6 +3794,17 @@ LocationSummary* GotoInstr::MakeLocationSummary() const { |
void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
__ TraceSimMsg("GotoInstr"); |
+ if (!compiler->is_optimizing()) { |
+ compiler->EmitEdgeCounter(); |
+ // Add a deoptimization descriptor for deoptimizing instructions that |
+ // may be inserted before this instruction. On MIPS this descriptor |
+ // points after the edge counter code so that we can reuse the same |
+ // pattern matching code as at call sites, which matches backwards from |
+ // the end of the pattern. |
+ compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
+ GetDeoptId(), |
+ Scanner::kDummyTokenIndex); |
+ } |
if (HasParallelMove()) { |
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
} |