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

Unified Diff: runtime/vm/intermediate_language_ia32.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: Incorporated review comments. 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
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index e7c587ebea240da5d92569d1ef2e1b30c31049cf..7e13f1d30ce42974e5ab91c19488a8615138138f 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -4713,21 +4713,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(EAX, counter);
- __ addl(FieldAddress(EAX, Array::element_offset(0)),
- Immediate(Smi::RawValue(1)));
- __ j(NO_OVERFLOW, &done);
- __ movl(FieldAddress(EAX, Array::element_offset(0)),
- Immediate(Smi::RawValue(Smi::kMaxValue)));
- __ Bind(&done);
}
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
@@ -4742,23 +4734,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(EAX, counter);
- __ addl(FieldAddress(EAX, Array::element_offset(0)),
- Immediate(Smi::RawValue(1)));
- __ j(NO_OVERFLOW, &done);
- __ movl(FieldAddress(EAX, Array::element_offset(0)),
- Immediate(Smi::RawValue(Smi::kMaxValue)));
- __ Bind(&done);
+ Scanner::kDummyTokenIndex);
}
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698