Index: runtime/vm/intermediate_language_x64.cc |
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc |
index 4d2ee9df452a91f832710091b1e2a7f2bae89ad2..4b5562b189f512cbef6133981228a2642667dc98 100644 |
--- a/runtime/vm/intermediate_language_x64.cc |
+++ b/runtime/vm/intermediate_language_x64.cc |
@@ -4499,21 +4499,13 @@ void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
__ Bind(compiler->GetJumpLabel(this)); |
if (!compiler->is_optimizing()) { |
+ compiler->EmitEdgeCounter(); |
+ // The deoptimization descriptor points after the edge counter code for |
+ // uniformity with ARM and MIPS, where we can reuse pattern matching |
+ // code that 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(RAX, counter, PP); |
- __ AddImmediate(FieldAddress(RAX, Array::element_offset(0)), |
- Immediate(Smi::RawValue(1)), PP); |
- __ j(NO_OVERFLOW, &done); |
- __ LoadImmediate(FieldAddress(RAX, Array::element_offset(0)), |
- Immediate(Smi::RawValue(Smi::kMaxValue)), PP); |
- __ Bind(&done); |
} |
if (HasParallelMove()) { |
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
@@ -4528,23 +4520,15 @@ LocationSummary* GotoInstr::MakeLocationSummary() const { |
void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
if (!compiler->is_optimizing()) { |
- // Add deoptimization descriptor for deoptimizing instructions that may |
- // be inserted before this instruction. |
+ compiler->EmitEdgeCounter(); |
+ // Add a deoptimization descriptor for deoptimizing instructions that |
+ // may be inserted before this instruction. This descriptor points |
+ // after the edge counter for uniformity with ARM and MIPS, where we can |
+ // reuse pattern matching that matches backwards from the end of the |
+ // pattern. |
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
GetDeoptId(), |
- 0); // No token position. |
- // 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(RAX, counter, PP); |
- __ AddImmediate(FieldAddress(RAX, Array::element_offset(0)), |
- Immediate(Smi::RawValue(1)), PP); |
- __ j(NO_OVERFLOW, &done); |
- __ LoadImmediate(FieldAddress(RAX, Array::element_offset(0)), |
- Immediate(Smi::RawValue(Smi::kMaxValue)), PP); |
- __ Bind(&done); |
+ Scanner::kDummyTokenIndex); |
} |
if (HasParallelMove()) { |
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |