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

Unified Diff: runtime/vm/intermediate_language_mips.cc

Issue 24744002: Pattern match on generated code to find edge counters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Refactored as discussed. Created 7 years, 3 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
Index: runtime/vm/intermediate_language_mips.cc
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index a1d5b188cc92b3fbf160f3efae9974d4b1db8c92..c84eb19041083017fabe1b0c916673b46f517bc7 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -3838,22 +3838,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());
@@ -3868,6 +3859,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(),
+ 0); // No token position.
Florian Schneider 2013/10/01 10:10:02 Use Scanner::kDummyTokenIndex?
+ }
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
}

Powered by Google App Engine
This is Rietveld 408576698