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

Side by Side 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: Incorporated review comments. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 3755 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3766 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3767 if (!compiler->CanFallThroughTo(normal_entry())) { 3767 if (!compiler->CanFallThroughTo(normal_entry())) {
3768 __ b(compiler->GetJumpLabel(normal_entry())); 3768 __ b(compiler->GetJumpLabel(normal_entry()));
3769 } 3769 }
3770 } 3770 }
3771 3771
3772 3772
3773 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3773 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3774 __ Bind(compiler->GetJumpLabel(this)); 3774 __ Bind(compiler->GetJumpLabel(this));
3775 if (!compiler->is_optimizing()) { 3775 if (!compiler->is_optimizing()) {
3776 compiler->EmitEdgeCounter();
3777 // On MIPS the deoptimization descriptor points after the edge counter
3778 // code so that we can reuse the same pattern matching code as at call
3779 // sites, which matches backwards from the end of the pattern.
3776 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 3780 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
3777 deopt_id_, 3781 deopt_id_,
3778 Scanner::kDummyTokenIndex); 3782 Scanner::kDummyTokenIndex);
3779 // Add an edge counter.
3780 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
3781 counter.SetAt(0, Smi::Handle(Smi::New(0)));
3782 Label done;
3783 __ Comment("Edge counter");
3784 __ LoadObject(T0, counter);
3785 __ lw(T1, FieldAddress(T0, Array::element_offset(0)));
3786 __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES, T2);
3787 __ bgez(CMPRES, &done);
3788 __ delay_slot()->sw(T1, FieldAddress(T0, Array::element_offset(0)));
3789 __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue));
3790 __ sw(TMP1, FieldAddress(T0, Array::element_offset(0))); // If overflow.
3791 __ Bind(&done);
3792 } 3783 }
3793 if (HasParallelMove()) { 3784 if (HasParallelMove()) {
3794 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 3785 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
3795 } 3786 }
3796 } 3787 }
3797 3788
3798 3789
3799 LocationSummary* GotoInstr::MakeLocationSummary() const { 3790 LocationSummary* GotoInstr::MakeLocationSummary() const {
3800 return new LocationSummary(0, 0, LocationSummary::kNoCall); 3791 return new LocationSummary(0, 0, LocationSummary::kNoCall);
3801 } 3792 }
3802 3793
3803 3794
3804 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3795 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3805 __ TraceSimMsg("GotoInstr"); 3796 __ TraceSimMsg("GotoInstr");
3797 if (!compiler->is_optimizing()) {
3798 compiler->EmitEdgeCounter();
3799 // Add a deoptimization descriptor for deoptimizing instructions that
3800 // may be inserted before this instruction. On MIPS this descriptor
3801 // points after the edge counter code so that we can reuse the same
3802 // pattern matching code as at call sites, which matches backwards from
3803 // the end of the pattern.
3804 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
3805 GetDeoptId(),
3806 Scanner::kDummyTokenIndex);
3807 }
3806 if (HasParallelMove()) { 3808 if (HasParallelMove()) {
3807 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 3809 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
3808 } 3810 }
3809 3811
3810 // We can fall through if the successor is the next block in the list. 3812 // We can fall through if the successor is the next block in the list.
3811 // Otherwise, we need a jump. 3813 // Otherwise, we need a jump.
3812 if (!compiler->CanFallThroughTo(successor())) { 3814 if (!compiler->CanFallThroughTo(successor())) {
3813 __ b(compiler->GetJumpLabel(successor())); 3815 __ b(compiler->GetJumpLabel(successor()));
3814 } 3816 }
3815 } 3817 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
4048 compiler->GenerateCall(token_pos(), 4050 compiler->GenerateCall(token_pos(),
4049 &label, 4051 &label,
4050 PcDescriptors::kOther, 4052 PcDescriptors::kOther,
4051 locs()); 4053 locs());
4052 __ Drop(2); // Discard type arguments and receiver. 4054 __ Drop(2); // Discard type arguments and receiver.
4053 } 4055 }
4054 4056
4055 } // namespace dart 4057 } // namespace dart
4056 4058
4057 #endif // defined TARGET_ARCH_MIPS 4059 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698